Perhaps a silly amateur question but I'll ask anyway; with oop in php, can one build programs such as those in a language like Java? Would one even want to? Is there a site that deals with it, if it's possible?
I put these questions here because it did say theory and design.
:?: php // oop
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: :?: php // oop
Yes very possible
Re: :?: php // oop
A correct answer cannot be given to an ambiguous question. Can a motorcycle do what a car does? In what sense? What context?
Re: :?: php // oop
My whole rationale for learning Java was to teach myself good OOP practices in PHP. I'm sure there are plenty of people here who would disagree with me, but I find the two languages to be strikingly similar in many ways albeit very different in many others. I really like PHP's ability to be either OO or procedural, it allows for an incredible amount of flexibility. Also the built in functions are far more obvious and accessible vs. Java's insane means of burying functions in objects you might not expect them to be in. I swear I'd be rich if I had a nickel for every time I accidentally typed strtolower() in a Java program and screamed "WHY THE HELL DOESN'T THIS WORK?!" only to realize I can't keep track of what language I'm working with.
Sidetracked maybe? Yeah.
Either way, application design using PHP's OO paradigm is very smooth and in my opinion very much like Java in that sense. Java has more balls, but PHP makes more sense.
Sidetracked maybe? Yeah.
Either way, application design using PHP's OO paradigm is very smooth and in my opinion very much like Java in that sense. Java has more balls, but PHP makes more sense.
Re: :?: php // oop
ambiguous?
OK, lets try this:
http://jtf.acm.org/demos/classroom/index.html
---
About learning Java to get a handle on php - I turned to a class in Java to get an understanding of programing logic/methodology - the course I took in php didn't really cover it adequately. Perhaps I was making a mountain out of a mole hill; still, my non-programing brain had a hard time figuring it out. Some things just didn't seem "logical". The Java class did help a little.
OK, lets try this:
http://jtf.acm.org/demos/classroom/index.html
---
About learning Java to get a handle on php - I turned to a class in Java to get an understanding of programing logic/methodology - the course I took in php didn't really cover it adequately. Perhaps I was making a mountain out of a mole hill; still, my non-programing brain had a hard time figuring it out. Some things just didn't seem "logical". The Java class did help a little.
Re: :?: php // oop
So are we talking language stereotypes of language capabilities? Language "safety"?
Re: :?: php // oop
A.....no.
I set the link there for simple examples of what I meant when I asked about, if php could do such things as Java.
The comment about Java is in response to Theory?'s comment.
I set the link there for simple examples of what I meant when I asked about, if php could do such things as Java.
The comment about Java is in response to Theory?'s comment.
Re: :?: php // oop
you didnt answer my question. To answer you literally I guess, then yes.. both languages can do the same things in the sense that both are generally considered turning complete, meaning that both languages provide the building blocks necessary to model any arbitrary "state machine". That being said each language has different solutions to different problems. These solutions could be considered advantageous or dis-advantageous, depending on the criteria used, which we would need to flesh out to have a meaningful conversation
Re: :?: php // oop
Look, I love PHP but there are better OO models out there. Strings aren't objects for example.