[UPHPU] Is OOP really bad in PHP?

cole at colejoplin.com cole at colejoplin.com
Wed May 14 09:28:56 MDT 2008


I get the sense that this was a reaction to over-engineering. It's no  
secret, I'm a big OOP-kinda guy. But I have worked with some  
programmers who were so obsessed with creating complex object  
structures and patterns that they lost sight of what they were doing.  
Thinking about a CMS with a two page site is an outstanding example.

OOP is supposed to make things more extensible and easier to maintain.  
If a project becomes too complicated to understand, and takes twice as  
long to make changes to it, then it has failed to deliver what OOP is  
intended to provide.

You don't need an aircraft carrier to go fishing. There is a balance  
between what is right and what what is appropriate. The goals and  
lifespan of the project are good ways to determine it.

-- Cole



Quoting Wade Preston Shearer <lists at wadeshearer.com>:

> On 13 May 2008, at 23:49, Nathan Lane wrote:
>
>> I see your point. I think what I was getting at is that PHP is    
>> becoming more
>> OOP-based, so what's the harm in using objects (classes) for  everything? Is
>> there something wrong with that, really? I think there is nothing    
>> wrong with
>> that, yet #26 states:
>>
>> "[Your a really lousy PHP programmer if you] misuse OOP /(I take  this as
>> misuse OOP ==) everything you write , no matter how small is OOP.
>>
>> Am I incorrect in assuming such?  For example, would it be wrong to  wrap an
>> HTML element into an object and use an xml writer to add elements to  it,
>> then serialize it (or toString it) out to the browser at render time?
>
> Well, for starters, this is just some blogger's opinion. Second, I    
> think it entirely depends on what you are doing? perhaps it's true   
> and  perhaps it's not. Use the right too for the right project. As   
> an  example, I have a friend who is trying to "get into web   
> development"  and was asking me questions yesterday about how to set  
>  up a CMS and  which one to go with. I found out the site he is  
> going  to build will  be two pages. Using a CMS is a waste. I agree  
> with  the blogger, if  literally _everything_ you write is wrapped  
> in an  object and you do it  without considering if it is the  
> correct  approach to each situation,  then yes, you're a lousy  
> programmer.  But that would apply to any  language.





More information about the UPHPU mailing list