Download presentation
Presentation is loading. Please wait.
Published byAnthony Ferguson Modified over 9 years ago
1
CSC 480 Software Engineering Lab 5 – Abstract Factory Pattern Oct 30, 2002
2
CSC 4802 10/30/2002 The Abstract Factory Pattern Intent – provide an interface for creating families of related or depended objects without specifying their concrete classes AKA Kit Like other creational patterns, this pattern can help to avoid hard-coding the way in which objects need to be created
3
CSC 4803 10/30/2002 Design Pattern Space
4
CSC 4804 10/30/2002 Structure – an illustration
5
CSC 4805 10/30/2002 Application – pluggable look-and-feel Support multiple look-and-feel user interfaces, such as Windows, Motif, Macintosh Specify the selected look-and-feel in client programs The corresponding GUI factory will be returned to generate graphical components in the requested laf In Java, this is accomplished at the system level UIManager.setLookAndFeel(plafName);
6
CSC 4806 10/30/2002 Look-and-Feel Alternatives Windows Motif Metal (swing’s default)
7
CSC 4807 10/30/2002 Application in This Lab A GardenMaker Factory Garden varieties: annual, perennial, vegetable Common concerns What are good center plants? What are good border plants? What do well in partial shade? Plants With a name Other properties can be added
8
CSC 4808 10/30/2002 Major Classes
9
CSC 4809 10/30/2002 Sample Results
10
CSC 48010 10/30/2002 Consequences Benefits It isolates concrete classes at the client level A factory encapsulates the responsibility and the process of creating product objects. Clients are isolated from implementation classes It makes exchanging product families easy – the concrete factory is used once It promotes consistency among products Liabilities supporting new kinds of products is difficult
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.