|
Posted by Toby A Inkster on 05/16/07 14:21
Mike P2 wrote:
> I think learning OOP in PHP causes bad habits. There are too many
> different ways to do it. If you learn from a language like Java, you
> will certainly get it down very well.
I'd agree with what others have posted that Java is not an ideal place to
start learning object-oriented programming, though for different reasons.
In object-oriented programming, everything's focused on "nouns". In real
life, verbs are just as important. In pure OO, a verb (method) can only
exist as an appendage to a noun (object). Thus instead of creating a
function like log_error(), OO programmers create an object ErrorLogger
with a method doIt() and somehow imagine that this is a better design.
This leads to a proliferation of FooProvider, FooFacilitator, FooFactory
and FooInitialiser objects in large OO programs.
There's a good article on such problems here...
http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
PHP, I think, as a much better balance than Java. It has good OO
facilities, but doesn't force you to use them when they're not the
best tool for the job.
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
Navigation:
[Reply to this message]
|