View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Schedule: 16 September 2005

Part 1 - What are the differences between creational, structural and behaviorial Patterns?

These are design patterns that help create better object oriented programs. Creational design patterns help with the instanciation of objects by minimizing the number of objects that the design needs to instanciate. Structural designs help organize classes. Behavior patterns help with the methods of these classes. Creational design patterns include factory, builder, singleton, protoype while structural patterns include adapter, bridge, facade, flywieght, proxy, and behavioral design patterns include command, interpretor, mediator, iterater, observer. Singleton is a design pattern that ensures the creation of only one instance of a paticular class. This helps in situations whare multiple instances of a class would cause data errors such as print spooler or window amnager. Adapter is a design that helps classes that do not have compadible interfaces interact. Iterator helps access members of and agregate or collection sequenciallly. Each of these design patterns help with the impelnetation of a complex program in different situations.


http://www.developer.com/design/article.php/1502691
http://www.developer.com/design/article.php/3325211

Part 2 Describe a design Pattern

One particularly useful design pattern is the Observer design pattern. The Observer pattern is where one class is a subject and it has multiple classes that observe it. The purpose behind this design is to have the observers notified in the event that there is a change in the state of the subject. This is usually implemented thought the use of abstract classes and interfaces that the subject and observes inherit from. One possible design is shown below. This has the subject inherit from the abstract class and the observer implement an interface.

Uploaded Image: observer.gif

The Observer pattern is very interesting and useful because almost all user interface programs use this design pattern without realizing it. The mouse and keyboard are the subjects, and the observers are all the classes that have event handling methods. This is the most common use, but there are others such a timer that observes the system clock and updates accordingly (which we just finish creating for milestone one. The step and stepTime methods were implemented in the timer for our interface and the system clock called these to update the observer).

http://home.earthlink.net/~huston2/dp/observer.html
http://sern.ucalgary.ca/courses/SENG/609.04/W98/lamsh/observerLib.html

back

Links to this Page