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.
The team caught a glimpse of a process that takes 18,000,000,000,000,000,000,000 years.
- In Italy, a team of scientists is using a highly sophisticated detector to hunt for dark matter.
- The team observed an ultra-rare particle interaction that reveals the half-life of a xenon-124 atom to be 18 sextillion years.
- The half-life of a process is how long it takes for half of the radioactive nuclei present in a sample to decay.
The controversial herbicide is everywhere, apparently.
- U.S. PIRG tested 20 beers and wines, including organics, and found Roundup's active ingredient in almost all of them.
- A jury on August 2018 awarded a non-Hodgkin's lymphoma victim $289 million in Roundup damages.
- Bayer/Monsanto says Roundup is totally safe. Others disagree.
One victim can break our hearts. Remember the image of the young Syrian boy discovered dead on a beach in Turkey in 2015? Donations to relief agencies soared after that image went viral. However, we feel less compassion as the number of victims grows. Are we incapable of feeling compassion for large groups of people who suffer a tragedy, such as an earthquake or the recent Sri Lanka Easter bombings? Of course not, but the truth is we aren't as compassionate as we'd like to believe, because of a paradox of large numbers. Why is this?
Compassion is a product of our sociality as primates. In his book, The Expanding Circle: Ethics, Evolution, and Moral Progress, Peter Singer states, "Human beings are social animals. We were social before we were human." Mr. Singer goes on to say, "We can be sure that we restrained our behavior toward our fellows before we were rational human beings. Social life requires some degree of restraint. A social grouping cannot stay together if its members make frequent and unrestrained attacks on one another."
Attacks on ingroups can come from forces of nature as well. In this light, compassion is a form of expressed empathy to demonstrate camaraderie.
Yet even after hundreds of centuries of evolution, when tragedy strikes beyond our community, our compassion wanes as the number of displaced, injured, and dead mounts.
The drop-off in commiseration has been termed the collapse of compassion. The term has also been defined in The Oxford Handbook of Compassion Science: ". . . people tend to feel and act less compassionately for multiple suffering victims than for a single suffering victim."
That the drop-off happens has been widely documented, but at what point this phenomenon happens remains unclear. One paper, written by Paul Slovic and Daniel Västfjäll, sets out a simple formula, ". . . where the emotion or affective feeling is greatest at N =1 but begins to fade at N = 2 and collapses at some higher value of N that becomes simply 'a statistic.'"
The ambiguity of "some higher value" is curious. That value may relate to Dunbar's Number, a theory developed by British anthropologist, Robin Dunbar. His research centers on communal groups of primates that evolved to support and care for larger and larger groups as their brains (our brains) expanded in capacity. Dunbar's is the number of people with whom we can maintain a stable relationship — approximately 150.
Some back story
Professor Robin Dunbar of the University of Oxford has published considerable research on anthropology and evolutionary psychology. His work is informed by anthropology, sociology and psychology. Dunbar's Number is a cognitive boundary, one we are likely incapable of breaching. The number is based around two notions; that brain size in primates correlates with the size of the social groups they live among and that these groups in human primates are relative to communal numbers set deep in our evolutionary past. In simpler terms, 150 is about the maximum number of people with whom we can identify with, interact with, care about, and work to protect. Dunbar's Number falls along a logorithmic continuum, beginning with the smallest, most emotionally connected group of five, then expanding outward in multiples of three: 5, 15, 50, 150. The numbers in these concentric circles are affected by multiple variables, including the closeness and size of immediate and extended families, along with the greater cognitive capacity of some individuals to maintain stable relationships with larger than normal group sizes. In other words, folks with more cerebral candlepower can engage with larger groups. Those with lesser cognitive powers, smaller groups.
The number that triggers "compassion collapse" might be different for individuals, but I think it may begin to unravel along the continuum of Dunbar's relatable 150. We can commiserate with 5 to 15 to 150 people because upon those numbers, we can overlay names and faces of people we know: our families, friends and coworkers, the members of our clan. In addition, from an evolutionary perspective, that number is important. We needed to care if bands of our clan were being harmed by raids, disaster, or disease, because our survival depended on the group staying intact. Our brains developed the capacity to care for the entirety of the group but not beyond it. Beyond our ingroup was an outgroup that may have competed with us for food and safety and it served us no practical purpose to feel sad that something awful had happened to them, only to learn the lessons so as to apply them for our own survival, e.g., don't swim with hippos.
Imagine losing 10 family members in a house fire. Now instead, lose 10 neighbors, 10 from a nearby town, 10 from Belgium, 10 from Vietnam 10 years ago. One could almost feel the emotion ebbing as the sentence drew to a close.
There are two other important factors which contribute to the softening of our compassion: proximity and time. While enjoying lunch in Santa Fe, we can discuss the death toll in the French revolution with no emotional response but might be nauseated to discuss three children lost in a recent car crash around the corner. Conflict journalists attempt to bridge these geotemporal lapses but have long struggled to ignite compassion in their home audience for far-flung tragedies, Being a witness to carnage is an immense stressor, but the impact diminishes across the airwaves as the kilometers pile up.
A Dunbar Correlation
Where is the inflection point at which people become statistics? Can we find that number? In what way might that inflection point be influenced by the Dunbar 150?
"Yes, the Dunbar number seems relevant here," said Gad Saad, PhD., the evolutionary behavioral scientist from the John Molson School of Business at Concordia University, Montreal, in an email correspondence. Saad also recommended Singer's work.
I also went to the wellspring. I asked Professor Dunbar by email if he thought 150 was a reasonable inflection point for moving from compassion into statistics. He graciously responded, lightly edited for space.
Professor Dunbar's response:
"The short answer is that I have no idea, but what you suggest is perfect sense. . . . One-hundred and fifty is the inflection point between the individuals we can empathize with because we have personal relationships with them and those with whom we don't have personalized relationships. There is, however, also another inflection point at 1,500 (the typical size of tribes in hunter-gatherer societies) which defines the limit set by the number of faces we can put names to. After 1,500, they are all completely anonymous."
I asked Dunbar if he knows of or suspects a neurophysiological aspect to the point where we simply lose the capacity to manage our compassion:
"These limits are underpinned by the size of key bits of the brain (mainly the frontal lobes, but not wholly). There are a number of studies showing this, both across primate species and within humans."
In his literature, Professor Dunbar presents two reasons why his number stands at 150, despite the ubiquity of social networking: the first is time — investing our time in a relationship is limited by the number of hours we have available to us in a given week. The second is our brain capacity measured in primates by our brain volume.
Friendship, kinship and limitations
"We devote around 40 percent of our available social time to our 5 most intimate friends and relations," Dunbar has written, "(the subset of individuals on whom we rely the most) and the remaining 60 percent in progressively decreasing amounts to the other 145."
These brain functions are costly, in terms of time, energy and emotion. Dunbar states, "There is extensive evidence, for example, to suggest that network size has significant effects on health and well-being, including morbidity and mortality, recovery from illness, cognitive function, and even willingness to adopt healthy lifestyles." This suggests that we devote so much energy to our own network that caring about a larger number may be too demanding.
"These differences in functionality may well reflect the role of mentalizing competencies. The optimal group size for a task may depend on the extent to which the group members have to be able to empathize with the beliefs and intentions of other members so as to coordinate closely…" This neocortical-to-community model carries over to compassion for others, whether in or out of our social network. Time constrains all human activity, including time to feel.
As Dunbar writes in The Anatomy of Friendship, "Friendship is the single most important factor influencing our health, well-being, and happiness. Creating and maintaining friendships is, however, extremely costly, in terms of both the time that has to be invested and the cognitive mechanisms that underpin them. Nonetheless, personal social networks exhibit many constancies, notably in their size and their hierarchical structuring." Our mental capacity may be the primary reason we feel less empathy and compassion for larger groups; we simply don't have the cerebral apparatus to manage their plights. "Part of friendship is the act of mentalizing, or mentally envisioning the landscape of another's mind. Cognitively, this process is extraordinarily taxing, and as such, intimate conversations seem to be capped at about four people before they break down and form smaller conversational groups. If the conversation involves speculating about an absent person's mental state (e.g., gossiping), then the cap is three — which is also a number that Shakespeare's plays respect."
We cannot mentalize what is going on in the minds of people in our groups much beyond our inner circle, so it stands to reason we cannot do it for large groups separated from us by geotemporal lapses.
In a paper, C. Daryl Cameron and Keith B. Payne state, "Some researchers have suggested that [compassion collapse] happens because emotions are not triggered by aggregates. We provide evidence for an alternative account. People expect the needs of large groups to be potentially overwhelming, and, as a result, they engage in emotion regulation to prevent themselves from experiencing overwhelming levels of emotion. Because groups are more likely than individuals to elicit emotion regulation, people feel less for groups than for individuals."
This argument seems to imply that we have more control over diminishing compassion than not. To say, "people expect the needs of large groups to be potentially overwhelming" suggests we consciously consider what that caring could entail and back away from it, or that we become aware that we are reaching and an endpoint of compassion and begin to purposely shift the framing of the incident from one that is personal to one that is statistical. The authors offer an alternative hypothesis to the notion that emotions are not triggered by aggregates, by attempting to show that we regulate our emotional response as the number of victims becomes perceived to be overwhelming. However, in the real world, for example, large death tolls are not brought to us one victim at a time. We are told, about a devastating event, then react viscerally.
If we don't begin to express our emotions consciously, then the process must be subconscious, and that number could have evolved to where it is now innate.
Gray matter matters
One of Dunbar's most salient points is that brain capacity influences social networks. In his paper, The Social Brain, he writes: "Path analysis suggests that there is a specific causal relationship in which the volume of a key prefrontal cortex subregion (or subregions) determines an individual's mentalizing skills, and these skills in turn determine the size of his or her social network."
It's not only the size of the brain but in fact, mentalizing recruits different regions for ingroup empathy. The Stanford Center for Compassion and Altruism Research and Education published a study of the brain regions activated when showing empathy for strangers in which the authors stated, "Interestingly, in brain imaging studies of mentalizing, participants recruit more dorsal portions of the medial prefrontal cortex (dMPFC; BA 8/9) when mentalizing about strangers, whereas they recruit more ventral regions of the medial prefrontal cortex (BA 10), similar to the MPFC activation reported in the current study, when mentalizing about close others with whom participants experience self-other overlap."⁷
It's possible the region of the brain that activates to help an ingroup member evolved for good reason, survival of the group. Other regions may have begun to expand as those smaller tribal groups expanded into larger societies.
There is an eclectic list of reasons why compassion may collapse, irrespective of sheer numbers:
(1) Manner: How the news is presented affects viewer framing. In her book, European Foreign Conflict Reporting: A Comparative Analysis of Public News, Emma Heywood explores how tragedies and war are offered to the viewers, which can elicit greater or lesser compassionate responses. "Techniques, which could raise compassion amongst the viewers, and which prevail on New at Ten, are disregarded, allowing the victims to remain unfamiliar and dissociated from the viewer. This approach does not encourage viewers to engage with the sufferers, rather releases them from any responsibility to participate emotionally. Instead compassion values are sidelined and potential opportunities to dwell on victim coverage are replaced by images of fighting and violence."
(2) Ethnicity. How relatable are the victims? Although it can be argued that people in western countries would feel a lesser degree of compassion for victims of a bombing in Karachi, that doesn't mean people in countries near Pakistan wouldn't feel compassion for the Karachi victims at a level comparable to what westerners might feel about a bombing in Toronto. Distance has a role to play in this dynamic as much as in the sound evolutionary data that demonstrate a need for us to both recognize and empathize with people who look like our communal entity. It's not racism; it's tribalism. We are simply not evolved from massive heterogeneous cultures. As evolving humans, we're still working it all out. It's a survival mechanism that developed over millennia that we now struggle with as we fine tune our trust for others.
In the end
Think of compassion collapse on a grid, with compassion represented in the Y axis and the number of victims running along the X. As the number of victims increases beyond one, our level of compassion is expected to rise. Setting aside other variables that may raise compassion (proximity, familiarity etc.), the level continues to rise until, for some reason, it begins to fall precipitously.
Is it because we've become aware of being overwhelmed or because we have reached max-capacity neuron load? Dunbar's Number seems a reasonable place to look for a tipping point.
Professor Dunbar has referred to the limits of friendship as a "budgeting problem." We simply don't have the time to manage a bigger group of friends. Our compassion for the plight of strangers may drop of at a number equivalent to the number of people with who we can be friends, a number to which we unconsciously relate. Whether or not we solve this intellectual question, it remains a curious fact that the larger a tragedy is, the more likely human faces are to become faceless numbers.
SMARTER FASTER trademarks owned by The Big Think, Inc. All rights reserved.