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.
What would happen if you tripled the US population? Join Matthew Yglesias and Charles Duhigg at 1pm ET on Monday, September 28.
Controversial physics theory says reality around us behaves like a computer neural network.
- Physicist proposes that the universe behaves like an artificial neural network.
- The scientist's new paper seeks to reconcile classical physics and quantum mechanics.
- The theory claims that natural selection produces both atoms and "observers".
Vanchurin interview:<span style="display:block;position:relative;padding-top:56.25%;" class="rm-shortcode" data-rm-shortcode-id="539759cbfd8fcd5b6ebf14a3b597b3f9"><iframe type="lazy-iframe" data-runner-src="https://www.youtube.com/embed/bmyRy2-UhEE?rel=0" width="100%" height="auto" frameborder="0" scrolling="no" style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></span>
Vanchurin on “Hidden Phenomena”:<span style="display:block;position:relative;padding-top:56.25%;" class="rm-shortcode" data-rm-shortcode-id="18886ffd5e5840bb19d4494212f88d82"><iframe type="lazy-iframe" data-runner-src="https://www.youtube.com/embed/2NDVdNwsHCo?rel=0" width="100%" height="auto" frameborder="0" scrolling="no" style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></span>Vitaly Vanchurin speaking at the 6th International FQXi Conference, "Mind Matters: Intelligence and Agency in the Physical World." The Foundational Questions...
Dominique Crenn, the only female chef in America with three Michelin stars, joins Big Think Live.
Having been exposed to mavericks in the French culinary world at a young age, three-star Michelin chef Dominique Crenn made it her mission to cook in a way that is not only delicious and elegant, but also expressive, memorable, and true to her experience.
43% of people think they can get a sense of someone's personality by their picture.
If you've used a dating app, you'll know the importance of choosing good profile pics.
Whether or not women think beards are sexy has to do with "moral disgust"
- A new study found that women perceive men with facial hair to be more attractive as well as physically and socially dominant.
- Women tend to associate more masculine faces with physical strength, social assertiveness, and formidability.
- Women who display higher levels of "moral disgust," or feelings of repugnance toward taboo behaviors, are more likely to prefer hairy faces.
Beards and perceptions of masculinity<img type="lazy-image" data-runner-src="https://assets.rebelmouse.io/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6Imh0dHBzOi8vYXNzZXRzLnJibC5tcy8yMjU5OTg0MC9vcmlnaW4uanBnIiwiZXhwaXJlc19hdCI6MTY0NzkxMjM3N30.cH-GqNwP5GVqvstgJWAhBPn1B_lYpVEAI0I7iax7EQw/img.jpg?width=1245&coordinates=0%2C1900%2C0%2C849&height=700" id="caae6" class="rm-shortcode" data-rm-shortcode-id="cb0a355a4e8e1899789bc45f3f7aef56" data-rm-shortcode-name="rebelmouse-image" />
Photo Credit: Wikimedia<p>The study used 919 American (mostly white) women ages 18-70 who rated 30 pictures of men they were shown with various stages of facial hair growth. The photographs depicted men with faces that had been digitally altered to look more feminine or more masculine, with a beard and without a beard. The women rated the men according to perceived attractiveness for long-term and short-term relationships. The study found that the more facial hair the men had, the higher the men were rated on their attractiveness, particularly for their suitability for a long-term relationship.</p><p>Part of this might be attributed to facial masculinity — i.e. protruding brow ridge, wide cheekbones, thick jawline, and deeply set narrow eyes — which conveys information to a woman about a man's underlying health and formidability. Women tend to associate more masculine faces with physical strength and social assertiveness. It can also indicate a man with a superior immune response. The researchers suggested that their findings favoring bearded men could be due to the fact that facial hair enhances the masculine facial features on a man's face, like creating the illusion of a thicker jaw line. This could communicate direct benefits to women like resources and protection that would enhance survival among mothers and their infants. In other words, while a beard doesn't mean superior genetics in and of itself, it might be a primitive, ornamental way of saying, "Hey girl, I'm a testosterone-fueled lean, mean, pathogen fighting machine." <br></p><p>It could also be that a beard becomes its own destiny. The researchers in this study cite prior research that found that by growing a beard, men felt more masculine and had higher levels of serum testosterone, which was linked to a higher level of social dominance. They also tended to subscribe to more old-school beliefs about gender roles in their relationships with women as compared to men with clean-shaven faces.<span></span><br></p>
What does disgust have to do with beard preference?<p>Obviously, not all women dig beards. The researchers were particularly interested in what traits make a women prefer bearded men over clean-shaven faces. They looked into several factors including a woman's disgust levels on various concepts, her desire to become pregnant, and her exposure to facial hair in her personal life. </p><p>According to the study, women who were not into facial hair were turned-off by potential parasites or other critters they imagined could be in the hair or skin. Women ranking high on this "ectoparasite disgust" scale might have viewed beards as a sign of poor grooming habits. However, women who ranked higher in levels of "pathogen" did find the bearded men to be desirable, possibly because they perceived beards as a signal of good health and immune function. An intriguing discovery in the study was links to morality. Women who displayed higher levels of "moral disgust," or feelings of repugnance toward taboo behaviors, were more likely to prefer hairy faces. The authors opined that this could reflect a link between beardedness, politically conservative outlooks, and traditional views regarding performances of masculinity in heterosexual relationships.</p>
Additional findings<img type="lazy-image" data-runner-src="https://assets.rebelmouse.io/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6Imh0dHBzOi8vYXNzZXRzLnJibC5tcy8yMjU5OTg1My9vcmlnaW4uZ2lmIiwiZXhwaXJlc19hdCI6MTYyNDI1NjUyOX0.P9B8WbmJR0q4nfzYZKbuNSA-2SAigVWJgrQE-_Gxlds/img.gif?width=980" id="49143" class="rm-shortcode" data-rm-shortcode-id="2ed3b1d6f20fc170bf2974646e565e8d" data-rm-shortcode-name="rebelmouse-image" />Giphy<p>The correlations that existed between married and single women's rating on the attractiveness of beards were not particularly clear, although the researchers noted that single and married women who wanted children tended to find beards more attractive than the women who didn't want children. They also found that women with bearded husbands found beards to be more attractive, which might indicate that social exposure to beards influences how desirable they are perceived of as being. Or it could be that men with wives who like beards grow beards.</p><p>It's important to note that culture plays a huge role in how attractive women perceive certain male characteristics as being. This study looked at a small, culturally specific group of American women, so no big, universal claims should be made about masculinity, facial hair, and male desirability to women. However, research like this is important in highlighting how human grooming decisions are driven by much more than fashion trends. Sociobiological, economic, and ecological factors all play a part in the way we choose to present ourselves.</p>
Quarantine rule breakers in 17th-century Italy partied all night – and some clergy condemned the feasting
17th-century outbreaks of plague in Italy reveal both tensions between religious and public health authorities.
Since the beginning of the COVID-19 pandemic, conflicts between religious freedom and public health regulations have been playing out in courts around the world.