Interview for RubyC-2015 with Erik Michaels-Ober - RubyC 2016

Interview for RubyC-2015 with Erik Michaels-Ober

As the third Kiev Ruby-conference RubyC-2015 approaches (30-31 May 2015), organizers present an interview with Erik Michaels-Ober, Rubyist from Germany, who became a RubyHero in 2014. Erik is a popular mentor among different Ruby-communities: Ruby Summer of Code, Google Summer of Code and Rails Girls Summer of Code. At the RubyC-2015 he will present a topic “Crystal programming language”, details can be found on RubyC. Learn more about Erik from his answers below.

I started working on Ruby full-time in 2006, when my team decided to port our web application from PHP to Rails. Rails had just turned 1.0. I believe we were using Ruby version 1.8.4 with Mongrel as the web server. This was before Rack, Bundler, RubyGems.org, or GitHub. In retrospect, it’s hard to imagine working on Ruby without these tools that I now use on a daily basis.

Ruby made me realize the value of people over computers. Most programming languages are optimized to make executing code fast. Ruby is optimized to make reading and writing code fast. This changed the way I thought about code: from something that I write for the computer to something that I write for other people.

Ruby, the language, is great but my true love is the Ruby community. By joining this community, I’m now connected to nice people, all around the world. I love meeting new Rubyists at meetups and conferences. I’ve learned so much from others, who openly share their knowledge on their blogs, podcasts, screencasts, etc. I love Rails Girls, RailsBridge, and other community programs to make programming more diverse and inclusive. I also love the creative spirit of the Ruby community, inspiring projects like Artoo, Kids Ruby, Shoes, Gosu, Sonic Pi, etc.

I think Ruby would be better language if the syntax was more consistent. For example, Ruby has 2 different ways to make a hash and 7 different ways to make a function (def, proc, Proc.new, lambda, ->, {}, do…end) compared to JavaScript, which has a unified hash/object syntax and one way to define a function, regardless of whether it’s named or anonymous. Ruby also has too many aliases compared to Python’s philosophy that there should be only one obvious way to do something. Design is the art of making decisions. By having multiple names for the same method (e.g. map/collect, reduce/inject, find/detect, find_all/select, etc.), the Ruby designers avoided making a hard decision, hoisting that choice onto the user. Ruby also has many similar names for methods that are subtly different (e.g. ==, ===, eql?, equal?). I’ve been using Ruby daily for almost 10 years and I still can’t remember the difference between eql? and equal? without looking it up. I wish these methods had more descriptive names. Another example is the subtle differences between the alias keyword and alias_method, or private and protected. I think symbols could be replaced by frozen strings and removed from the user-facing part of the language. There are a few other language “features” I would remove from the Ruby if it was up to me, like the Perl-inspired global_variables. In my opinion, these do not mesh well with the rest of the language. There are also a lot of poorly maintained and outdated code in the Ruby standard library. I’d like to see the standard library refreshed to use newer language features, like keyword arguments. If these features are not useful enough for the core/standard libraries, they should be removed from the language, since they add unnecessary complexity. The ability for Ruby to catch some type errors at startup time would be nice. I’d also like an ahead-of-time compiler than generates native binaries. And better runtime performance. I’ve started using Crystal instead of Ruby, which I will be giving my talk about, since it has most of the features I like about the Ruby language without many of the features I dislike.

If talking about the most terrible architectural solution/code I have ever met, the first thing that comes to mind is the way Rails performs uniqueness validation. For those who don’t know, it just does just does a SELECT to see whether the field already exists before doing an INSERT. The first problem is that these two operations are not done in a transaction, so there’s a race condition that allows non-unique values to be inserted. However, transactions are not a good solution either, since they would cause too much table locking. The best solution is simply to create a UNIQUE INDEX on that field in the database, which guarantees correctness and optimal performance. The Rails approach to uniqueness validation is an impedance mismatch that gives the user a false sense of security.

The most spectacular Ruby news in 2014 was the creation of RubyBench.org by Alan Guo Xiang Tan. It is an incredibly valuable (and long-overdue) contribution to the Ruby community. This project will ensure that there are no performance regressions in Ruby so it only gets faster with each release. If RubyBench existed in the past, it could have prevented the performance regression in require that snuck into Ruby 1.9.

Life after Ruby is Crystal! See my talk for more information. ;)

Currently I am working on rewriting the Twitter CLI in Crystal and coaching a Rails Girls Summer of Code team.

My dev environment contains the Fish shell, which I recommend to anyone who spends a lot of time on the command line. Try it for a week and you’ll never go back!

My favorite Ruby blogs\communities\websites are, Ruby-Talk, Ruby Weekly and This week in Rails mailing lists.

Blogs, written by Aaron Patterson Aman Gupta, Sam Saffron, James Edward Gray II, Thomas Reynolds, Sandi Metz, Tom Stuart, Avdi Grimm, Jessica Kerr, Pat Shaughnessy.

I recommend the book, Ruby Under a Microscope by Pat Shaughnessy, because it is a fascinating look at how Ruby works under the hood. I would also recommend Practical Object-Oriented Design in Ruby by Sandi Metz to any Rubyist who hasn’t read it yet. For a better theoretical understanding of computer science, I recommend Understanding Computation by Tom Stuart. To absolute beginners, I recommend Learn to Program by Chris Pine. Finally, Why's (Poignant) Guide to Ruby has a special place in my heart.

My personal life hack is: add the following line to your crontab: */30 9-17 * * 1-5 say "Stand up and walk around"

May 07, 2015