Slideshow transcript
Slide 1: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia
Slide 2: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Contenido
Slide 3: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Design Patterns • Describing recurring solutions to common problems in software design. • the capabilities and pitfalls of object-oriented programming, • and describing 23 classic software design patterns.
Slide 4: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia 23 classic software design patterns. • Creational • Structural • Behavioral patterns patterns patterns ▫ Adapter ▫ Chain of responsibility ▫ Abstract ▫ Command ▫ Builder ▫ Bridge ▫ Interpreter ▫ Factory Method ▫ Composite ▫ Iterator ▫ Prototype ▫ Decorator ▫ Mediator ▫ Singleton ▫ Facade ▫ Memento ▫ Flyweight ▫ Observer ▫ Proxy ▫ State ▫ Strategy ▫ Template method ▫ Visitor
Slide 5: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Creational patterns • These patterns have to do with class instantiation. ▫ class-creation patterns and (use inheritance effectively) ▫ object-creational patterns (use delegation)
Slide 6: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Creational patterns • Abstract Factory groups object factories that have a common theme. • Builder constructs complex objects by separating construction and representation. • Factory Method creates objects without specifying the exact class to create. • Prototype creates objects by cloning an existing object. • Singleton restricts object creation for a class to only one instance.
Slide 7: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Factory Method
Slide 8: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia The factory method pattern • is an object-oriented design pattern. • it deals with the problem of creating objects (products) without specifying the exact class of object that will be created. • defining a separate method for creating the objects • which subclasses can then override to specify the derived type of product that will be created.
Slide 9: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia ActionScript applications that have multiple classes public class Client { public function doSomething( ) { var object:Object = new Product( ); object.manipulate( ); } }
Slide 10: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia dependency between the Client and Product classes • There’s nothing wrong with this code, but it does create a coupling or dependency between the Client and Product classes. • Any changes to the Product class in terms of class name changes or change in the number of parameters passed to it will require changes in the Client class as well.
Slide 11: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Model of the Factory Method Pattern * 1 1 * Client Creator Product uses create
Slide 12: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia public class Creator { public static function simpleFactory(product:String) { if (product == "p1") { return new product1( ); } else if (product == "p2") { return new product2( ); } } }
Slide 13: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Classic factory method pattern
Slide 14: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Classic factory method pattern • Interfaces and not concrete classes • A pure interface does not provide any implementation for declared methods. • Abstract interfaces can provide default implementations for methods. • They’re also called abstract classes, and cannot be instantiated, but can be extended by other classes.
Slide 15: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Singleton pattern • is a design pattern that is used to restrict instantiation of a class to one object. • This is useful when exactly one object is needed to coordinate actions across the system. • Sometimes it is generalized to systems that operate more efficiently when only one or a few objects exist. • It is also considered an anti-pattern since it is often used as a euphemism for global variable.
Slide 16: Juan Carlos Giraldo Cardozo 11/04/08 Programación Multimedia Singleton pattern



Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 0 (more)