Skill-Building Exercises


Summary

Software design patterns are a form of knowledge reuse. Design patterns are general software architectural solutions to general software architectural problems. A design pattern serves as the basis for a specific solution implementation. A complete design pattern specification includes more than just a graphical representation. Some design patterns can be applied alone while others are meant to be combined with other design patterns.

The Singleton pattern is used when only one instance of a particular class type is required to exist in your program. The general approach to creating a Singleton is to make the constructor protected or private and provide a public static method named getInstance() that returns the same instance of the class in question.

The Factory pattern is used to create classes whose purpose is to create objects of a specified type. The Dynamic Factory can be used to create object’s via Java’s dynamic class loading mechanism. One of the primary advantages of the Dynamic Factory pattern is that certain enhancements to an application that uses a dynamic factory can be made and implemented without the need to shut down the application.

The Model-View-Controller (MVC) pattern is used to separate the visual representation of an application object from the application object itself. The MVC pattern consists of three primary components: 1) the model, which can consists of one or more classes working together to realize the functionality of a particular application, 2) the view, which can consist of one or more classes working together to implement the visual representation of the model, and 3) the controller, which can consist of one or more classes working together to coordinate messaging between the model and the view.

The Command pattern is used to 1) decouple the knowledge of a particular action from an object that needs the action carried out, and 2) to encapsulate the action in the form of an object. The Command pattern can be combined with the Dynamic Factory pattern to map command names to class handlers and dynamically load and execute the command handler.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net