Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 5th, 2006, 1:16 PM   #1
Eryk
Programmer
 
Join Date: Jul 2005
Posts: 62
Rep Power: 4 Eryk is on a distinguished road
Design Patterns In PHP

I'm trying to learn about design patterns right now, but I really don't know where to start. All of the tutorials that I have found seem like they either use PHP 5, or require the use of other design patterns, so I can't really seem to catch on. I purchased Design Patterns, a catalogue of several patterns, but the SmallTalk and C++ is very confusing to me.

I do use OOP, though I'm not sure if I know all that I need to. I know about object inheritance, polymorphism, and encapsulation. Is there anything else that I really need to learn before I can really understand these?

Could anyone recommend a starting place?

Thanks.
Eryk is offline   Reply With Quote
Old Feb 5th, 2006, 2:46 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The thing about object oriented design is to not get snowed by all the academic pronouncements and high-priestly bool cheet. An object is a thing, like a table. Procedural stuff is like cleaning up your room. Some of the things you need for making solutions are best built as objects, others are better when done procedurally. Just think about your problem and use your common sense. Then fill in the details with your studies and investigations.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 5th, 2006, 2:54 PM   #3
Eryk
Programmer
 
Join Date: Jul 2005
Posts: 62
Rep Power: 4 Eryk is on a distinguished road
Quote:
Originally Posted by DaWei
The thing about object oriented design is to not get snowed by all the academic pronouncements and high-priestly bool cheet. An object is a thing, like a table. Procedural stuff is like cleaning up your room. Some of the things you need for making solutions are best built as objects, others are better when done procedurally. Just think about your problem and use your common sense. Then fill in the details with your studies and investigations.
Thanks for the response, I appreciate it.


I'm going to hijack my own thread by adding on, but the topics are somewhat similar . I'm working on my website, and the way I would like to set it up is to have the base, and then have extensions to add on to it. The problem I'm running into is that I would really like the extensions to be as separate as they can be from the original source code. Though I run into problems when some extensions requie others. How would you recommend going about setting up a system which can adapt easily to this?
Eryk is offline   Reply With Quote
Old Feb 5th, 2006, 3:29 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I'm not sure what you mean by 'extensions', but check out templates and the include statement.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 5th, 2006, 3:53 PM   #5
Eryk
Programmer
 
Join Date: Jul 2005
Posts: 62
Rep Power: 4 Eryk is on a distinguished road
By extensions I mean like new features to the code.

My basic code would have things like:
-A CMS
-A membership system
-An article system
-User groups
-Categories
-et cetera

Then the extensions would be things like:
-Image gallery
-User's own blog
-Calendar
-Download manager
-Poll(s)
-et cetera

So basically I need a way to implement new features into the website application, without really changing the basic code. The problem that I expect to run into is not really knowing when I'll need the new files. For example, some might be on every page, while others might be on their own pages, as unique sections of the site.
Eryk is offline   Reply With Quote
Old Feb 5th, 2006, 4:08 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Again, check out templates and the include statement.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 5th, 2006, 4:12 PM   #7
Eryk
Programmer
 
Join Date: Jul 2005
Posts: 62
Rep Power: 4 Eryk is on a distinguished road
Quote:
Originally Posted by DaWei
Again, check out templates and the include statement.
I know how to work with the include/require statement. Though by templates do you mean something like Smarty?
Eryk is offline   Reply With Quote
Old Feb 5th, 2006, 5:10 PM   #8
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
You just want to create a simple plugin system, with some basic dependancy management so that one plugin can require another. The plugins get access to bits of your main API and go from there to provide the extra functionality. For example, a simple text editor might provide plugins with reference/pointer to the main text box, so that the plugin can read/write text to it.
The import statement has been mentioned by DaWei - it lets you load and execute a PHP file dynamically if you know its file name. You could use that to load your plugins, for example.
Cerulean is offline   Reply With Quote
Old Feb 5th, 2006, 9:16 PM   #9
BlazingWolf
Hobbyist Programmer
 
Join Date: Sep 2004
Posts: 207
Rep Power: 5 BlazingWolf is on a distinguished road
Quote:
Originally Posted by Eryk
I know how to work with the include/require statement. Though by templates do you mean something like Smarty?
Like Smarty. There's also a lot of other ones. I've used Smarty before I like.
__________________
_______________________________
BlazingWolf
BlazingWolf is offline   Reply With Quote
Old Feb 5th, 2006, 9:25 PM   #10
Eryk
Programmer
 
Join Date: Jul 2005
Posts: 62
Rep Power: 4 Eryk is on a distinguished road
Quote:
Originally Posted by BlazingWolf
Like Smarty. There's also a lot of other ones. I've used Smarty before I like.
I'm familiar with Smarty as well, but I really don't see what that has to do with extensions, or as Cerulean calls them, plugins. I do know how to use include/require as I already said. The problem really isn't getting the files, but how to make sure that everything has access to everything else, and knowing when to include a certain extension. For example, a poll might be displayed on every page, while a gallery would only be displayed when that page was accessed. How would set it up so that you would know what extensions to use and when? So really this isn't a matter of not knowing the programming, but more of not knowing the theory, or abstraction that I should put to it.
Eryk is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:53 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC