Re: OOP Clarification
Re: OOP Clarification
- Subject: Re: OOP Clarification
- From: Adam Eijdenberg <email@hidden>
- Date: Wed, 2 Jan 2002 12:07:13 +1100
A class method ... isn't a true
"method" as such that it applies to an object, it's more like a
"function" in procedural programming.
This make me think of something: I created a wrapper class (OBJ-C) for
the
CoreFoundation XML functions. I often found that the methods were
really not
tied to any normal OO usage (they were really not working on their "own"
data in the sense that they were using iVars, rather everything was
passed
in as an argument, even if the XML wrapper class was passing it in.
This has
a lot to do with the extreme generality of XML processing, as opposed to
processing a specific XML-derived language. In my system sublasses of
the
wrapper class added functionality for understanding how to deal with
documents in a particular XML-derived language. (You can look at the
header
file here: <URL =
http://cvs.sourceforge.net/cgi-
bin/viewcvs.cgi/steamweasel/SWDevelopment/Ste
amWeaselClient/Source/Shared/SOX.h?rev=HEAD&content-
type=text/vnd.viewcvs-ma
rkup>)
At any rate, the question becomes "Should I have made these extremely
generic functions CLASS methods, instead of INSTANCE methods?"
I'm no expert on OO design, but if a method does all of it's processing
based purely on arguments passed to it and requires no access to
instance variables or other instance methods, then I'd have thought the
method should be made a class method.
Kind regards,
Adam Eijdenberg
Switched on Software