Unformatted text preview:

1Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 293DesignMethodsPatternsObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 294MethodConceptsNotationsProcessHeuristics(a book)Method: A systematicway of doingsomething.2Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 295Responsibility Driven DesignConceptsClassResponsibilityCollaborationInheritanceSubsystemContractsBook: Object-Oriented Design byWirfs-Brock,Wilkerson andWienerObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 296Object Modeling Technique (OMT)ConceptsObjectsClassesAssociations /CardinalityAttributesInheritanceEventsBook: Object-Oriented Modelingand Designby Rumbaugh, Blaha,Premerlani, Eddy andLorenson3Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 297UMLUnified Modeling LanguageBooch, Rumbaugh, JacobsonUML = concepts and notationUnified Process = UML + a processObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 298Objects and AssociationsJohn is Mary’s father. Mary is John’sdaughter.Bob is Mary’s dog. Mary is Bob’s owner.Ann is John’s employer. John is Ann’semployee.4Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 299Objects and AssociationsMaryJohnBobAnnchild fatheremployeeemployerownerpetObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 300Classes and AssociationsPersonDogAnimalchildfatheremployeeemployerownerpet5Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 301Objects and AttributesJohn’s name is "John PatrickO’Brian".John’s age is 27.John’s address is 987 N. Oak St,Champaign IL 61820What about John’s employer?John’s wife?Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 302Objects and AttributesJohnname: "John Patrick O’Brian"age: 27address: ...6Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 303Objects and BehaviorJohn can earn money by working for hisemployer.John fills out time-cards.John takes vacations.Employer gives John a paycheck.John spends money to gain morepossessions.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 304fill out time-cardstake vacationsreceive paycheckbuy/spendmake reservationstravelcheck inJohn7Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 305Event DiagramsPersonTravel AgentAirlineHotelreservereservepayreserveCheck intravelpaypayreservepaytravelCheck inObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 306What Really is an Object?Reservation -- a promise to giveservice to a customerTicket -- record that customer haspaid for service in advanceFlightPayment -- an event (transaction?) inwhich money is exchanged8Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 307In fact, anything we can talk about can bean object, including associations ("thehusband of the first party", "first-bornson").The important question is what we aretrying to model.Models should be as simple as possible,but no simpler.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 308Why this is importantMany of the objects in a good designare NOT problem domain objects.They can represent operations,processes, states, constraints,relationships, ...9Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 309Design for ReusePurpose is to make a system flexible,extensible, and easily changed.Make things objects if they need to bechanged and manipulated.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 310Design for ReuseGoal is to build an application just byusing preexisting objects.• Compose, don't program.Relationship between objects asimportant as class hierarchy.10Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 311To Be or Not To Be --- A ClassAnalysis model shouldn’t containimplementation-specific objects likequeues and lists.Classes should be• unique• relevant• specificObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 312To Be or Not To Be --- A ClassOperations should not be objects unlessyou need to manipulate them.• A Call in a telephone billing systemhas attributes such as date anddestination phone number, and mustbe stored so it can be printed on themonthly bill.11Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 313The name of a class should represent itsintrinsic nature and not a role that itplays in an association.• A person can have many roles whenassociated with a car: owner,passenger, driver, lesee.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 314What is an OO Model?A OO model is a model expressed in terms ofobjects, classes, and the relationshipsbetween them.Models can be written in programminglanguages, graphics, or English.12Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 315OMTgraphical OO modeling notation with threeparts• object model• dynamic model (event trace/statemachines)• functional model (data flow diagram)Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 316Object ModelObject, classes,attributes,operations, associations,inheritanceMammalPersonagebuy, sell,feedDogloudness, pricebarkownerpet13Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 317Multiplicity of Associations• exactly one• zero or more• zero or one• one or more• otherClassClassClass1+1-2, 4Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 318Dynamic ModelRecord order of events, dynamic interaction between objects.DogPersonDoorEvent TraceState Machinebarkopennotifygo thru doornotifycloseregisterregisterNeed to Leavedo: register with doordo: bark at personLeavingdo: unregisterdo: go through doordo: notify dependentsunregisternotify14Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 319Design vs. AnalysisUse of objects integrates design andanalysis.• advantages - easier to move fromone to the other• disadvantages - harder to tell whichyou are doingObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 320Analysis vs. DesignAnalysis produces documents thatcustomer can understand.Design produces documents thatprogrammers can


View Full Document

UIUC CS 497 - Design

Download Design
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 Design 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 Design 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?