Good Programming Is Like Good Writing


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.

A map of America’s most famous – and infamous

The 'People Map of the United States' zooms in on America's obsession with celebrity

Image: The Pudding
Strange Maps
  • Replace city names with those of their most famous residents
  • And you get a peculiar map of America's obsession with celebrity
  • If you seek fame, become an actor, musician or athlete rather than a politician, entrepreneur or scientist

Chicagoland is Obamaland

Image: The Pudding

Chicagoland's celebrity constellation: dominated by Barack, but with plenty of room for the Belushis, Brandos and Capones of this world.

Seen from among the satellites, this map of the United States is populated by a remarkably diverse bunch of athletes, entertainers, entrepreneurs and other persons of repute (and disrepute).

The multitalented Dwayne Johnson, boxing legend Muhammad Ali and Apple co-founder Steve Jobs dominate the West Coast. Right down the middle, we find actors Chris Pratt and Jason Momoa, singer Elvis Presley and basketball player Shaquille O'Neal. The East Coast crew include wrestler John Cena, whistle-blower Edward Snowden, mass murderer Ted Bundy… and Dwayne Johnson, again.

The Rock pops up in both Hayward, CA and Southwest Ranches, FL, but he's not the only one to appear twice on the map. Wild West legend Wyatt Earp makes an appearance in both Deadwood, SD and Dodge City, KS.

How is that? This 'People's Map of the United States' replaces the names of cities with those of "their most Wikipedia'ed resident: people born in, lived in, or connected to a place."

‘Cincinnati, Birthplace of Charles Manson'

Image: The Pudding

Keys to the city, or lock 'em up and throw away the key? A city's most famous sons and daughters of a city aren't always the most favoured ones.

That definition allows people to appear in more than one locality. Dwayne Johnson was born in Hayward, has one of his houses in Southwest Ranches, and is famous enough to be the 'most Wikipedia'ed resident' for both localities.

Wyatt Earp was born in Monmouth, IL, but his reputation is closely associated with both Deadwood and Dodge City – although he's most famous for the Gunfight at the O.K. Corral, which took place in Tombstone, AZ. And yes, if you zoom in on that town in southern Arizona, there's Mr Earp again.

The data for this map was collected via the Wikipedia API (application programming interface) from the English-language Wikipedia for the period from July 2015 to May 2019.

The thousands of 'Notable People' sections in Wikipedia entries for cities and other places in the U.S. were scrubbed for the person with the most pageviews. No distinction was made between places of birth, residence or death. As the developers note, "people can 'be from' multiple places".

Pageviews are an impartial indicator of interest – it doesn't matter whether your claim to fame is horrific or honorific. As a result, this map provides a non-judgmental overview of America's obsession with celebrity.

Royals and (other) mortals

Image: The Pudding

There's also a UK version of the People Map – filled with last names like Neeson, Sheeran, Darwin and Churchill – and a few first names of monarchs.

Celebrity, it is often argued, is our age's version of the Greek pantheon, populated by dozens of major gods and thousands of minor ones, each an example of behaviours to emulate or avoid. This constellation of stars, famous and infamous, is more than a map of names. It's a window into America's soul.

But don't let that put you off. Zooming in on the map is entertaining enough: celebrities floating around in the ether are suddenly tied down to a pedestrian level, and to real geography. And it's fun to see the famous and the infamous rub shoulders, as it were.

Barack Obama owns Chicago, but the suburbs to the west of the city are dotted with a panoply of personalities, ranging from the criminal (Al Capone, Cicero) and the musical (John Prine, Maywood) to figures literary (Jonathan Franzen, Western Springs) and painterly (Ivan Albright, Warrenville), actorial (Harrison Ford, Park Ridge) and political (Eugene V. Debs, Elmhurst).

Freaks and angels

Image: Dorothy

The People Map of the U.S. was inspired by the U.S.A. Song Map, substituting song titles for place names.

It would be interesting to compare 'the most Wikipedia'ed' sons and daughters of America's cities with the ones advertised at the city limits. When you're entering Aberdeen, WA, a sign invites you to 'come as you are', in homage to its most famous son, Kurt Cobain. It's a safe bet that Indian Hill, OH will make sure you know Neil Armstrong, first man on the moon, was one of theirs. But it's highly unlikely that Cincinnati, a bit further south, will make any noise about Charles Manson, local boy done bad.

Inevitably, the map also reveals some bitterly ironic neighbours, such as Ishi, the last of the Yahi tribe, captured near Oroville, CA. He died in 1916 as "the last wild Indian in North America". The most 'pageviewed' resident of nearby Colusa, CA is Byron de la Beckwith, Jr., the white supremacist convicted for the murder of Civil Rights activist Medgar Evers.

As a sampling of America's interests, this map teaches that those aiming for fame would do better to become actors, musicians or athletes rather than politicians, entrepreneurs or scientists. But also that celebrity is not limited to the big city lights of LA or New York. Even in deepest Dakota or flattest Kansas, the footlights of fame will find you. Whether that's good or bad? The pageviews don't judge...

Keep reading Show less

Thumbs up? Map shows Europe’s hitchhiking landscape

Average waiting time for hitchhikers in Ireland: Less than 30 minutes. In southern Spain: More than 90 minutes.

Image: Abel Suyok
Strange Maps
  • A popular means of transportation from the 1920s to the 1980s, hitchhiking has since fallen in disrepute.
  • However, as this map shows, thumbing a ride still occupies a thriving niche – if at great geographic variance.
  • In some countries and areas, you'll be off the street in no time. In other places, it's much harder to thumb your way from A to B.
Keep reading Show less

Michio Kaku: Genetic and digital immortality are within reach

Technology may soon grant us immortality, in a sense. Here's how.

Videos
  • Through the Connectome Project we may soon be able to map the pathways of the entire human brain, including memories, and create computer programs that evoke the person the digitization is stemmed from.
  • We age because errors build up in our cells — mitochondria to be exact.
  • With CRISPR technology we may soon be able to edit out errors that build up as we age, and extend the human lifespan.
Keep reading Show less