Wednesday, May 26, 2010

Dynamic Nature of Ruby - Part 1

This is something a post after a long break, still something that ponders me is the level of penetration of open source in enterprises.

This post is fairly for the new bees who are chain smokers of Java Cigarettes and now want to change their brand and experience a new feel, and less harm to their body in terms of strain. Also at later stage wish to cover the enterprise ruby.

To begin with, definitely one should accept that famous of python was revealed only by the search giant google through its products like gmail,youtube, and google search etc.

In late 2000 dynamic languages sprouted and PHP were more dominant in web languages, even though Yahoo uses PHP extensively, but for enterprises PHP is still treated as a KM languages or developing a mere KM applications.

A popular framework called Rails which evolved with a new stratum such as Convention Over Configuration and DRY principles striked the chord in and around 2005 and this was made possible by a powerful Dynamic Language called 'Ruby'

Thoughworks is a company usually called king of Agile, which uses Ruby predominantly in their works as well as do enterprise proposals based on Ruby language.

Ruby Language Symbol

Ruby is a dynamic, Object oriented programming language that is influenced by the right mixture of Python, Small Talk, Perl, Lisp

Is Ruby a scripting language? No, more than a scripting language.

Its object Oriented by nature.

For instance, even if you declare a variable i =10, the variable 'i' is an object of type fixnum.

Suppose you want to perform a Modulus operation for the variable i = -10, in a typical static languages like java, it will make a light year waste for you in importing and declaring the essential classes and sub classes.

Yes in Java you need to import Math class to perform this and call abs fn from the Math Class like this


Even if you feel that you want to save time in importing classes and decided to go for IDE like eclipse, it will take hell lot of time to load in windows and hang around, where installing these IDE's are always less preferenced in linux.

Whereas in Ruby, its pretty simple that even simple guesses from our mindset will work to find a clue,

Here is the solution in Ruby,
irb>>i.abs #prints 10, mod value of i

if you ask me how a variable can have a member function, in Ruby its not a variable, its a object of class type 'fixnum'

Each and everything as an object makes ruby to create wonders.

Even more ruby has interesting features ....TBC part 2

1 comment:

Unknown said...

nicely written post on ruby (for chain smokers of Java cigarettes ;)