News for hackers. Stuff that matters.
Re:Writing Rails code makes me miss writing in Objective-C. ... by ollysb on Thursday July 15, 2010 @06:12AM (#1517390)
Ruby is actually more conservative on this issue, it isn't possible to make fields public. The attr_accessor macro is actually adding getters and setters. The implementions used for the getters and setters are equivalent to those that you would write in java. As mentioned elsewhere you can switch in custom implementations as required but, as in java, the majority of the time the default implementations are sufficient. The difference is that it in ruby you don't need to write the getters and setters until you need the customisation.

There are no comments on this comment yet.