Re: accessor generation???
Re: accessor generation???
- Subject: Re: accessor generation???
- From: Brock Brandenberg <email@hidden>
- Date: Fri, 05 Jul 2002 14:38:14 -0500
>
I feel it somewhat strange: does that mean my programming style
>
differs so much from the one of majority of others?
I tend to agree. I think many developers tend to design objects to
encapsulate data rather than to encapsulate behaviors. As a result, they
have classes that are basically fancy structs rather than meaningful
objects. Don't get me wrong, I think using accessors to encapsulate
suprclass data is a very good thing. It's just that my accessor functions
tend to be much more complex than the default methods suggest because they
require additional actions to be taken when data changes. It is the job of
an object to encapsulate its behavior, and just changing a data member is
typically not sufficient. I compare it with the architecture of the text
handling system in Cocoa. Changing an NSTextStorage string is not a simple
string copy as these simple accessor methods might suggest. Numerous
notifications and actions occur as the result of such a simple string copy.
This is the encapsulation of behavior at work, not just the encapsulation of
data.
That said, I think an accessor generator is a handy thing, but in the way
that the shortcuts in PB for creating a new NSView subclass is a handy
thing. It gives me a quick shell with the suggestion to "// add code here"
to customize the class behavior. I feel the current accessor generators
influence bad design by making it too easy to turn a class into just a big
fancy struct.
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.