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

Sum01 Final Exam Review: Design Patterns

a) An Abstract Factory class doesn't actually do anything; it just defines the methods that a particular type of factory has to implement. Quoted from

Imagine supporting two windowing environments, Microsoft Windows™and the X Window System.

Create an Abstract Factory class WindowFactory defining methods like #createButton. Add subclasses MSWindowFactory and XWindowFactory which implement #createButton to answer instances of MSButton or XButton respectively. A window painter can then be given an instance of MSWindowFactory or XWindowFactory. Sending it the #createButton message will result in an instance of MSButton or Xbutton. Assuming they respond to the same protocol, the client can remain ignorant of the class of the resultant button.

There's some good stuff about patterns at

Yes, those are good sites. Still, what's the difference between Abstract Factory and Factory Method?

Also, be careful saying that factories don't do anything: creating instances would count as something, even if it might not seem like very much. -Lex Spoon

(a) With a Factory Method, we are specifying the particular way we instantiate an object, and the type of object itself. With an Abstract Factory, we are declaring the interfaces for any possible Factory that can be defined.

(b) An adapter is an object that receives an interface call from a client object. The adapter acts like a 'message-broker', it knows the target of the interface called, and delivers the appropiate results from the target to the client object (the reciever).

A Decorator shares the same functionality of an Adapter, however, it provides extended funcitonality that the interface called didn't have initially. This occurs dynamically and provides a way of avoiding subclassing.

(c) Patterns might be usefull to a professional programmer due to the fact of the experience the individual has. They may know the pattern that suits this problem and can assist the individual in decreasing their developement time and/or amount of possible symptons in the code.

The programmer however might abandon any patterns if a 'suitable' patterns' trade-off's or results could be counter-productive(or pose ridiculous issues) in respect to the entire system he/she is working on.


Link to this Page