in reply to Class attribute get/set approach flaws?
Using a single accessor for setting/getting all your attributes is a bad idea because you can't easily do any validation or implement behavior specific to a particular attribute.
Say, for example, that you have an Employee class and you want to double check that an employee's salary isn't being set to a negative value or you want to update his benefits eligibility when his full_time attribute is set to true.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Class attribute get/set approach flaws?
by Ovid (Cardinal) on Nov 28, 2005 at 23:26 UTC | |
by sauoq (Abbot) on Nov 28, 2005 at 23:48 UTC | |
by diotalevi (Canon) on Nov 28, 2005 at 23:54 UTC | |
by sauoq (Abbot) on Nov 29, 2005 at 01:34 UTC | |
by diotalevi (Canon) on Nov 29, 2005 at 01:37 UTC | |
|