ASPit - Totally ASP

Go Back PHPit Forums > General PHP > Advanced Topics
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
Thread Tools Search this Thread Display Modes
Old 04-26-2006, 02:22 AM #1
Craige
Ambitious Member

Join Date: Mar 2006
Location: Ont. Canada
Posts: 83
Send a message via AIM to Craige Send a message via MSN to Craige
Default PHP OO Desing Patterns.

Okay, I have had a grasp on PHP OO for quite a while now, but my lack of understanding for good design patterns is driving me crazy. I can write OO PHP code, but I cannot do it in such a way to be able to really work with design patterns. I want to read up on a bunch, and learn why they are good like they are. I feel if I can do that, then maybe I will be able to write better OOP code using concepts learned from the patterns. I always feel that my code is inefficent, and could be a hella lot better. I have not read any good resourses on OO PHP. Just this and that I learned here and there, to gather my knowledge OOP. The book I origonally learned PHP from had a shitty section on OO PHP (and it was PHP 4, I have learned parts of PHP 5 OOP since the release).

Anyway, you get what I am asking. Links, Book refrences (that go over several patterns), ect.
__________________
// MustyWindows - Break Through The Windows!
// AmpFusion <- Coming Soon
// CrystalHosting.net
Craige is offline Reply With Quote
Old 04-26-2006, 06:09 PM #2
Dennis Pallett
Administrator

Dennis Pallett's Avatar

Join Date: Nov 2005
Posts: 256
Default

Join the club! I've been struggling with Design Patterns for quite a while now, and I'm finally slowly understanding them. It's not easy

Anyway, one of the best sources for OOP and Design Patterns in PHP is definitely the PHP Application Design forums at SitePointForums. Some of the greatest PHP gurus hang out there, discussing almost any aspect of PHP, including a lot of talk about design patterns.

If you're looking for books, I've heard many positive comments about Patterns of Enterprise Application Architecture by Martin Fowler. I haven't read it myself, so I can't really offer any insight on it.

Hopefully in the neat-future (I'm hoping in the coming month) I'll be reviewing a PHP book called "PHP 5 Objects, Patterns, and Practice", and the review will be posted on PHPit. Sounds like it contains a bit on design patterns as well

I also suggest you check out phpPatterns and maybe "Introduction to Design Patterns Using PHP"
__________________
Dennis Pallett
Dennis Pallett is offline Reply With Quote
Old 04-27-2006, 07:12 AM #3
Matthijs
Super Moderator

Join Date: Nov 2005
Posts: 88
Default

Awaiting the review of Dennis about PHP 5 objects patterns and practice: I just started reading it and from reading the first couple of chapters and browsing the others, I find it an excellent book. I haven't arrived at the chapters on patterns yet, but the first chapters are promising. Especially his writing style is very pleasant. Something which is very important (for me at least), as it helps a lot in digesting the content. Also, a clear and pleasant writing style makes reading more enjoyable.
Matthijs is offline Reply With Quote
Old 04-27-2006, 09:43 AM #4
Dennis Pallett
Administrator

Dennis Pallett's Avatar

Join Date: Nov 2005
Posts: 256
Default

Hopefully I'll receive the book next week, so I can have a review up shortly after. The title sounds pretty exciting, and I can't wait to dig in.
__________________
Dennis Pallett
Dennis Pallett is offline Reply With Quote
Old 04-27-2006, 05:08 PM #5
Jared White
Junior Member

Join Date: Apr 2006
Posts: 21
Default

I've read Patterns of Enterprise Application Architecture by Martin Fowler, and I thought it was really excellent. The only drawback is that all the examples are Java or C#, so you have to be at an intermediate level in programming at least to be able to translate the concepts to PHP. Thankfully, PHP 5 is a bit more Java-like than 4, so it's not quite so hard now.

My personal opinion about patterns are that, while they're very useful, their real purpose is to describe how excellent apps are built, not to dictate how to build excellent apps. In other words, as you're building an app, you might use certain existing patterns and might create some new patterns or variations on existing patterns yourself. It's almost like art -- you learn the rules, then you start breaking a few. But you definitely need to learn the rules first. PoEAA is a great place to start and considered a "reference manual" of sorts for Web development architecture. (When you hear people raving about how cool Ruby on Rail's ActiveRecord component is, just remember Martin Fowler described that pattern first!)
__________________
Willowgarden: rapid application platform for PHP 5
xajax: fast and easy PHP Ajax library
Web software architecture blog: The Idea Basket
Jared White is offline Reply With Quote
Old 04-27-2006, 06:05 PM #6
Dennis Pallett
Administrator

Dennis Pallett's Avatar

Join Date: Nov 2005
Posts: 256
Default

Quote:
Originally Posted by Jared White
My personal opinion about patterns are that, while they're very useful, their real purpose is to describe how excellent apps are built, not to dictate how to build excellent apps. In other words, as you're building an app, you might use certain existing patterns and might create some new patterns or variations on existing patterns yourself. It's almost like art -- you learn the rules, then you start breaking a few. But you definitely need to learn the rules first. PoEAA is a great place to start and considered a "reference manual" of sorts for Web development architecture. (When you hear people raving about how cool Ruby on Rail's ActiveRecord component is, just remember Martin Fowler described that pattern first!)

I definitely agree with that, and I've often found myself using a certain design pattern, without even using it on purpose. It just "happened", and I only noticed afterwards.
__________________
Dennis Pallett
Dennis Pallett is offline Reply With Quote
Old 04-29-2006, 03:07 AM #7
Craige
Ambitious Member

Join Date: Mar 2006
Location: Ont. Canada
Posts: 83
Send a message via AIM to Craige Send a message via MSN to Craige
Default

Okay. I will check out the site point forums, and those other two links you gave me. However I would profer a book that describes the patterns in PHP. I really don't want to have to go through reading a java book to convert the code over. Not that I can't do it, I just prefer not to. Any other book recomendations that are in PHP?
__________________
// MustyWindows - Break Through The Windows!
// AmpFusion <- Coming Soon
// CrystalHosting.net
Craige is offline Reply With Quote
Old 04-29-2006, 07:19 AM #8
Matthijs
Super Moderator

Join Date: Nov 2005
Posts: 88
Default

One other excellent book is PHP Architects Guide to PHP Design Patterns from Jason Sweat. It will take a basic level of php knowledge to be able to understand everything, but as I understand you have enough experience programming php. Jason takes a test-driven approach in the book, it is well written and he discusses clearly why or when each pattern is used.
Matthijs is offline Reply With Quote
Old 04-29-2006, 04:22 PM #9
Dennis Pallett
Administrator

Dennis Pallett's Avatar

Join Date: Nov 2005
Posts: 256
Default

I haven't read any PHP design patterns books (yet), so I can't really offer any suggestions, but I've also heard some positive comments on PHP Design Patterns which Matthijs recommended, so give that a try.

Hopefully I'll get PHP 5 Objects, Patterns, and Practice soon so I can give a review on that.
__________________
Dennis Pallett
Dennis Pallett is offline Reply With Quote
Old 04-30-2006, 09:01 PM #10
kingleo
Ambitious Member

kingleo's Avatar

Join Date: Dec 2005
Posts: 74
Default

I took a glance on several excerptions of "Guide to PHP Design Patterns" online, and found the book is valuable to help building up a sense of patterns...of course patterns exist in every logic-required situation.
__________________
i'm a zealous php newbie
kingleo is offline Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 10:52 AM.


Powered by vBulletin Version 3.6.0
Copyright 2000 - 2006, Jelsoft Enterprises Ltd.