Good Programming Is Like Good Writing
David Heinemeier Hansson is a Danish programmer and the creator of the Ruby on Rails open source web development framework. He is also a partner with Jason Fried at the web-based software development firm 37signals. In 2005 he was given with the Hacker of the Year by Google and O'Reilly award for his creation of Ruby on Rails. He and Fried have also co-authored the New York Times bestseller "Rework," which reveals their secrets for boosting business productivity in the Internet age.
Question: What makes Ruby a special language?
David Heinemeier Hansson: To me good programming is just like good writing. It's succinct. You're expressing what you want to say in as few words as possible. You're picking just the right words for the sentence, and it's sort of a grand thing. A program is just like an article or a book; it's composed of tiny things like words that form into sentences, and paragraphs, and chapters, and so forth. A programming language—a good programming language—allows you to build a program in just the same way.
So you'll have methods that are really short. A big part of what makes Ruby so special to work with is just how much expression you can pack into few lines of code. When I compare it to something like Java where it takes perhaps ten lines to express a very simple operation, that same operation can be expressed in a single line of Ruby. And that just makes understanding the entire program that much easier when the density of expression is so much higher, and it's not just because it's short. There's plenty of programming languages where you can write exceptionally short code, and it's completely unreadable afterward. Ruby has this uncanny ability to just be shortened the same way your thought would be short, but no shorter than that.
The other part of it is also having a grand or free mode of expression that there are many different ways that you can say something. So for example: Lots of programming languages have—or all program languages have—conditionals. If something is true, do this. Now, sometimes you want the positive version of that. Like, “If employee works here, then print this screen.” Sometimes you want the opposite. In most program languages, you would go about that by saying, “If not programmer works here, then do this.” That's not a very natural way of expressing that. You would never say that in real life.
In Ruby, you can say, “Unless the programmer works here, do this.” So it's just all those little things where the creator of Ruby thought about the whole picture. It's not just that you can get something done. All programming languages can do the same things. There's nothing you can do in Ruby that you couldn't do in some other programming language. What makes Ruby special is how you say it.
Compared to natural languages, I think there's also just something to the tone and they rhythm of it. I'm Danish. I speak Danish, and I admit that Danish is not a very pretty language. Thankfully, it's not as ugly as German, which I think is probably one of the ugliest languages of all time. But if you compare something like German to something like French, you don't have to speak either language to hear that French is obviously the prettier language.
I think if somebody who doesn't even know code, they can look at a piece of Ruby code, and they can appreciate that Ruby is French and Java is German. That's sort of really the appeal to it. Because you have to work with this stuff all the time. Programmers often work for many, many, many hours a day, and this is your main mode of expression. It has to be good. If it's not good, if you're speaking in an ugly language every day for eight or ten hours a day... well, I won't say that it turns you into an ugly person, but I like to just surround myself with beautiful things. Ruby is beautiful; lots of other programming languages are much less so.
Question: Do programmers need to like the languages in which they code?
David Heinemeier Hansson: I think in the past, programming languages and environments have been determined by everything but the beauty of expression. It's been determined by “We have to make this really fast. We have to make this really efficient. We have to make this really logical. There has to be only one way of doing things.” All of these other concerns that you would think about when you would think about somebody approaching it in a very sort of binary approach. That's sort of the best way I can express it.
Ruby comes from a much different angle. In fact, the creator of Ruby said that his main goal of creating Ruby was to make programmers happy. Now, you're introducing something that in many ways seems like a foreign concept. You're talking about code. What does happiness have to do with anything? How does happiness play into this stuff? It absolutely does because programmers—surprisingly enough, I'm sure to a lot of people—are humans, too. And humans just respond to emotional things. They respond to beauty, they respond to a general sense of well being and liking your tools. It's not enough that your tools can get the job done. It's how they get them done. It's whether you like wielding those tools day out and day in.
And I've talked to a lot of Ruby programmers who came to sort of the edge of their career thinking they've been working in Java, or C-Sharp, or some other language that was just driving them miserable. And they were thinking, “You know what? I know how to do this stuff, but it's probably not for me. I'm not happy working with these languages or environments every day. I'm going to quit.” And then some of them found Ruby. And it almost sounds cheesy as sort of a religious experience that they find this program language that all of a sudden makes it interesting for them again to be programmers. But it's absolutely true. I felt exactly the same way. I was absolutely not convinced that I was going to be a programmer when I was working with PHP and Java.
To me, at that point programming was just something I had to do to get programs. It was sort of just a functional thing I unfortunately had to go through in order to realize the ideas that I had for programs. For me, Ruby just changed that such that the act itself was pleasurable. And I think that's just a magic moment. When you change over from not just being able to do the job to actually enjoying the job. That's just a huge difference. And I think that the product in the end also reflects that. The programs I write now are much better than the programs I wrote when I didn't like my tools.
Recorded on July 22, 2010
Interviewed by Peter Hopkins
"A big part of what makes Ruby so special to work with is just how much expression you can pack into a few lines of code," says Hansson.
Once a week.
Subscribe to our weekly newsletter.
Northwell Health is using insights from website traffic to forecast COVID-19 hospitalizations two weeks in the future.
- The machine-learning algorithm works by analyzing the online behavior of visitors to the Northwell Health website and comparing that data to future COVID-19 hospitalizations.
- The tool, which uses anonymized data, has so far predicted hospitalizations with an accuracy rate of 80 percent.
- Machine-learning tools are helping health-care professionals worldwide better constrain and treat COVID-19.
The value of forecasting<img type="lazy-image" data-runner-src="https://assets.rebelmouse.io/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6Imh0dHBzOi8vYXNzZXRzLnJibC5tcy8yNTA0Njk2OC9vcmlnaW4uanBnIiwiZXhwaXJlc19hdCI6MTYyMzM2NDQzOH0.rid9regiDaKczCCKBsu7wrHkNQ64Vz_XcOEZIzAhzgM/img.jpg?width=980" id="2bb93" class="rm-shortcode" data-rm-shortcode-id="31345afbdf2bd408fd3e9f31520c445a" data-rm-shortcode-name="rebelmouse-image" data-width="1546" data-height="1056" />
Northwell emergency departments use the dashboard to monitor in real time.
Credit: Northwell Health<p>One unique benefit of forecasting COVID-19 hospitalizations is that it allows health systems to better prepare, manage and allocate resources. For example, if the tool forecasted a surge in COVID-19 hospitalizations in two weeks, Northwell Health could begin:</p><ul><li>Making space for an influx of patients</li><li>Moving personal protective equipment to where it's most needed</li><li>Strategically allocating staff during the predicted surge</li><li>Increasing the number of tests offered to asymptomatic patients</li></ul><p>The health-care field is increasingly using machine learning. It's already helping doctors develop <a href="https://care.diabetesjournals.org/content/early/2020/06/09/dc19-1870" target="_blank">personalized care plans for diabetes patients</a>, improving cancer screening techniques, and enabling mental health professionals to better predict which patients are at <a href="https://healthitanalytics.com/news/ehr-data-fuels-accurate-predictive-analytics-for-suicide-risk" target="_blank" rel="noopener noreferrer">elevated risk of suicide</a>, to name a few applications.</p><p>Health systems around the world have already begun exploring how <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7315944/" target="_blank" rel="noopener noreferrer">machine learning can help battle the pandemic</a>, including better COVID-19 screening, diagnosis, contact tracing, and drug and vaccine development.</p><p>Cruzen said these kinds of tools represent a shift in how health systems can tackle a wide variety of problems.</p><p>"Health care has always used the past to predict the future, but not in this mathematical way," Cruzen said. "I think [Northwell Health's new predictive tool] really is a great first example of how we should be attacking a lot of things as we go forward."</p>
Making machine-learning tools openly accessible<p>Northwell Health has made its predictive tool <a href="https://github.com/northwell-health/covid-web-data-predictor" target="_blank">available for free</a> to any health system that wishes to utilize it.</p><p>"COVID is everybody's problem, and I think developing tools that can be used to help others is sort of why people go into health care," Dr. Cruzen said. "It was really consistent with our mission."</p><p>Open collaboration is something the world's governments and health systems should be striving for during the pandemic, said Michael Dowling, Northwell Health's president and CEO.</p><p>"Whenever you develop anything and somebody else gets it, they improve it and they continue to make it better," Dowling said. "As a country, we lack data. I believe very, very strongly that we should have been and should be now working with other countries, including China, including the European Union, including England and others to figure out how to develop a health surveillance system so you can anticipate way in advance when these things are going to occur."</p><p>In all, Northwell Health has treated more than 112,000 COVID patients. During the pandemic, Dowling said he's seen an outpouring of goodwill, collaboration, and sacrifice from the community and the tens of thousands of staff who work across Northwell.</p><p>"COVID has changed our perspective on everything—and not just those of us in health care, because it has disrupted everybody's life," Dowling said. "It has demonstrated the value of community, how we help one another."</p>
New research suggests you can't fake your emotional state to improve your work life — you have to feel it.
What is deep acting?<img type="lazy-image" data-runner-src="https://assets.rebelmouse.io/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6Imh0dHBzOi8vYXNzZXRzLnJibC5tcy8yNTQ1NDk2OS9vcmlnaW4uanBnIiwiZXhwaXJlc19hdCI6MTYxNTY5MzA0Nn0._s7aP25Es1CInq51pbzGrUj3GtOIRWBHZxCBFnbyXY8/img.jpg?width=1245&coordinates=333%2C-1%2C333%2C-1&height=700" id="ddf09" class="rm-shortcode" data-rm-shortcode-id="9dc42c4d6a8e372ad7b72907b46ecd3f" data-rm-shortcode-name="rebelmouse-image" data-width="1245" data-height="700" />
Arlie Russell Hochschild (pictured) laid out the concept of emotional labor in her 1983 book, "The Managed Heart."
Credit: Wikimedia Commons<p>Deep and surface acting are the principal components of emotional labor, a buzz phrase you have likely seen flitting about the Twittersphere. Today, "<a href="https://www.bbc.co.uk/bbcthree/article/5ea9f140-f722-4214-bb57-8b84f9418a7e" target="_blank">emotional labor</a>" has been adopted by groups as diverse as family counselors, academic feminists, and corporate CEOs, and each has redefined it with a patented spin. But while the phrase has splintered into a smorgasbord of pop-psychological arguments, its initial usage was more specific.</p><p>First coined by sociologist Arlie Russell Hochschild in her 1983 book, "<a href="https://www.ucpress.edu/book/9780520272941/the-managed-heart" target="_blank">The Managed Heart</a>," emotional labor describes the work we do to regulate our emotions on the job. Hochschild's go-to example is the flight attendant, who is tasked with being "nicer than natural" to enhance the customer experience. While at work, flight attendants are expected to smile and be exceedingly helpful even if they are wrestling with personal issues, the passengers are rude, and that one kid just upchucked down the center aisle. Hochschild's counterpart to the flight attendant is the bill collector, who must instead be "nastier than natural."</p><p>Such personas may serve an organization's mission or commercial interests, but if they cause emotional dissonance, they can potentially lead to high emotional costs for the employee—bringing us back to deep and surface acting.</p><p>Deep acting is the process by which people modify their emotions to match their expected role. Deep actors still encounter the negative emotions, but they devise ways to <a href="http://www.selfinjury.bctr.cornell.edu/perch/resources/what-is-emotion-regulationsinfo-brief.pdf" target="_blank">regulate those emotions</a> and return to the desired state. Flight attendants may modify their internal state by talking through harsh emotions (say, with a coworker), focusing on life's benefits (next stop Paris!), physically expressing their desired emotion (smiling and deep breaths), or recontextualizing an inauspicious situation (not the kid's fault he got sick).</p><p>Conversely, surface acting occurs when employees display ersatz emotions to match those expected by their role. These actors are the waiters who smile despite being crushed by the stress of a dinner rush. They are the CEOs who wear a confident swagger despite feelings of inauthenticity. And they are the bouncers who must maintain a steely edge despite humming show tunes in their heart of hearts.</p><p>As we'll see in the research, surface acting can degrade our mental well-being. This deterioration can be especially true of people who must contend with negative emotions or situations inside while displaying an elated mood outside. Hochschild argues such emotional labor can lead to exhaustion and self-estrangement—that is, surface actors erect a bulwark against anger, fear, and stress, but that disconnect estranges them from the emotions that allow them to connect with others and live fulfilling lives.</p>
Don't fake it till you make it<p>Most studies on emotional labor have focused on customer service for the obvious reason that such jobs prescribe emotional states—service with a smile or, if you're in the bouncing business, a scowl. But <a href="https://eller.arizona.edu/people/allison-s-gabriel" target="_blank">Allison Gabriel</a>, associate professor of management and organizations at the University of Arizona's Eller College of Management, wanted to explore how employees used emotional labor strategies in their intra-office interactions and which strategies proved most beneficial.</p><p>"What we wanted to know is whether people choose to engage in emotion regulation when interacting with their co-workers, why they choose to regulate their emotions if there is no formal rule requiring them to do so, and what benefits, if any, they get out of this effort," Gabriel said in <a href="https://www.sciencedaily.com/releases/2020/01/200117162703.htm" target="_blank">a press release</a>.</p><p>Across three studies, she and her colleagues surveyed more than 2,500 full-time employees on their emotional regulation with coworkers. The survey asked participants to agree or disagree with statements such as "I try to experience the emotions that I show to my coworkers" or "I fake a good mood when interacting with my coworkers." Other statements gauged the outcomes of such strategies—for example, "I feel emotionally drained at work." Participants were drawn from industries as varied as education, engineering, and financial services.</p><p>The results, <a href="https://psycnet.apa.org/doiLanding?doi=10.1037%2Fapl0000473" target="_blank" rel="noopener noreferrer">published in the Journal of Applied Psychology</a>, revealed four different emotional strategies. "Deep actors" engaged in high levels of deep acting; "low actors" leaned more heavily on surface acting. Meanwhile, "non-actors" engaged in negligible amounts of emotional labor, while "regulators" switched between both. The survey also revealed two drivers for such strategies: prosocial and impression management motives. The former aimed to cultivate positive relationships, the latter to present a positive front.</p><p>The researchers found deep actors were driven by prosocial motives and enjoyed advantages from their strategy of choice. These actors reported lower levels of fatigue, fewer feelings of inauthenticity, improved coworker trust, and advanced progress toward career goals. </p><p>As Gabriel told <a href="https://www.psypost.org/2021/01/new-psychology-research-suggests-deep-acting-can-reduce-fatigue-and-improve-your-work-life-59081" target="_blank" rel="noopener noreferrer">PsyPost in an interview</a>: "So, it's a win-win-win in terms of feeling good, performing well, and having positive coworker interactions."</p><p>Non-actors did not report the emotional exhaustion of their low-actor peers, but they also didn't enjoy the social gains of the deep actors. Finally, the regulators showed that the flip-flopping between surface and deep acting drained emotional reserves and strained office relationships.</p><p>"I think the 'fake it until you make it' idea suggests a survival tactic at work," Gabriel noted. "Maybe plastering on a smile to simply get out of an interaction is easier in the short run, but long term, it will undermine efforts to improve your health and the relationships you have at work. </p><p>"It all boils down to, 'Let's be nice to each other.' Not only will people feel better, but people's performance and social relationships can also improve."</p>
You'll be glad ya' decided to smile<span style="display:block;position:relative;padding-top:56.25%;" class="rm-shortcode" data-rm-shortcode-id="88a0a6a8d1c1abfcf7b1aca8e71247c6"><iframe type="lazy-iframe" data-runner-src="https://www.youtube.com/embed/QOSgpq9EGSw?rel=0" width="100%" height="auto" frameborder="0" scrolling="no" style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></span><p>But as with any research that relies on self-reported data, there are confounders here to untangle. Even during anonymous studies, participants may select socially acceptable answers over honest ones. They may further interpret their goal progress and coworker interactions more favorably than is accurate. And certain work conditions may not produce the same effects, such as toxic work environments or those that require employees to project negative emotions.</p><p>There also remains the question of the causal mechanism. If surface acting—or switching between surface and deep acting—is more mentally taxing than genuinely feeling an emotion, then what physiological process causes this fatigue? <a href="https://www.frontiersin.org/articles/10.3389/fnhum.2019.00151/full" target="_blank">One study published in the <em>Frontiers in Human Neuroscience</em></a><em> </em>measured hemoglobin density in participants' brains using an fNIRS while they expressed emotions facially. The researchers found no significant difference in energy consumed in the prefrontal cortex by those asked to deep act or surface act (though, this study too is limited by a lack of real-life task).<br></p><p>With that said, Gabriel's studies reinforce much of the current research on emotional labor. <a href="https://journals.sagepub.com/doi/abs/10.1177/2041386611417746" target="_blank">A 2011 meta-analysis</a> found that "discordant emotional labor states" (read: surface acting) were associated with harmful effects on well-being and performance. The analysis found no such consequences for deep acting. <a href="https://doi.apa.org/doiLanding?doi=10.1037%2Fa0022876" target="_blank" rel="noopener noreferrer">Another meta-analysis</a> found an association between surface acting and impaired well-being, job attitudes, and performance outcomes. Conversely, deep acting was associated with improved emotional performance.</p><p>So, although there's still much to learn on the emotional labor front, it seems Van Dyke's advice to a Leigh was half correct. We should put on a happy face, but it will <a href="https://bigthink.com/design-for-good/everything-you-should-know-about-happiness-in-one-infographic" target="_self">only help if we can feel it</a>.</p>
Archaeologists discover a cave painting of a wild pig that is now the world's oldest dated work of representational art.
- Archaeologists find a cave painting of a wild pig that is at least 45,500 years old.
- The painting is the earliest known work of representational art.
- The discovery was made in a remote valley on the Indonesian island of Sulawesi.
Oldest Cave Art Found in Sulawesi<span style="display:block;position:relative;padding-top:56.25%;" class="rm-shortcode" data-rm-shortcode-id="a9734e306f0914bfdcbe79a1e317a7f0"><iframe type="lazy-iframe" data-runner-src="https://www.youtube.com/embed/b-wAYtBxn7E?rel=0" width="100%" height="auto" frameborder="0" scrolling="no" style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></span>
"You dream about these kinds of moments when you're a kid," said lead paleontologist David Schmidt.
- The triceratops skull was first discovered in 2019, but was excavated over the summer of 2020.
- It was discovered in the South Dakota Badlands, an area where the Triceratops roamed some 66 million years ago.
- Studying dinosaurs helps scientists better understand the evolution of all life on Earth.
Credit: David Schmidt / Westminster College<p style="margin-left: 20px;">"We had to be really careful," Schmidt told St. Louis Public Radio. "We couldn't disturb anything at all, because at that point, it was under law enforcement investigation. They were telling us, 'Don't even make footprints,' and I was thinking, 'How are we supposed to do that?'"</p><p>Another difficulty was the mammoth size of the skull: about 7 feet long and more than 3,000 pounds. (For context, the largest triceratops skull ever unearthed was about <a href="https://www.tandfonline.com/doi/abs/10.1080/02724634.2010.483632" target="_blank">8.2 feet long</a>.) The skull of Schmidt's dinosaur was likely a <em>Triceratops prorsus, </em>one of two species of triceratops that roamed what's now North America about 66 million years ago.</p>
Credit: David Schmidt / Westminster College<p>The triceratops was an herbivore, but it was also a favorite meal of the T<em>yrannosaurus rex</em>. That probably explains why the Dakotas contain many scattered triceratops bone fragments, and, less commonly, complete bones and skulls. In summer 2019, for example, a separate team on a dig in North Dakota made <a href="https://www.nytimes.com/2019/07/26/science/triceratops-skull-65-million-years-old.html" target="_blank">headlines</a> after unearthing a complete triceratops skull that measured five feet in length.</p><p>Michael Kjelland, a biology professor who participated in that excavation, said digging up the dinosaur was like completing a "multi-piece, 3-D jigsaw puzzle" that required "engineering that rivaled SpaceX," he jokingly told the <a href="https://www.nytimes.com/2019/07/26/science/triceratops-skull-65-million-years-old.html" target="_blank">New York Times</a>.</p>
Morrison Formation in Colorado
James St. John via Flickr
|Credit: Nobu Tamura/Wikimedia Commons|
The Persian polymath and philosopher of the Islamic Golden Age teaches us about self-awareness.