Page 1 of 1
Design Patterns
Posted: Thu May 24, 2007 4:59 pm
by timclaason
I've recently been introduced to the idea of design patterns (that may lead everyone to realize what a 2-bit hack I am, but that's ok), in particular, the flyweight pattern.
I'm not really a C#, Java, C++, etc professional (only web), so I've never really thought of design in such complex terms, but I can't help thinking that my PHP code could be significantly improved and simplified if I implemented better design patterns that would work best for the particular type of application I'm working on.
I was wondering if anyone uses any specific design patterns, and if so, if you had any links you could post with different PHP implementations of design patterns.
Thanks in advance.
Posted: Thu May 24, 2007 5:13 pm
by Oren
Posted: Thu May 24, 2007 5:47 pm
by alex.barylski
Good programming practice and design, architecture, etc can be applied to *any* programming language regardless of it's purpose:
Client side JavaScript
Server side PHP
or desktop development in C++/C#/Java
I use as much as I know and as I much as I find fit for a given scenario.
If you want to know about design patterns, youv'e come to the right place, we have a few design pattern geeks on these boards.
Long story short: Use them, don't abuse them. Start simple and work your way up, don't apply every technique the minute you learn it, rather understand it's role in system design and look for future opportunities, etc.
Cheers

Posted: Fri May 25, 2007 1:29 am
by Ollie Saunders
Hockey is dead right however, if I remember correctly, the flyweight pattern doesn't really apply to PHP.
Posted: Fri May 25, 2007 1:41 am
by Christopher
ole wrote:if I remember correctly, the flyweight pattern doesn't really apply to PHP.
I think its probably more accurate to say that the problems solved by the flyweight pattern are not frequently implemented in web applications. It is one of many techniques to reduce data duplication. The OP expressed interest in the flyweight pattern, but did not give a specific problem that needed to be solved.
Posted: Fri May 25, 2007 2:50 am
by Maugrim_The_Reaper
Oren plugged my site

. The contents are limited for now since I'm not in article writing mode (lack of time). Also
http://www.phppatterns.com
A few article sites like DevShed run a regular design pattern series. Many focus on PHP implementations. Outside that don't be afraid to look for Java examples. The code is likely not portable but the explanations are worth reading since they apply to any language.
Posted: Wed Jun 20, 2007 9:51 am
by the_drizzle
Check out
FluffyCat. It gives some general descriptions of design patterns, using PHP for code examples.