Re: Q: how do you generate get/set methods?
Re: Q: how do you generate get/set methods?
- Subject: Re: Q: how do you generate get/set methods?
- From: Patrick Machielse <email@hidden>
- Date: Wed, 21 Jan 2004 14:56:27 +0100
op 21-01-2004 03:19 schreef Karl Goiser
>
Without wanting to act like a wet blanket, I would like to point out
>
that one of the foundation principles of object oriented programming is
>
'encapsulation'. This is the idea that one object should not know
>
about the internal state of another. This is a well established design
>
principle and is fundamentally important in writing large, well behaved
>
applications.
True. However two 'features' of Objective-C make accessors more prominent in
this language.
* absence of namespaces / packages. So you need to provide accessors short
of making all your ivars public.
* Objective-C accessors to pointers are mostly not only accessors, they also
serve as memory managers. Sadly this expands your public API, since there is
no such thing as a private method in Objective-C.
>
Personally, I regard the automation of accessor method writing as
>
counter this principle. Large numbers of accessor methods, to me, are
>
an indication of poor design and a potential source of problems and
>
unnecessary complexity.
Let's minimize the number of accessors we write in 2004, but let's write
them automated :-)
patrick
_______________________________________________
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.