What is Ruby?
Ruby is “a dynamic, reflective, object-oriented, general-purpose programming language” (to quote Wikipedia). It was designed and developed in the mid-1990s by Yukihiro (“Matz”) Matsumoto in Japan (pictured).
It’s a language much admired for its “elegance and visual smoothness” to quote David Black, author of the “Well grounded Rubyist” (an excellent book by the way that concisely explains key Ruby syntax and concepts in easy to understand terms).
You can also get a lot done with very little code, plus the syntax is easily read and memorable, e.g.
1.to_s means “convert the the integer 1 into a “string” (a character representation of the number 1 rather than the number 1 itself).
As a result, what started out as Matz’s pet project quickly became a popular language. Since then Ruby has been used to do a huge variety of things, e.g. administrative scripting to device embedding, from web development to PDF document processing. Scout the internet and you can find many more uses.
Why do I care? Is Ruby worth learning?
Ruby is very flexible and accessible. It allows easy and quick prototyping for projects (especially via the Ruby on Rails web application framework, which I will be learning later in the course)). So in a practical sense, it’s great for beginners. Here are some more reasons:
1. Ruby is a stepping stone to Ruby on Rails
Ruby on Rails is a very popular web application framework used to quickly and efficiently prototype and build web apps. It’s elegant and designed, like Ruby, with best practices in mind. Given its simplicity, elegance and power it’s proven uber popular with start-ups and tech companies because it’s awesome for rapid prototyping.
Which brings me to my next point…
2. Ruby and Ruby on Rails is uber popular with start-ups
Including some of these “obscure” tech companies you probably haven’t heard of.
3. Ruby is one of the easiest languages to learn, so great for noobs like me
Let’s make a comparison. The below screenshots are two different attempts to make the computer write the words, “Hello, world!” to the user’s computer screen. Compare this:
Which makes more sense to a human? If you thought the first screenshot then you’re probably some sort of cybernetic organism with a neural net processor, a learning computer perhaps? So which one of the above is Ruby? It’s the second screenshot of course: the first is C++.
Ruby is a higher level programming language than C++, so is easier to learn and understand for beginners. What does that mean?
Well the higher level a programming language, the closer it is to human languages and further from machine languages.
For instance, binary is a machine language used to represent data at the lowest level of abstraction on computers. Binary uses simple but elegant combinations of
1s, to represent the millions of “on” and “off” switches in computer transistors. Different combinations of
1s allow the computer to store all sorts of data, whether it’s letters and numbers or more complicated things like graphics and audiovisual data.
As you can imagine, trying to read and write in binary to describe things is pretty tricky for a human, but easy for a computer. The more abstract a programming language, the less it resembles the computer’s mother tongue.
So how does a computer understand higher level languages? The same way humans do! Essentially the computer uses a program called a compiler or interpreter, which does the job of translator explaining to the computer what the higher level language is trying to tell it to do and vice versa.
4. Ruby has tonnes of resources
Ruby is blessed with a wealth of pre-written frameworks and libraries, managed via RubyGems. There are currently over 60,000 libraries to choose from. This makes building stuff quick and easy – often you can find a Ruby gem that someone else has already written that does the thing you want quickly and efficiently whilst remaining customisable. Only idiots reinvent the wheel – stand on the shoulders of giants rather than spend ages trying to build a ladder.
Then there’s also the hugely helpful Ruby documentation, which is a fantastic resource for checking syntax, all of which are worked through with numerous examples to provide context and usage.
5. Ruby has a massive and active community
- the 8th largest StackOverflow Community
- the 5th largest Meetup Community
- 3rd most tagged language on GitHub
… all of which emphasises how good it is for beginners. You can pretty much rest assured that 99% of your noob, and even not so noob, questions will have been posted and answered long before you even knew what code was! Likewise the ability to attend Meet-ups with likeminded individuals and share and collaborate on code via GitHub makes life a lot easier!
6. Ruby is FUN!
Programmers love Ruby because it was designed with an emphasis on the programmer’s experience. Matz wanted to make it fun so that it was productive for experienced programmers and at the same time easily accessible to beginners. If something is fun you’re more likely to stick at it, which makes life easier for noobs like me. Indeed, I’ve found learning Ruby super addictive engrossing and fun.