আমাদের কথা খুঁজে নিন

   

Software Engineering: Basic Understanding about Creational Design Patterns

সাধারন মানুষ। কিন্তু মুক্ত

Singleton - Ensure that only one instance of a class is created and Provide a global access point to the object. Singleton pattern should be used when we must ensure that only one instance of a class is created and when the instance must be available through all the code. A special care should be taken in multithreading environments when multible threads must access the same resources throught the same singleton object. Factory(Simplified version of Factory Method) - Creates objects without exposing the instantiation logic to the client and Refers to the newly created object through a common interface. Factory pattern should be used when: - a framework delegate the creation of objects derived from a common superclass to the factory - we need flexibility in adding new types of objects that must be created by the class. Factory Method - Defines an interface for creating objects, but let subclasses to decide which class to instantiate and Refers to the newly created object through a common interface. Factory Method pattern should be used when: - a framework delegate the creation of objects derived from a common superclass to the factory - the base factory class does not know what concrete classes will be required to create - delegates to its subclasses the creation of concrete objects - factory subclasses subclasses are aware of the concrete classes that must be instantiated Factory method pattern, compared to Factory pattern replace the factory with an abstract class and a set of concrete factories subclasses. The subclasses are responsible for creating concrete product objects; for factory method is possible adding new product classes without changing the abstract factory. The same result can be achieved for simplified factory pattern if reflection is used. Abstract Factory - Offers the interface for creating a family of related objects, without explicitly specifying their classes. Abstract Factory should be used when: * A system should be configured with one of multiple families of products * A system should be independent of how its products are created, composed and represented * Products from the same family should be used all together, products from different families ahould not be used togheter and this constraint must be ensured. * Only the product interfaces are revealed, the implementations remains hidden to the clients. Builder - Defines an instance for creating an object but letting subclasses decide which class to instantiate and Allows a finer control over the construction process. Prototype - Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

সোর্স: http://www.somewhereinblog.net     দেখা হয়েছে বার

অনলাইনে ছড়িয়ে ছিটিয়ে থাকা কথা গুলোকেই সহজে জানবার সুবিধার জন্য একত্রিত করে আমাদের কথা । এখানে সংগৃহিত কথা গুলোর সত্ব (copyright) সম্পূর্ণভাবে সোর্স সাইটের লেখকের এবং আমাদের কথাতে প্রতিটা কথাতেই সোর্স সাইটের রেফারেন্স লিংক উধৃত আছে ।