Re: What design patterns do you usually use?

From: Date: Wed, 27 Feb 2008 14:25:10 +0000
Subject: Re: What design patterns do you usually use?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-270286@lists.php.net to get a copy of this message
Richard Heyes wrote:
What design patterns do you usually use?
Whatever solves the problem. Factory is quite a common one. MVC is another.
I have a story to kind of touch on what Jochem said about you just don't know the name yet. Just recently I was tasked with creating a new in-house CRM for an external partner. I only had four days and they had particular requirements that ruled out Sugar or other things. I had never really understood what the MVC pattern really was. I knew the basics, but I just didn't "get it". After I finished the first wave of development on this project I finally had a chance to sit back and see the forest through the trees and sat back and thought "damn... I just used MVC." If you're willing to shell out a few bucks, there's a pretty good book on design patterns for PHP. http://www.phparch.com/c/books/id/0973589825 You can think of design patterns more like classes you use with your code. They can help you achieve a goal, but they're not going to do everything for you. Maybe an even better analogy would be a really expensive set of knives. They're super sharp, so make sure you know what you're doing with them before you use them. There is also such a thing as too much. I heard a talk a while ago about code maintainability. The speaker mentioned a co-worker of his ran into his cube almost exhausted and proclaimed, "I finally did it!. I used every one of the design patterns in my program!" Just a few months later the speaker ended up being in charge of maintaining that program, and it was a nightmare. To make a long story short. I generally do what's easiest. It's typically faster to develop and easier to maintain. Unnecessary complexity can start a snowball effect. -- Ray Hauge www.primateapplications.com

« previous php.general (#270286) next »