You are here: Re: working with classes + php « PHP Programming Language « IT news, forums, messages
Re: working with classes + php

Posted by Jerry Stuckle on 05/16/07 15:31

Toby A Inkster wrote:
> 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.
>

That's true, Toby. but typically my ErrorLogger would have additional
functions, also - such as log levels, destination, etc.

But yes, improper design does lead to a proliferation of objects. That
doesn't mean the language is bad - rather its the implementation that
stinks.

Any time you have a class with only one method and/or no properties you
need to be looking at the implementation of the class. You may or may
not change the class (or get rid of it all together), but that should be
a red flag.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация