:?: php // oop

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
jrja
Forum Newbie
Posts: 17
Joined: Wed Nov 19, 2008 10:28 am

:?: php // oop

Post by jrja »

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.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: :?: php // oop

Post by alex.barylski »

Yes very possible
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: :?: php // oop

Post by josh »

A correct answer cannot be given to an ambiguous question. Can a motorcycle do what a car does? In what sense? What context?
Theory?
Forum Contributor
Posts: 138
Joined: Wed Apr 11, 2007 10:43 am

Re: :?: php // oop

Post by Theory? »

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.
jrja
Forum Newbie
Posts: 17
Joined: Wed Nov 19, 2008 10:28 am

Re: :?: php // oop

Post by jrja »

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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: :?: php // oop

Post by josh »

So are we talking language stereotypes of language capabilities? Language "safety"?
jrja
Forum Newbie
Posts: 17
Joined: Wed Nov 19, 2008 10:28 am

Re: :?: php // oop

Post by jrja »

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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: :?: php // oop

Post by josh »

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
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: :?: php // oop

Post by panic! »

Look, I love PHP but there are better OO models out there. Strings aren't objects for example.
Post Reply