want to use.. object oriented php.. but how??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
claws
Forum Commoner
Posts: 73
Joined: Tue Jun 19, 2007 10:54 am

want to use.. object oriented php.. but how??

Post by claws »

hi.. every one..

I am a newbie. I want to use object oriented php but I never found its purpose..

all the things were easy using normal php.
but everyone finds object oriented is very handy and uses it.

I am interested in it. but unable to appreciate it so. unable to use it.

can any one give me a link to some tutorial or explain me. how can i use it for my regular needs.

and any link for object oriented php tutorial will be helpful.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Cannot give you any links off the top of my head but would recommend you learn PHP patterns and Test Driven Development (TDD) at the same time. It's probably easier to do all of them at the same time, especially TDD, rather than just learn OO development and get used to a certain method of working then have to relearn a different method of "thinking". Both of these topics can be found using your favourite search engine although some links are www.patternsforphp.com which as far as I can tell has been developed by some people on this forum. For TDD as far as I can tell you have PHPUnit2 and simpletest.
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Post by Rovas »

A great starter in PHP OOP is this tutorial
User avatar
playgames
Forum Newbie
Posts: 22
Joined: Tue Sep 04, 2007 4:28 am

Post by playgames »

i think a new phper study oop is not good for you.

but class of php can select :o
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: want to use.. object oriented php.. but how??

Post by onion2k »

claws wrote:I am a newbie. I want to use object oriented php but I never found its purpose..
There's nothing that you can do with objects that you can't do with functions. If you look for a "purpose" behind objects you'll never find one. The primary advantages of OOP are:

1. Encapsulation. Sections of code are neatly packaged together in handy objects.

2. Reuse. Because things are neatly packaged it's very easy to reuse them in lots of different places.

3. Organisation. Objects tend to make you separate your code into logical blocks - that leads to better organised code.

They're just a different way of organising stuff. They won't magically make your site quicker, or easier to define the logic for your code, or get more page views, or anything like that. All they'll do is make it easier you write things once and use them again and again. They're a bit easier to test too because they're packaged in a way that you can automate the testing using Unit Tests. That said, those are BIG advantages if you're writing code professionally.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Right on, onion2k! Extremely well said and absolutely correct.
Post Reply