Saturday, March 26, 2011

Initial Stab on Ruby Programming Language

For those curious on Ruby, it is yet another opensource programming language created by a Yukuhiro Matsumoto and was made available publicly on 1995. Just about the same time when PHP made its first appearance. It claims itself to be dynamic, elegant, natural to read and easy to write.

I first came across this 6 years ago, through the Ruby-on-Rails (RoR) framework, but never was quite interested really. Had some reading and scanning over here and there but this is the first time I really used it. Thanks to the interactive tutorial that can be found here - http://tryruby.org/. I was able to have some long lasting impression over it. Here are the most notable ones, of course limited to the aspect of usability as a programming language.

1) Very much like javascript, data types and variables are all somewhat treated as "objects".
2) These "objects" will automatically have methods to them depending on their data types (i.e if the object is string, all methods applicable for a string becomes available).
3) Because of #1 and #2, manipulating data objects becomes easier and consistent compared to PHP where you would need to explicitly call individual functions.
4) The do and end block is unimpressive though because it isn't really better than the bracket at easily identifying start to end on nested code blocks.
5) The use of "def" to define a method is kinda weird for me. I still prefer either function, sub or none at all which are more definitive in my opinion.
6) To run a statement on the same line, you use a pipe. Nostalgic to how the *nix system shell works.
7) Date manipulation is very easy. Also relates to #1 and #2.

As concluding statement, Ruby is indeed a potentially powerful programming language when used properly and most likely be able to develop applications faster than PHP. I am still not in the position to say though that it is better than PHP because I can pretty much do anything in PHP that it can supposedly do naturally. It really boils down to how well you know the programming language and how well written your code is. Anyway, I still have to review aspects such as portability, flexibility, performance, scalability and reliability.
  • Related Links Widget for Blogspot

No comments: