First impressions about Ruby

First impressions about Ruby

Since a few months I started to have interest on the Ruby programming language. As I am an agile enthusiast, I also wanted to give a try to a language that focus itself on coding and not on superfluous keywords or programming conventions, to a web framework (RoR, more of this on later posts) that doesn’t need lots of complex XML configuration files and dependencies and that simply lets me start being productive from start. Here I am only going to put some easy examples why Ruby is more direct that Java, the language I use everyday in office.

The simplest example program!

Yes, you got it, as always the Hello World! example, one simple program that only prints “Hello World!” on your screen and that it’s used in all code books when they teach you a new language.

Java

Ruby

What a difference, right? Why so many of lines when you can do it in only one? Why such an expression to print something on your screen? System.out.println… why not puts from “Put String”? Lets see how to read a String from the command line.

Java

Ruby

Once again, super easy. Reading or writing a file isn’t much complicated, even defining your classes with your getters&setters (or readers and writers as they are usually named) is short, agile, elegant and productive, made for the programmer so he/she can enjoy designing and writing code, going for the goal and the functionality, without spending resources on superfluous “decorators”. More to come…
Tags:
,
No Comments

Sorry, the comment form is closed at this time.