Performance Zone is brought to you in partnership with:

Pat Shaughnessy is a Ruby developer working at a global management consulting firm during the day, but who also enjoys writing in his spare time. Pat lives in Boston, but is fluent in Spanish and spends a lot of time in Asturias, Spain with his wife and two kids. Pat also writes in-depth articles at patshaughnessy.net, some of which have been featured on the Ruby Weekly newsletter, the Ruby5 podcast and the Ruby Show. His twitter is @pat_shaughnessy Pat is a DZone MVB and is not an employee of DZone and has posted 14 posts at DZone. You can read more from them at their website. View Full User Profile

Ruby, Python, Java, C and Programmer Happiness

06.05.2013
| 7048 views |
  • submit to reddit


“Ruby is designed to make programmers happy.” - Yukihiro “Matz” Matsumoto

Not everyone might agree, but as a Rubyist I think Matz achieved his design goal. There’s something intangible about Ruby’s syntax that makes it fun, rewarding and easy to use – something that makes me happy. I thought it would be fun to compare Ruby with a few other languages by looking at how different open source developers implemented the same method or function in each language. How do the languages differ? Do they make you equally happy?

And what better example to look at than inside of Ruby itself! Today I’m going to look at how Ruby’s Hash#fetch method is implemented in Ruby (by Rubinius), Python (by Topaz), Java (by JRuby) and finally in C (by standard Ruby 2.0). Of course, there are many other programming languages out there, even other versions of Ruby, but looking at a small slice of Ruby internals gives us an interesting example and allows us to compare apples with apples.

Read the full article on RubySource.com.

Published at DZone with permission of Pat Shaughnessy, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)