Ruby on Rails Sunday, July 31, 2011

> 3. I didn't understand your justification of getter and setter.Since
> instance variables work fine why would you need to define a setter and
> getter.

>>Because it's good programming practice.

Ok, I took my own advice an read some articles about 'why getter and
setters' and there are enough people that think it's actually bad
programming practice. But as far as I can tell the reasons I stated are
why the book is is using getters and setters--however, the book does not
always use the getters and setters, so it is being consistent.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment