On 07 Feb 2012 at 22:31, Paul M Foster <pa...@quillandmouse.com> wrote: 

> Design Patterns are Way Nifty Kewl patterns of code which are supposed
> to facilitate certain types of operations. (Was that sarcasm you
> detected? Yes it was.)
>
> For example, the Singleton pattern. Let's say you had a configuration
> class that held the configuration values for your application, and you
> wanted to make sure there was only one object of that class
> instantiated, no matter how many times it was called in your code. You'd
> arrange the code and call the class in a certain way to ensure that only
> one object of that class resulted. To make your configuration class a
> "singleton", you'd probably make the class have a *private* constructor
> (so no outside routine could call it), and then provide a method called
> get_instance() which tested for the existence of an object of that
> class. If such an instance was found, someone calling
> configuration::get_instance() would simply get the existing object
> returned to them. Otherwise, configuration::get_instance() would
> instantiate the class and then return the new object to the caller.
>
> As you can see, that's a peculiar way of setting up your code for a
> specific purpose. Other design patterns do other things and dictate
> setting up things in other ways.
>
> The definitive work on this (and where it first gained the most
> publicity) is a book called "Design Patterns" by four authors (Gamma,
> Helm, Johnson and Vlissides). It essentially contains a chapter about
> each (known at the time) design pattern and some pseudocode about how it
> might be constructed. I imagine the authors looked at a lot of code and
> discovered that programmers were coming up with code that, in each case
> was remarkably similar for solving certain types of programming
> problems. So they codified what that found and wrote a book about it.
>
> I have the book on my shelf, and it's decent technology, but you could
> spend your whole career and never use any of it, and get along just
> fine.

Mmmm. Well, at this point I feel underwhelmed - but its entirely possible that 
I'm missing something profound [1]. After looking at some of the reviews of the 
book you mention on Amazon, I might be inclined to get a simpler intro.

[1] In June 1982 (or was it '83?) I visited PARC with a small group from SLAC. 
We saw the Star or whatever it was, with bit-mapped display and mouse pointer. 
Whoosh !! (Well, to be fair, we'd gone along to look into XNS).

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to