Quantcast
Channel: Programming – PMA Media Group
Viewing all articles
Browse latest Browse all 10

Ruby, what I’ve learned

$
0
0

Being a beginner at Ruby, I’ve found the language to be extremely easy to learn and use. Being used to, and fond of, the object oriented design pattern has made it fun for me to learn Ruby. The fact that everything in Ruby can be seen as an object makes it more intuitive for one that thinks that way.

The only thing that makes it somewhat difficult to program correctly would be the conventions that need to be learned. There is a lot of help out there to ease this burden though, so it’s not too big of a deal. Another thing about the language is the amount of functions available to do different tasks. There might be five different functions that do essentially the same thing. Using RDoc Documentation (http://www.ruby-doc.org/core/) or ri helps tremendously in learning what these functions are and how to use them.

Coming from a background in Java, it’s easy to expect that Ruby would be stringent about how things are to be done. This is not the case, however. The language seems to balance strict coding enforcement with an almost scripting language like syntax. This gives a fair amount of freedom in the style of coding a user can implement, instead of being tied down to one way of doing things. At the same time, one does not get a jumbled mess of code to sift through every time a bug appears (assuming the coding conventions and good coding practices in general are implemented).

I used to work for a company (which shall remain nameless ;) that used PHP for all of their projects. The one thing I’ve noticed in Ruby, and thoroughly enjoyed, is that you can take an array and instead of doing this

foreach($array as $key => $val)
{
    $$key = $val
    #or do something else with the key/value pair
}

it would be something as simple as this in Ruby,

array.each do |arr|
    #blah blah we do something
end

Much easier to read and much cleaner than PHP’s implementation, imo.

Good luck to everyone learning Ruby. You’re definitely in for a treat

As far as PMA Media group goes, what a company, I tell you what. These guys are awesome. They treat their employees in a way that encourages good work ethic without using negative reinforcement. So far, I have been looking forward to going to work since I’ve started here. Thanks guys :)


Viewing all articles
Browse latest Browse all 10

Trending Articles