NYCPHP Meetup

NYPHP.org

[nycphp-talk] How many of you guys are "down" with Java/OO - likeprogramming concepts?

Adam Fields adam at digitalpulp.com
Wed Feb 18 22:07:14 EST 2004


James Wetterau wrote:

> "Chris Hubbard" says:
> ..
> 
>>procedural -> OO is pointless unless:
>>1.  it makes it easier to maintain the code
>>2.  it makes it easier to improve the code
>>3.  it makes it easier to debug the code
>>4.  it makes it easier to pick up girls
>>5.  it makes it easier to show off at the users group (see #5)
> 
> 
> You missed the big supposed selling point for OO:
> 
> 6. It makes it easier to reuse the code (whether in the same way as
> originally intended or in a slightly different way than originally
> intended, without having to substantially rewrite).
> 
> That's one the main goals, anyway.

OO is an abstraction layer, and it's a different way of looking at your 
code and what the component pieces are. When you use objects, you have 
some flexibility to work with and adapt your component pieces in ways 
that are less easy to do with a different abstraction model. The actual 
capabilities depend on the implementation of the object model. It's 
entirely possible to overlay a simple object model on a procedural 
language, and get some of the syntactic and organizational advantages, 
without some of the more complex patterns (which is what PHP's object 
model is).

However, some of Java's huge advantages aren't in the object model at 
all, they're in the virtual machine model. PHP scripts execute 
essentially in a vacuum. In contrast, all Java code runs in the context 
of the virtual machine and can communicate in various ways together (and 
if you extend it enough, across different VMs) - this way of thinking is 
really really different from PHP scripting. It's better for some things, 
overkill for others.




More information about the talk mailing list