Monthly Archives: April 2009

Delegation in Ruby

This is my first article in http://railsmagazine.com, it was published in issue 1, so basically I’m just republishing it here again. “Separate changeable parts from others that remain the same” and “composition is preferred to inheritance” are 2 common design … Continue reading

Posted in Grails, Ruby | Tagged , , | 4 Comments

C++ passes by reference, Java and Ruby don’t

I got a lot of comments for the previous article, that was explaining how Ruby passes by value, just like Java does. I thought that showing a simple example implemented in C++, Java and Ruby will clarify the idea. In … Continue reading

Posted in C++, Java, Ruby | Tagged , | 141 Comments

Ruby, pass by value or by reference?

It’s a basic question that I myself had a problem with when i started using Ruby: Does Ruby pass by value or by reference? Well, if you want a direct answer, then: Ruby passes by value. It’s a similar behavior … Continue reading

Posted in Ruby | Tagged , | 38 Comments