Re: OOP and PHP4 (PHP4 vs. Java)
| From: | Manuel Lemos | Date: | Fri, 08 Sep 2000 23:02:12 +0000 |
| Subject: | Re: OOP and PHP4 (PHP4 vs. Java) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15963@lists.php.net to get a copy of this message | ||
Hello Heiko,
On 07-Sep-00 11:26:22, you wrote:
>has anybody ever developed an application with PHP4 using OOP exclusively?
>Without stand-alone functions and variables etc...?
>I really would like to hear some oppinions about OOP with PHP4. I've read
>the OOP the articles at phpbuilder.com, but I'm still not satisfied.
I have been developing a very large modular system completely based in OOP,
say many tens of classes developed so far. Don't ask me about what is the
project because I can't talk about it now.
The only thing I can tell you is that many of the general purpose classes
that were developed have been and will continue to be made available for
free in the PHP Classes site:
http://phpclasses.UpperDesign.com/
>I used to program with JAVA and I want to know if I could go on developing
>software in the same way I did with JAVA.
>The problem is that PHP4 isn't a real OO language. That's the point I worry
>about.
>PHP4 lacks many things you need for real OOP: private members, interfaces,
>methodes with the same name but different number of arguments, casting to
>classes ...
So, what!?
One thing that I find most frustrating in computer science that people learn
in today's colleges is that most of the time all it is focuses in theory a
not much in practice. In the real world software developers should focus
on the goals, rather on the means.
What I mean is that you should not start a project asking yourself if your
language of choice can do OOP as you learned in Java lessons. First you
should ask yourself what you are trying to accomplish and then you see how
that can be accomplished. Maybe neither PHP nor Java nor OOP are the right
means to achive your goals. But then maybe they are.
You are the one that has to go through your project analysis and figure
that. Sorry for the preaching, but asking in this list if PHP can be used
to do OOP good enough for your project, it's the wrong question. Maybe you
could tell what kind of project you are trying to develop and then we may
figure if PHP as a programming language provides all the facilities that
you need to get going regardless if you use OOP or not.
If your project is Web based, I can tell you that PHP is good enough to
separate the content from the presentation just by using PHP classes as
limited as you may think of them today.
That doesn't mean you can't mix OOP with non-OOP in the same page script.
Think about this, in Java everything is withing object class, even the main
program function.
When Sun tried to develop JSP, they figured that need to get back to the
regular non-OOP programming to allow the developers to script the page tags
and function calls, so they developed a sort of compiler that would
generate a class for each JSP script that once run would generate the page
output.
The same thing is naturally achieved in PHP with or without OOP. As you
may see, they mixed OOP with non-OOP without problem because what matters
are the goals regardless of the means. So, stay focused, use your brain
and don't just jump into the latest Internet mania just because everybody
else seems to be doing it.
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--