DOC PREVIEW
SJSU CMPE 196G - Creational Patterns
Pages 31

This preview shows page 1-2-14-15-30-31 out of 31 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PowerPoint PresentationLesson ObjectivesSlide 3Intro. to Creational PatternsIntro. to Creational Patterns (2)Intro. to Creational Patterns (3)Building a Maze ExampleThe Relationship Between Classes in the Maze ExampleSlide 9Abstract Factory DefinitionAbstract Factory: StructureAbstract Factory: Simple ExampleExample DescriptionAbstract Factory: ApplicabilityParticipantsAbstract Factory Pattern: CollaborationsAbstract Factory: Advantages & DisadvantagesAbstract Factory: Related PatternsSlide 19Builder PatternBuilder Pattern: StructureRTF Reader ExampleBuilder Pattern: ParticipantsBuilder Pattern: CollaborationsBuilder Pattern: ApplicabilityBuilder Pattern: AdvantagesBuilder Pattern: Related PatternsWhen a Builder Shouldn’t Be UsedBuilder Pattern: ConclusionsBuilder Pattern: Conclusions (2)Discussion QuestionsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-1PS95&96-MEF-L11-1Dr. M.E. FayadCreationalParadigm Shift, Inc.Software FactoryBehavioralStructuralLesson 4:Creational PatternsLesson 4:Creational PatternsObject-Object-OrientedOrientedDesignDesignPatternPatternssCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-2PS95&96-MEF-L11-2Dr. M.E. FayadLesson ObjectivesLesson ObjectivesUnderstand the philosophy behind creational patternsDiscuss in detail the creational patternsPresent the following Patterns:Abstract FactoryBuilderObjectivesCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-3PS95&96-MEF-L11-3Dr. M.E. FayadIntroduction to Creational Patterns•Topics–Introduction to Creational Patterns–Building a Maze Example–Creational Patterns that are Used in the MazeCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-4PS95&96-MEF-L11-4Dr. M.E. FayadIntro. to Creational Patterns•Creational patterns abstract how objects are created•Use creational patterns in the following situations:–When you want to vary the class of the object that is being creating, either at compile-time or at run-time–When you want to vary how objects are composed–When you want to decouple subsystemsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-5PS95&96-MEF-L11-5Dr. M.E. FayadIntro. to Creational Patterns (2)•Creational patterns should be used when a system should be independent of how its objects are created, composed, and represented•The class creational patterns use inheritance to vary the class of the object being created•The object creational patterns delegate the creation of an object to another objectCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-6PS95&96-MEF-L11-6Dr. M.E. Fayad•Sometimes the creational patterns are competitors •At other times they work together Examples:–A Builder can be implemented using one of the other patterns, such as Abstract Factory for creating components–A Prototype can be implemented using the Singleton patternIntro. to Creational Patterns (3)Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-7PS95&96-MEF-L11-7Dr. M.E. FayadBuilding a Maze ExampleThis example focuses only on how to create a map of a maze. A maze is a set of rooms, each with a location. Each room knows its neighbors. Possibly a neighbor is another room, a wall, or a door to another room.This example focuses only on how to create a map of a maze. A maze is a set of rooms, each with a location. Each room knows its neighbors. Possibly a neighbor is another room, a wall, or a door to another room.Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-8PS95&96-MEF-L11-8Dr. M.E. FayadThe Relationship Between Classes in the Maze ExampleMapSiteEnter()WallEnter()DoorEnter()isOpenRoomSetSide()GetSide()Enter()locationMazeAddRoom()GetRoomAt()sidesroomsShow how the following creational patterns can be used in building the maze: Abstract Factory, Builder, Factory Method, Prototype, and Singleton.Show how the following creational patterns can be used in building the maze: Abstract Factory, Builder, Factory Method, Prototype, and Singleton.Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-9PS95&96-MEF-L11-9Dr. M.E. FayadAbstract Factory Pattern•Topics–Abstract Factory Definition–Structure–UI WindowKit Example–Participants & Collaborations–Applicability–Advantages and Disadvantages–Related PatternsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-10PS95&96-MEF-L11-10Dr. M.E. FayadAbstract Factory Definition•Abstract Factory provides an interface for creating various kinds of objects without specifying concrete classes•Abstract Factory can enforce dependencies between product classes•Abstract Factory is also known as a “Kit”•The standard form of the Abstract Factory is usually just a collection of Factory Methods. A concrete factory will specify its products by overriding a factory method for each productCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-11PS95&96-MEF-L11-11Dr. M.E. FayadAbstract Factory: Structurereturn new ProductA1AbstractFactoryMakeProductA()MakeProductB()ConcreteFactory1MakeProductA()MakeProductB()ConcreteFactory2MakeProductA()MakeProductB()return new ProductA2GenericProductAProductA1ProductA2GenericProductBProductB1ProductB2Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-12PS95&96-MEF-L11-12Dr. M.E. FayadAbstract Factory: Simple Examplereturn new MotifWindowWindowKitCreateScrollBar()CreateWindow()MotifWindowKitCreateScrollBar()CreateWindow()PMWindowKitCreateScrollBar()CreateWindow()return new PMScrollBarWindowMotifWindow PMWindowScrollBarMotifScrollBarPMScrollBarCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved - V2.0 Creational Patterns - Page L4-13PS95&96-MEF-L11-13Dr. M.E. FayadExample Description•WindowKit is a user interface that supports multiple standard look-and-feels, such as Motif and Presentation Manager (PM).•Different


View Full Document

SJSU CMPE 196G - Creational Patterns

Download Creational Patterns
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Creational Patterns and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Creational Patterns 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?