I've been lurking these forums for a while and finally decided to join up and be a real member of the community. I figured I'd introduce myself by asking everyone a simple question. When writing in an object oriented language, do you write a "getter" and "setter" method for every attribute of an object? What if you never intend to change the value of said attribute?
As an example: I'm working on my first game, a clone of pong. my class Ball has an attribute named size. Obviously the size of the ball in a game of pong never changes, but it felt strange to not write a setSize() method. Now I have code in my program that will never be used - and that feels a little strange too.
I know that there is no right or wrong answer to this question, I'm just interested in your individual opinions. Take it easy,
WilfrostMember Since 06 Oct 2012
Offline Last Active Nov 28 2012 09:50 PM
- Group Members
- Active Posts 8
- Profile Views 941
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown