Time to Ruby dooby do! It can take a lot of time, and be quite boring, to learn a new programming language. A .Net developer will jump up and say why should I even learn it? I am a professional .Net developer and my day job doesn’t give me time (and scope) to learn a new programming language. But, it isn’t like that. You learn a lot with new programming languages especially when they are a refined version of other optimized ones. Ruby is that sort of language. I agree that the transition from being a noob developer (in a particular programming language) to a pro is arduous but you will appreciate the experience. As of now all that I can do is let you guys know that if you stick around with Ruby then you won’t be at a loss. Just be positive.
Note: Consider this article to be a very basic discussion on Ruby (the programming language) and Rails (an application framework). My basic goal is to introduce you to Ruby and give you that initial push which is required when learning a programming language.
What is Ruby?
Ruby, as I said before, is a refined combination of various programming approaches. Ruby is the perfect mixture of python’s easy to understand flow, Smalltalk’s elegance and Perl’s easy to learn syntax style. Ruby is a high level object-oriented programming language (as is the case with most of the programming languages these days) which came into existence in mid 1990s in Japan. With time Ruby has started to become more dominant in the U.S. and Europe too.
Ruby is famous for its dynamic type system and automatic memory management. By dynamic type I mean that most of the type checking in a Ruby program is done during run time which means you don’t have to worry about integer and string types. Ruby will do that for you. We will see more about this in a short example later.
The basic purpose of launching Ruby was to make it easy for humans to interact with machines and understand codes. Yukihiro Matsumoto, the father of Ruby, insists that Ruby was designed for programmer productivity and not for machine optimization.
Often people, especially computer engineers, focus on the machines. They think, “By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something.” They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves. – Yukihiro Matsumoto
What is Rails?
Rails is an extremely productive application framework written in Ruby by David Heinemeier Hansson. It is said that developing a web application on Rails is ten times faster when compared to that of a Java based web application framework. Rails is open source (of course!) Ruby based framework that can be used for easy (and fast) database integration.
Rails is famous for over-the-top ideas which resulted in shunning conventions and picking up dynamic programming structure. The basic application code and the updated database will always contain everything that Rails will require to execute a program from start to finish.
A Basic Ruby Program
See how interesting (and easy) things will get after this:
personal = “I don’t love my girlfriend”
I don’t love my girlfriend
Yep! That will actually be it to print an output in console. No initialization, semicolons and main methods.
Now, let us see a quick difference in programming between PHP and Ruby when we have to reverse a string:
Voila! Your string will be reversed in no time. See the difference in effort in both the programming languages. A Ruby based programming language will make it easy for you to write a program. It is more like writing in English than in coded language. It is the future of programming languages.
Advantages of sticking with Ruby (and Rails)
I know the world of Ruby is big and I haven’t scratched the surface of it but a blog post will prove to be overly small to dive into the world of Ruby. Henceforth, let us directly go through the advantages of Ruby:
- Elegant - As I have pointed out before, this happens to be the strength of Ruby. As a programming language Ruby is super elegant and almost like English. It is this similarity to English that makes it easy for noobs to take on Ruby without being afraid of it.
- Concise and Powerful - Our example above itself explains how concise a Ruby code can be. As short as it can get. Also, Ruby is as powerful as any other language as it is Object Oriented High Level Programming Language just like other trendy programming languages.
- Never Reinvents the Cycle - Rails (based on Ruby) is one programming interface that will never let you reinvent the cycle. It generates codes that can be reused over and over.
- Built in Testing - Rails is famous for its harness and fixtures which act as supporting codes that will make it easier for programmers to write their test cases. Also, Rails creates simple test stubs that can be extended by programmers.
- Dev, Test and Prod Environments - Rails smartly starts your project in three different environments namely Dev, Test and Prod. All three environments behave a little differently from each other and each complement the original software development life cycle.
Now, let us go through some of the websites (really famous ones) that are using the overall strengths of Ruby. You will see how designers are taking their websites places with the help of Ruby.
You are not done yet. You really aren’t. Hang around with Ruby and keep riding the journey on Rails. Someday you will call yourself a Ruby Pro and who knows, your article might just come in handy for me. Ruby has its disadvantages and the most obvious of them all is the that it is very new to this game. It is still evolving and has a lot to prove. Still, we know that it is going to go places. Now, it is in our hands. Either we can wait and let it grow or else jump in and evolve as an expert when their is high demand for Ruby professionals.
Salman Siddiqui is an alpha geek, design guru and seasoned WordPress critic. Writing, for him, started out of ego but it has become the most luring and enlightening career option of his life. He is walking that extra mile for his freelancing dream.