Re: php pattern, software development pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Symbulos Partners wrote:
> I looked at php pattern (www.phppatterns.com). I did not understand it well.
>
> Is that supposed to be pattern as in software development pattern? If so why
> the uml diagrams are not there?

They are design patterns for code.  But the design patterns there are
more micro than your typical UML (though I suppose you could diagram the
design using UML if you really want).

Think of those patterns as a "blueprint for building a class".  While
your problem at hand is unique, there are repeatable solutions
(patterns) that you can use and re-use to solve those unique patterns.
*That* is what design patterns are all about.

>
> For example
>
> A sample Strategy pattern for form validation.
>
> What does that mean?

Form validation is a problem you will have over and over again.  The
strategy pattern is a *repeatable solution* to that problem.

So you can use the Strategy pattern to solve your form validation
problem the first time around.  Then the next time you need to validate
a form you say "hey, wait a minute, I know how to solve this problem!"
Poof!  Light bulbs go on, angels sing and the beer flows like water.

Better yet: if you're careful about the way you design your "Strategy"
class, then you can re-use it for future projects.  You become more
efficient because now you have this code base that you can re-use.
Easily.  *Hopefully*.  ;)  It takes a lot of practice to get good at
this and even then you will end up scrapping designs later.

>
> I am confused.

Hopefully you're less confused now.

To summarize: if you have a repeatable problem with a single answer that
you can use to answer that problem then design patterns are "A Good
Thing".  In addition, having those classes around will make it easier
for you to get a solution the second, third, etc. time around.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux