26 Apr, 2009 in
Grails,
Ruby by
khelll
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 principles when you start designing in OOP world. However and while the first seems to be [...]
22 Apr, 2009 in
C++,
Java,
Ruby by
khelll
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 the following lines, we will make swap functionality in 3 languages, and demonstrate that neither [...]
21 Apr, 2009 in
Ruby by
khelll
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 of what Java does.
Let’s prove it via examples:
Update: this example was passing integers, and it [...]