3 ms·
As a C# developer I urge caution. When getters and setters become as trivial as public int Age { get; set; } Code becomes less OO and more procedural filled w
by ed_blackburn 13y ago
As a C# developer I urge caution. When getters and setters become as trivial as
public int Age { get; set; }
Code becomes less OO and more procedural filled with anaemic models / bags of state. Practices like Tell don't Ask, Information Hiding and Rich Models, slip away.
- yawz 13y agoVery very valid points, in my experience.
- thangalin 13y agoAccessor messages in Smalltalk, a pure Object-Oriented Programming environment, have been that trivial for a long time. See: http://www.jmcsweeney.co.uk/computing/m206/accessors.php http://www.jmcsweeney.co.uk/computing/m206/accessors.php The issue, as I see it, isn't the ease of creating accessors; the issue is that students do not seem to learn about the practices you've mentioned. I demonstrate "Tell, Don't Ask", "Information Hiding", and "Encapsulation" in the following presentation: http://whitemagicsoftware.com/encapsulation.pdf http://whitemagicsoftware.com/encapsulation.pdf
- mbell 13y ago> Code becomes less OO Frankly...good. If there is one thing Java desperately needs, it's less OO code.