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.
Every star we can see, including our sun, was born in one of these violent clouds.
This article was originally published on our sister site, Freethink.
An international team of astronomers has conducted the biggest survey of stellar nurseries to date, charting more than 100,000 star-birthing regions across our corner of the universe.
Stellar nurseries: Outer space is filled with clouds of dust and gas called nebulae. In some of these nebulae, gravity will pull the dust and gas into clumps that eventually get so big, they collapse on themselves — and a star is born.
These star-birthing nebulae are known as stellar nurseries.
The challenge: Stars are a key part of the universe — they lead to the formation of planets and produce the elements needed to create life as we know it. A better understanding of stars, then, means a better understanding of the universe — but there's still a lot we don't know about star formation.
This is partly because it's hard to see what's going on in stellar nurseries — the clouds of dust obscure optical telescopes' view — and also because there are just so many of them that it's hard to know what the average nursery is like.
The survey: The astronomers conducted their survey of stellar nurseries using the massive ALMA telescope array in Chile. Because ALMA is a radio telescope, it captures the radio waves emanating from celestial objects, rather than the light.
"The new thing ... is that we can use ALMA to take pictures of many galaxies, and these pictures are as sharp and detailed as those taken by optical telescopes," Jiayi Sun, an Ohio State University (OSU) researcher, said in a press release.
"This just hasn't been possible before."
Over the course of the five-year survey, the group was able to chart more than 100,000 stellar nurseries across more than 90 nearby galaxies, expanding the amount of available data on the celestial objects tenfold, according to OSU researcher Adam Leroy.
New insights: The survey is already yielding new insights into stellar nurseries, including the fact that they appear to be more diverse than previously thought.
"For a long time, conventional wisdom among astronomers was that all stellar nurseries looked more or less the same," Sun said. "But with this survey we can see that this is really not the case."
"While there are some similarities, the nature and appearance of these nurseries change within and among galaxies," he continued, "just like cities or trees may vary in important ways as you go from place to place across the world."
Astronomers have also learned from the survey that stellar nurseries aren't particularly efficient at producing stars and tend to live for only 10 to 30 million years, which isn't very long on a universal scale.
Looking ahead: Data from the survey is now publicly available, so expect to see other researchers using it to make their own observations about stellar nurseries in the future.
"We have an incredible dataset here that will continue to be useful," Leroy said. "This is really a new view of galaxies and we expect to be learning from it for years to come."
Tiny specks of space debris can move faster than bullets and cause way more damage. Cleaning it up is imperative.
- NASA estimates that more than 500,000 pieces of space trash larger than a marble are currently in orbit. Estimates exceed 128 million pieces when factoring in smaller pieces from collisions. At 17,500 MPH, even a paint chip can cause serious damage.
- To prevent this untrackable space debris from taking out satellites and putting astronauts in danger, scientists have been working on ways to retrieve large objects before they collide and create more problems.
- The team at Clearspace, in collaboration with the European Space Agency, is on a mission to capture one such object using an autonomous spacecraft with claw-like arms. It's an expensive and very tricky mission, but one that could have a major impact on the future of space exploration.
This is the first episode of Just Might Work, an original series by Freethink, focused on surprising solutions to our biggest problems.
Catch more Just Might Work episodes on their channel: https://www.freethink.com/shows/just-might-work
The finding is remarkably similar to the Dunning-Kruger effect, which describes how incompetent people tend to overestimate their own competency.
- Recent studies asked participants to rate the attractiveness of themselves and other participants, who were strangers.
- The studies kept yielding the same finding: unattractive people overestimate their attractiveness, while attractive people underrate their looks.
- Why this happens is unclear, but it doesn't seem to be due to a general inability to judge attractiveness.
There's no shortage of disparities between attractive and unattractive people. Studies show that the best-looking among us tend to have an easier time making money, receiving help, avoiding punishment, and being perceived as competent. (Sure, research also suggests beautiful people have shorter relationships, but they also have more sexual partners, and more options for romantic relationships. So call it a wash.)
Now, new research reveals another disparity: Unattractive people seem less able to accurately judge their own attractiveness, and they tend to overestimate their looks. In contrast, beautiful people tend to rate themselves more accurately. If anything, they underestimate their attractiveness.
The research, published in the Scandinavian Journal of Psychology, involved six studies that asked participants to rate the attractiveness of themselves and other participants, who were strangers. The studies also asked participants to predict how others might rate them.
In the first study, lead author Tobias Greitemeyer found that the participants who were most likely to overestimate their attractiveness were among the least attractive people in the study, based on average ratings.
Ratings of subjective attractiveness as a function of the participant's objective attractiveness (Study 1)
"Overall, unattractive participants judged themselves to be of about average attractiveness and they showed very little awareness that strangers do not share this view. In contrast, attractive participants had more insights into how attractive they actually are. [...] It thus appears that unattractive people maintain illusory self‐perceptions of their attractiveness, whereas attractive people's self‐views are more grounded in reality."
Why do unattractive people overestimate their attractiveness? Could it be because they want to maintain a positive self-image, so they delude themselves? After all, previous research has shown that people tend to discredit or "forget" negative social feedback, which seems to help protect a sense of self-worth.
To find out, Greitemeyer conducted a study that aimed to put participants in a positive, non-defensive mindset before rating attractiveness. He did that by asking participants questions that affirmed parts of their personality that had nothing to do with physical appearance, such as: "Have you ever been generous and selfless to another person?" Yet, this didn't change how participants rated themselves, suggesting that unattractive people aren't overestimating their looks out of defensiveness.
The studies kept yielding the same finding: unattractive people overestimate their attractiveness. Does that bias sound familiar? If so, you might be thinking of the Dunning-Kruger effect, which describes how incompetent people tend to overestimate their own competency. Why? Because they lack the metacognitive skills needed to discern their own shortcomings.
Greitemeyer found that unattractive people were worse at differentiating between attractive and unattractive people. But the finding that unattractive people may have different beauty ideals (or, more plainly, weaker ability to judge attractiveness) did "not have an impact on how they perceive themselves."
In short, it remains a mystery exactly why unattractive people overestimate their looks. Greitemeyer concluded that, while most people are decent at judging the attractiveness of others, "it appears that those who are unattractive do not know that they are unattractive."
Unattractive people aren't completely unaware
The results of one study suggested that unattractive people aren't completely in the dark about their looks. In the study, unattractive people were shown a set of photos of highly attractive and unattractive people, and they were asked to select photos of people with comparable attractiveness. Most unattractive people chose to compare themselves with similarly unattractive people.
"The finding that unattractive participants selected unattractive stimulus persons with whom they would compare their attractiveness to suggests that they may have an inkling that they are less attractive than they want it to be," Greitemeyer wrote.
Metal-like materials have been discovered in a very strange place.
- Bristle worms are odd-looking, spiky, segmented worms with super-strong jaws.
- Researchers have discovered that the jaws contain metal.
- It appears that biological processes could one day be used to manufacture metals.
The bristle worm, also known as polychaetes, has been around for an estimated 500 million years. Scientists believe that the super-resilient species has survived five mass extinctions, and there are some 10,000 species of them.
Be glad if you haven't encountered a bristle worm. Getting stung by one is an extremely itchy affair, as people who own saltwater aquariums can tell you after they've accidentally touched a bristle worm that hitchhiked into a tank aboard a live rock.
Bristle worms are typically one to six inches long when found in a tank, but capable of growing up to 24 inches long. All polychaetes have a segmented body, with each segment possessing a pair of legs, or parapodia, with tiny bristles. ("Polychaeate" is Greek for "much hair.") The parapodia and its bristles can shoot outward to snag prey, which is then transferred to a bristle worm's eversible mouth.
The jaws of one bristle worm — Platynereis dumerilii — are super-tough, virtually unbreakable. It turns out, according to a new study from researchers at the Technical University of Vienna, this strength is due to metal atoms.
Metals, not minerals
Fireworm, a type of bristle wormCredit: prilfish / Flickr
This is pretty unusual. The study's senior author Christian Hellmich explains: "The materials that vertebrates are made of are well researched. Bones, for example, are very hierarchically structured: There are organic and mineral parts, tiny structures are combined to form larger structures, which in turn form even larger structures."
The bristle worm jaw, by contrast, replaces the minerals from which other creatures' bones are built with atoms of magnesium and zinc arranged in a super-strong structure. It's this structure that is key. "On its own," he says, "the fact that there are metal atoms in the bristle worm jaw does not explain its excellent material properties."
Just deformable enough
Credit: by-studio / Adobe Stock
What makes conventional metal so strong is not just its atoms but the interactions between the atoms and the ways in which they slide against each other. The sliding allows for a small amount of elastoplastic deformation when pressure is applied, endowing metals with just enough malleability not to break, crack, or shatter.
Co-author Florian Raible of Max Perutz Labs surmises, "The construction principle that has made bristle worm jaws so successful apparently originated about 500 million years ago."
Raible explains, "The metal ions are incorporated directly into the protein chains and then ensure that different protein chains are held together." This leads to the creation of three-dimensional shapes the bristle worm can pack together into a structure that's just malleable enough to withstand a significant amount of force.
"It is precisely this combination," says the study's lead author Luis Zelaya-Lainez, "of high strength and deformability that is normally characteristic of metals.
So the bristle worm jaw is both metal-like and yet not. As Zelaya-Lainez puts it, "Here we are dealing with a completely different material, but interestingly, the metal atoms still provide strength and deformability there, just like in a piece of metal."
Observing the creation of a metal-like material from biological processes is a bit of a surprise and may suggest new approaches to materials development. "Biology could serve as inspiration here," says Hellmich, "for completely new kinds of materials. Perhaps it is even possible to produce high-performance materials in a biological way — much more efficiently and environmentally friendly than we manage today."