How Ruby Got Nice

The History of Computing - Een podcast door Charles Edge

Categorieën:

As with many a programming language, ruby was originally designed as a teaching language - to teach programming to students at universities. From there, it is now used to create various programs, including games, interfaces for websites, scripts to run on desktop computers, backend REST endpoints, and business software. Although ruby is used for web development more than anything else. It has an elegant syntax that makes it easy to read the code; this is one of the reasons why Ruby is so popular, especially with beginners (after all it was designed to teach programming). Yukihiro Matsumoto, or Mats for short, originally developed the ruby's programming language in the 1990s. Ruby was initially designed as an interpreted scripting language. That first interpreter, MRI, or Mats’s Ruby Interpreter, spread quickly. In part because he’s nice. In fact, he’s so nice that the motto MINASWAN, or “Matz is nice and so we are nice.” Juxtapose this against some of the angrier programmers who develop their own languages. And remember, it was a teach language. And so he named ruby  after a character he encountered in a children's book. Or because it was a birthstone. Or both. He graduated from the University of Tsukuba and worked on compilers before writing a mail agent in Emacs Lisp. Having worked with Lisp and Perl and Python, he was looking for a language that was truly object-oriented from the ground up. He came up with the idea in 1993 of another Lisp at the core, but something that used objects like Smalltalk. That would allow developers to write less cyclomatically complex code. And yet he wanted to provide higher-order functions for routine tasks like Perl and Python did. Just with native objects rather than those bolted on the side. And he wanted to do so in as consistent a manner as possible. Believe it or not that meant dynamic typing. And garbage collection for free. And literal notation for some things like arrays and regular expressions while allowing for dynamic reflection for meta programming and allowing for everything to be an expression. The syntax is similar to a python or a perl and yet whitespace in things like indentation doesn’t play a part. It’s concise and the deep thinking that goes into making something concise can be incredible. And yet freeing.  The first version of Ruby was released in 1995 and allowed programs to be concise, so written with fewer lines of code than would have been possible with other languages at the time. And yet elegant. In 1996, David Flanagan and Jim Weirich grabbed the MRI interpreter and started using ruby for real projects. And so ruby expanded outside of Japan.  As the popularity grew, Matz founded his own company called Object Technology Inc, This allowed him to continue developing Ruby while making money. After all, programmers gotta’ eat too. In 2006 Matsumoto committed the first version of what would eventually become Rails on Version Control Systems (VCS), a precursor git.  Ruby is written in C, which means it has access to most underlying operating systems given the right API access. It has a vast dictionary with nearly 1 million entries. It can often be found in many event-driven frameworks, with the most popular being Ruby on Rails, a server-side web application framework developed by David Heinemeier Hansson of Basecamp in 2004. Other frameworks include Sinatra (which came in 2007), Roda, Camping (which comes in at a whopping 4k in size), and Padrino. And Ramaze and Merb and Goliath. Each has their own merits.  These libraries help developers code faster, easier, and more efficiently than if they had to write all the server-side code from scratch. Another aspect of Ruby that made it popular is a simple package manager. RubyGems came about in 2003. Here, we lay out a simple structure that includes a README, a gem spec with info about the gem, a lib directory (the code for the gem), a test directory, and a makefile for Ruby they call a Rake. This way the developer of the gem does everything needed to be able to call them in their code. And so there are now well over 100,000 gems out there. Not all work with all the interpreters. Ruby went from 1.0 in 1996 to 1.2 in 1998 to 1.4 in 1999 and 1.6 in 2000. Then to 1.8 in 2003 and by then it was gettin popular and ready to get standardized. This always slows down changes. So it went to become an ISO standard in 2012 - the hallmark if you will that a language is too big to fail. Ruby 2 came along the next year with nearly full backwards compatibility. And then 3 came in 2020 in order to bring just-in-time compilation, which can make the runtime faster than just interpreting. And unlike the XRuby variant, no need to do java-style compilation. Still, not all ruby tooling needs to be compiled. Ruby scripts can be loaded in tools like Amazon’s Lambda service or Google Cloud Functions. From there, it can talk to tools like MySQL and MongoDB. And it’s fun. I mean, Matz uses the word fun. And ruby can present a challenge that to experienced programmers might be seen as fun. Because anything you can do with other languages, you can do with ruby. Might not get as much for free as with a spring security for Java, but it’s still an excellent language and sometimes I can’t help but wonder if we shouldn’t get so much for free with certain lanuages. Matz is now the chief architect of Heroku. He has since written a slimmed down version of ruby called mruby and another language called streem. He also wrote a few books on ruby. Because you know, he’s nice.

Visit the podcast's native language site