Linked by John Collins on Wed 21st Apr 2004 06:42 UTC
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.
I, quite franky, agree. OOP has niches where it is appropriate. But you are better off with procedural programming for the web. From what I can gather, PHP is often teamed up with MySQL, so there is no need to carry state inside objects when you have a database right next to you!
With a class you have reduced the reusability of all the functions ("methods") by locking them to a certain type of data structure. This may, in the short term, make them easier to use; but the lock-in nature dooms them to obscurity.
Combined with the fact that there are so many different OOP ABIs, and so many different opinions on whether feature X or feature Y are considered "OO", code re-usability is simply unfeasible (at least across language boundaries). Procedural code, with handles for state tracking when (and only when) it is required, is more often than not sufficient for almost anything. This is one reason for the persistence of the C language, despite all its failings!
I, quite franky, agree. OOP has niches where it is appropriate. But you are better off with procedural programming for the web. From what I can gather, PHP is often teamed up with MySQL, so there is no need to carry state inside objects when you have a database right next to you!
With a class you have reduced the reusability of all the functions ("methods") by locking them to a certain type of data structure. This may, in the short term, make them easier to use; but the lock-in nature dooms them to obscurity.
Combined with the fact that there are so many different OOP ABIs, and so many different opinions on whether feature X or feature Y are considered "OO", code re-usability is simply unfeasible (at least across language boundaries). Procedural code, with handles for state tracking when (and only when) it is required, is more often than not sufficient for almost anything. This is one reason for the persistence of the C language, despite all its failings!