From 1f37ca385f7dd88663534e8e5103b124b429872e Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Tue, 23 Aug 2011 11:52:46 +0200 Subject: [PATCH] some more comments, typos etc. --- AbstractFactory/AbstractFactory.php | 8 ++++---- Adapter/Adapter.php | 2 +- Composite/Composite.php | 6 ++++-- Facade/Facade.php | 2 ++ Multiton/Multiton.php | 1 + Prototype/Prototype.php | 2 +- Singleton/Singleton.php | 4 ++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/AbstractFactory/AbstractFactory.php b/AbstractFactory/AbstractFactory.php index 2808f9f..ae4201a 100644 --- a/AbstractFactory/AbstractFactory.php +++ b/AbstractFactory/AbstractFactory.php @@ -10,10 +10,10 @@ namespace DesignPatterns; * usually the created classes all implement the same interface * * Examples: - * - A Factory to create media in a CMS: classes would be text, audio, video, picture - * - SQL Factory (types are all strings with SQL, but they vary in detail (tables, fields, etc.)) - * - Zend Framework: Zend_Form::createElement() creates form elements, but you could also call new T - * TextElement() instead + * - A factory to create media in a CMS: classes would be text, audio, video, picture + * - SQL factory (types are all strings with SQL, but they vary in detail (tables, fields, etc.)) + * - Zend Framework: Zend_Form::createElement() creates form elements, but you could also call + * new TextElement() instead * */ abstract class AbstractFactory diff --git a/Adapter/Adapter.php b/Adapter/Adapter.php index 0231bb8..3ecb4ed 100644 --- a/Adapter/Adapter.php +++ b/Adapter/Adapter.php @@ -12,7 +12,7 @@ namespace DesignPatterns; * Examples: * - different databases have the same interface to communicate although the underlying systems act differently * - * this is a VERY basic example which won't work at all + * this is a VERY basic example which won't work at all! */ interface DatabaseAdapter { diff --git a/Composite/Composite.php b/Composite/Composite.php index 65aca01..15e8340 100644 --- a/Composite/Composite.php +++ b/Composite/Composite.php @@ -6,11 +6,13 @@ namespace DesignPatterns; * composite pattern * * Purpose: - * to treat a group of objects the same way as a single instance of the object + * to treat a group of objects the same way as a single instance of the object, it establishes 1-to-n relationships + * between objects * * Example: * - a form class instance handles all its form elements like a single instance of the form, when render() is called, it - * subsequently runs trough all its child elements and calls render() on them + * subsequently runs trough all its child elements and calls render() on them + * - a class to process files would process it by running process on all row objects in the file * */ class Form diff --git a/Facade/Facade.php b/Facade/Facade.php index 46be4d4..60bfd7e 100644 --- a/Facade/Facade.php +++ b/Facade/Facade.php @@ -10,6 +10,8 @@ namespace DesignPatterns; * * Examples: * - Database Abstraction Layers + * - Doctrine2: EntityManager is the facade that one sees from the outside, but in there is much more going on, Unit of + * Work, etc. * */ class Facade diff --git a/Multiton/Multiton.php b/Multiton/Multiton.php index bd5adb8..4327a0e 100644 --- a/Multiton/Multiton.php +++ b/Multiton/Multiton.php @@ -46,6 +46,7 @@ class Multiton /** * gets the instance with the given name, e.g. Multiton::INSTANCE_1 + * uses lazy initialization * * @param string $instanceName * @return Multiton diff --git a/Prototype/Prototype.php b/Prototype/Prototype.php index 913be81..00036b2 100644 --- a/Prototype/Prototype.php +++ b/Prototype/Prototype.php @@ -6,7 +6,7 @@ namespace DesignPatterns; * Prototype pattern * * Purpose: - * to avoid the the cost of creating objects the standard way (new Foo()) and instead create a prototype and clone it + * to avoid the cost of creating objects the standard way (new Foo()) and instead create a prototype and clone it * * Examples: * - Large amounts of data (e.g. create 1,000,000 rows in a database at once via a ORM) diff --git a/Singleton/Singleton.php b/Singleton/Singleton.php index 16d4ca0..4da63d2 100644 --- a/Singleton/Singleton.php +++ b/Singleton/Singleton.php @@ -6,11 +6,11 @@ namespace DesignPatterns; * Singleton pattern * * Purpose: - * - to have only one instance of this object in the application, that handles all calls + * to have only one instance of this object in the application, that will handle all calls * * Examples: * - DB Connector - * - Logger (May also be a Multiton if there are many Logfiles for several purposes) + * - Logger (may also be a Multiton if there are many log files for several purposes) * - Lock file for the application (there is only one in the filesystem ...) * */