Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 7th, 2010, 10:05 PM
Dameon51 Dameon51 is offline
http://stealthwd.ca
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2005
Posts: 681 Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 23 h 8 m 5 sec
Reputation Power: 199
Send a message via ICQ to Dameon51
OO Programming in PHP

Hey everyone. In the company I currently work for I've developed a CMS in php with a lot of ajax for the front end stuff. On the backend I have an abstract parent class that has the common functionality for all the modules. Besides the general idea of using inheritance, abstraction, and generally making and using objects I don't think I know much else about using OO programming in real world situations. All the tutorials I've been able to find don't have good real world examples so I'm hoping someone can point me down a path to increase my OO programing skills, preferably in PHP.

Reply With Quote
  #2  
Old April 13th, 2010, 06:50 AM
JulianRead101 JulianRead101 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 34 JulianRead101 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 12 m 28 sec
Reputation Power: 5
Book Recommendation

I would recommend getting the following book "Head First Design Patterns", I am in the middle of reading it and so far I am impressed.

It is not PHP specific but it is very good at explaining soloutions to common design problems and has helped me in communicating with other developers.

Reply With Quote
  #3  
Old April 16th, 2010, 01:38 AM
Catacaustic's Avatar
Catacaustic Catacaustic is offline
Code Monkey V. 0.9
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2005
Location: A Land Down Under
Posts: 1,885 Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level)Catacaustic User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 14 h 47 m 3 sec
Reputation Power: 1798
The closest thing to a "real world" example to something like that I can think of quickly, is cars. I'll tyr to make this not PHP-specific, as pretyt much eveyr OO language does the same things.

class Vehicle
var power
var num_wheels
var num_doors

class Car extends Vehicle
var brand
var model

class Motorcyle extends Vehicle
var brand

class Convertible extends Car
var roof_down

That's the basic idea. Start with a base class, and build things on top as they get more diverse. When it does, inherit/extend (terminology can differe depending on languages) from the class next back in the tree and keep going from there.

Reply With Quote
  #4  
Old April 17th, 2010, 12:13 PM
Dameon51 Dameon51 is offline
http://stealthwd.ca
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2005
Posts: 681 Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 23 h 8 m 5 sec
Reputation Power: 199
Send a message via ICQ to Dameon51
Quote:
Originally Posted by Catacaustic
The closest thing to a "real world" example to something like that I can think of quickly, is cars. I'll tyr to make this not PHP-specific, as pretyt much eveyr OO language does the same things.

class Vehicle
var power
var num_wheels
var num_doors

class Car extends Vehicle
var brand
var model

class Motorcyle extends Vehicle
var brand

class Convertible extends Car
var roof_down

That's the basic idea. Start with a base class, and build things on top as they get more diverse. When it does, inherit/extend (terminology can differe depending on languages) from the class next back in the tree and keep going from there.


Yeah I'm past this level already. I use inheritance and abstraction but that's about it.

Reply With Quote
  #5  
Old May 19th, 2010, 06:23 AM
GiffordBruno GiffordBruno is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2010
Posts: 12 GiffordBruno User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 22 m 58 sec
Reputation Power: 0
OO PHP is really more important factor that stands out are productivity, organization, and efficiency.Thse all the things are realy become effective by using OO in PHP and it can save time or increase workflow. For organization, OO PHP can keep your code and files organized. By efficiency, OO PHP can make your project and future projects run smoothly.

Reply With Quote
  #6  
Old August 31st, 2010, 02:05 PM
FuzzyBear1111 FuzzyBear1111 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2010
Posts: 8 FuzzyBear1111 User rank is Private First Class (20 - 50 Reputation Level)FuzzyBear1111 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 h 11 m 49 sec
Reputation Power: 0
Quote:
Originally Posted by JulianRead101
I would recommend getting the following book "Head First Design Patterns", I am in the middle of reading it and so far I am impressed.

It is not PHP specific but it is very good at explaining soloutions to common design problems and has helped me in communicating with other developers.


I've just started reading this, so far so good.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > OO Programming in PHP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap