프로그래밍/디자인패턴
-
Use of PIMPL Design Pattern프로그래밍/디자인패턴 2013. 6. 3. 16:46
출처- http://www.codeproject.com/Articles/17536/Use-of-PIMPL-Design-Pattern IntroductionPIMPL (Private Implementation) is a simple way to hide a part of a class implementation to other classes of the same project.It makes it possible to avoid other classes to know internal data structures and other information of the class. It also simplifies some #include preprocessor instructions.Example WITHOUT..
-
Compound Patterns프로그래밍/디자인패턴 2013. 2. 4. 19:53
Compound Patterns A lot of patterns work together very well to form compound patterns. Below is a UML class diagram that implements various design patterns to form a compound pattern. After the diagram are some notes describing how and why this design was arrived at. 1. Polymorphism was introduced by the use of the Quackable interface. This makes a number of design patterns available to us. 2. T..
-
Proxy Pattern프로그래밍/디자인패턴 2013. 2. 4. 19:50
Proxy Pattern Motivation Sometimes we need the ability to control the access to an object. For example if we need to use only a few methods of some costly objects we'll initialize those objects when we need them entirely. Until that point we can use some light objects exposing the same interface as the heavy objects. These light objects are called proxies and they will instantiate those heavy ob..
-
State Design Pattern프로그래밍/디자인패턴 2013. 2. 4. 19:47
State Design Pattern Intent Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.An object-oriented state machinewrapper + polymorphic wrappee + collaboration Problem A monolithic object’s behavior is a function of its state, and it must change its behavior at run-time depending on that state. Or, an application is characterixed by lar..
-
Composite Pattern프로그래밍/디자인패턴 2013. 2. 4. 19:43
Composite Pattern Motivation There are times when a program needs to manipulate a tree data structure and it is necessary to treat both Branches as well as Leaf Nodes uniformly. Consider for example a program that manipulates a file system. A file system is a tree structure that contains Branches which are Folders as well as Leaf nodes which are Files. Note that a folder object usually contains ..
-
Iterator프로그래밍/디자인패턴 2013. 2. 4. 19:41
Iterator Motivation One of the most common data structures in software development is what is generic called a collection. A collection is just a grouping of some objects. They can have the same type or they can be all cast to a base type like object. A collection can be a list, an array, a tree and the examples can continue. But what is more important is that a collection should provide a way t..
-
Template Method프로그래밍/디자인패턴 2013. 2. 4. 19:38
Template Method Motivation If we take a look at the dictionary definition of a template we can see that a template is a preset format, used as a starting point for a particular application so that the format does not have to be recreated each time it is used.On the same idea is the template method is based. A template method defines an algorithm in a base class using abstract operations that sub..
-
Facade Design Pattern프로그래밍/디자인패턴 2012. 12. 8. 21:20
Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.Wrap a complicated subsystem with a simpler interface.Problem A segment of the client community needs a simplified interface to the overall functionality of a complex subsystem. Discussion Facade discusses encapsulating a complex subsystem withi..