[nycphp-talk] How many of you guys are "down" with Java/OO - likeprogramming concepts?
Phil Powell
phillip.powell at adnet-sys.com
Thu Feb 19 15:20:33 EST 2004
This might be "blasphemy" in the Java camp, but for me PHP is helping me
understand how Java-structured OO works out and helps me in my simple
Java coding as well, though complex Java-related stuff is beyond me.
At this point so is some PHP-related stuff too, like how on earth do you
do this and not break:
||<?
$deptName = $_POST["name"];
$section = $_POST["section"];
$action = $_POST["action"];
$html .= "<a href=index.php?section=$section&action=$action&id=1 onClick=\"return isOKDelete('Are you sure you wish to delete Department
"$deptName"?')\">DELETE</a>";
echo "$html"; // should give you the wrong link will break in PHP but if
you do '$deptName' will break in Javascript -
damned-if-you-do-damned-if-you-don't client-server riddle||
Ophir Prusak wrote:
>
> 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
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
--
Phil Powell
Web Developer
ADNET Systems, Inc.
11260 Roger Bacon Drive, Suite 403
Reston, VA 20190-5203
Phone: (703) 709-7218 x107 Cell: (571) 437-4430 FAX: (703) 709-7219
EMail: Phillip.Powell at adnet-sys.com AOL IM: SOA Dude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20040219/729271e2/attachment.html>
More information about the talk
mailing list