This is just a quick little rant on my part. In my opinion a property should be used for simply getting/setting of a value. You should NOT have any logic inside your getter/setter (ok, I will add a 'caviot' to this rule and say that I am ok with doing string formatting on the getter). If you need to have logic in either your setting or your getter I think it is about time to use a method, not a propery.
WHY?
Because, once you start adding behavior to the property you are masking this behavior and a method will better convey your intent.
Again, this is just my thoughts/opinion, but I like to convey intent of methods/logic and wrapping logic inside a property does not convey intent.
Till next time,
Posted
07-09-2009 9:28 AM
by
Derik Whittaker