NYCPHP Meetup

NYPHP.org

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

Ophir Prusak lists at prusak.com
Thu Feb 19 12:09:40 EST 2004


Just wanted to throw in my 0.02 as well,

Adam makes some excellent points.
The subject of this thread says Java/OO but we really need to separate 
the two.
1. Java programming (and jsp pages for the sake of comparing to PHP)
2. OO programming.
Obviously there is overlap here, but as Adam pointed out, Java's JVM has 
nothing to do with OO per se.

I've done both OO and non OO PHP and have done some Java as well.

1. Pick the right tool for the job.
I know this is a cliche, but there is no one solution fits all in 
programming.
This also depends a lot on what you're comfortable with.

2. Think about the goals, not the means.
You can get most of the main advantages of doing OO even in non OO code 
if you plan it correctly and use functions and naming conventions 
correctly. Doing it OO "pushes" you to design your code in a certain 
way, but you can accomplish the same goals without OO.
You should always strive to write code that is:
- reusable
- maintainable
- expandable
- debug-able
- separation of business logic and presentation
- etc

Ophir

Adam Fields wrote:

> 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.
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list