[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: dia2code objc
From: |
Mondragon, Ian |
Subject: |
RE: dia2code objc |
Date: |
Tue, 26 Mar 2002 12:01:53 -0600 |
private methods are not INTENDED to be called by a user. that's why they're
called "private". i think this situation is being taken too far; the best
way to design a program, whether OO or not, is to keep each component as
simple as it can be, and the whole as organized as possible. this is
turning into a debate on how "clever" you can be with objective-c, simply
because it's not C++, which is (as i see it) horribly wrong. the beauty of
objective-c is it's SIMPLICITY. objective-c's simplicity is exactly what
let's a C programmer learn the language in an hour or two. objective-c's
simplicity is what makes it so powerfull. i firmly believe this because i
program in the language for my living. unless you're ABSOLUTELY POSITIVE
that you will NEVER EVER EVER EVER have to access an ivar outside of a
class, keep it @protected (which is the default). unless you're ABSOLUTELY
POSITIVE that you will NEVER EVER EVER EVER have to call a method, or
reimplement it in a subclass, keep it public. if you choose not to
implement it as public, but there's a chance a subclass might need to do
some additional processing, add a hook before returning to allow for this
behavior. implement your classes as just that - classes - not some
hodgepodge of multiple categories per class that WILL lead to either
clutter, confusion, or both in the long run.
no offense to whoever suggests any of these, but i know firsthand what your
code will look like after a couple years of modifications, becuase my job is
maintaining/debugging/cleaning up old (and ofter "clever") objc code - so
it's a pet peeve of mine to see the language's features being abused for the
sake of doing something to make up for the lack of a C++ feature...
- ian
> -----Original Message-----
> From: Björn Gohla [SMTP:b.gohla@gmx.de]
> Sent: Tuesday, March 26, 2002 11:36 AM
> To: discuss-gnustep@gnu.org
> Subject: Re: dia2code objc
>
> On Tuesday 26 March 2002 18:03, Frederic Stark wrote:
>
> [...]
>
> > * public methods are delcared in the main header
> > * protected methods are declared in a separate category (which can be
> > put in its own file)
> > * private methods are declared in a category located at the start of the
> > .m and implemented at the end.
>
> i was thinking that too, but that would completely prohibit users from
> calling the functions in it, perhaps forcing the user to handcraft some
> ugly
> workaround should it turn out to be necessary to use the class in ways not
>
> forseen by the designer.
>
> > (To be frank, I have much more categories than that on a class, like one
> > category per superclass from which methods are overriden, on category
> > per informal protocol implementation, one per protocol implementation,
> > one for primitive methods, etc, etc)
>
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://mail.gnu.org/mailman/listinfo/discuss-gnustep
RE: dia2code objc, Mondragon, Ian, 2002/03/26
RE: dia2code objc, Mondragon, Ian, 2002/03/26
RE: dia2code objc, Mondragon, Ian, 2002/03/26
RE: dia2code objc,
Mondragon, Ian <=