Linked by John Collins on Wed 21st Apr 2004 06:42 UTC
General Development The purpose of this article is to give a novice programmer the basic idea of what OOP is, as implemented using PHP. Readers should have a basic knowledge of programming ie what variables are, variable types, basic methods of writing comments, and how to enter code into a text editor.
Permalink for comment
To read all comments associated with this story, please click here.
Re: built for purpose
by Luke McCarthy on Wed 21st Apr 2004 21:12 UTC

I guess you have a point there. There probably is no point in making public functions that muck about with internal state. In that case a class is a convenient way to hide it away. And I also guess that genericness of a function is not always desirable (because it may be a lot less efficient).

This really depends on the kind of code you are writing. It is probably inconsiderate for a library designer to dictate which structures you should use. Calculating a person's age from a date of birth and the time() doesn't need a Person object! (bad example, can't think of a good one at the moment)