Is there a notion of the class as a namespace?
My understanding is that the namespaces are intended to help organize
the classes in large projects (and are not perfect).
Is it considered good style to use a class simply to box related functions?
For instance, a class called "files", contains functions I need for
dealing with files - and the instantiated object is _simply_ used to
access these functions - the instantiated object is not a file in
itself. Thus what I do is not $INSTANTIATED_OBJECT->save(), but
$INSTANTIATED_OBJECT->save($file) (though I could do the first if I
first, say, do $INSTANTIATED_OBJECT->file = $file.
Accessing the functions using the scope resolution operator (::) avoids
the need to instantiate an object, but does not allow the use of $this,
and $this can be quite practical in order to group common logic into
shared methods within the class and thus make the other methods smaller
in terms of code (of course, one could use file::save, file::delete
instead of $this->save and $this->delete, but it makes renaming objects
more difficult).
I would be interested to hear opinions.
Iv
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php