ch05

download ch05

of 28

Transcript of ch05

Chapter 2: Project Selection & Management

Chapter 5:Structural ModelingPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.1ObjectivesUnderstand the rules and style guidelines for creating CRC cards, class diagrams, and object diagrams.Understand the processes used to create CRC cards, class diagrams, and object diagrams.Be able to create CRC cards, class diagrams, and object diagrams.Understand the relationship among structural models.Understand the relationship between structural and functional models.PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.IntroductionFunctional models represent system behaviorStructural models represent system objects and their relationships:PeoplePlacesThings

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Structural ModelsDrawn using an iterative processFirst drawn in a conceptual, business-centric wayThen refined in a technology-centric way describing the actual databases and filesMore and more detail is added in each iterationCreate a vocabulary for analysts & usersAllows effective communication between analysts & usersPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Structural ModelsMain goal: to discover the key data contained in the problem domain and to build a structural model of the objects

Problem DomainSolution Domain

StructuralModeling

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Classes, Attributes, & OperationsClassesTemplates for instances of people, places, or thingsAttributesProperties that describe the state of an instance of a class (an object)OperationsActions or functions that a class can perform

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.RelationshipsDescribe how classes relate to one anotherThree basic types in UMLGeneralizationEnables inheritance of attributes and operationsRepresents relationships that are a-kind-ofAggregationRelates parts to wholes or assembliesRepresents relationships that are a-part-of or has-parts AssociationMiscellaneous relationships between classesUsually a weaker form of aggregationPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Object IdentificationTextual analysis of use-case informationNouns suggest classesVerbs suggest operationsCreates a rough first cut to provide an object listBrainstormingpeople offering ideasInitial list of classes (objects) is developedAttributes, operations and relationships to other classes can be assigned in a second roundPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Object Identification (cont.)Common Object ListsPhysical thingsIncidentsRolesInteractionsPatternsUseful groupings of collaborating classes that provide solutions to common problems (are reusable)Developed patterns provide a starting point for work in similar domainsPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.CRC CardsIndex cards used to document the responsibilities and collaborations of a classResponsibilitiesKnowingwhat a class must know manifested as attributesDoingwhat a class must do manifested later as operationsCollaborationObjects working together to service a request:Requestor (client)Responder (server)Bound by a contractPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Front-Side of a CRC Card

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Back-Side of a CRC Card

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.CRC Cards & Role-PlayingAn exercise to help discover additional objects, attributes, relationships & operationsTeam members perform roles associated with the actors and objects previously identifiedUtilize activity diagrams to run through the steps in a scenarioIdentify an important use-caseAssign roles based on actors and objectsTeam members perform each step in the scenarioDiscover and fix problems until a successful conclusion is reachedRepeat for remaining use-cases

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Class DiagramsA static model that shows classes and their relationships to one anotherElementsClassesObjects within the system (a person, place or thing)Stores and manages information in the system and contains:Attributescharacteristics of the classOperationsactivities the class can performRelationshipsthe associations between classesDepicted as lines between classesMultiplicity indicates how many of one object is/are associated with other objectsPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.AttributesProperties of a classPerson: last name, first name, address, etc.Attributes can be derivedPreceded with a slash (/) e.g., age is derived from date of birthVisibility of an attribute:Restricts access to attributes to ensure consistencyPublic attributes (+): visible to all classesPrivate attributes (-): visible only to an instance of the class in which they are definedProtected attributes (#): visible only to an instance of the class in which they are defined and its descendants

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.OperationsCommon operations are not shownCreate or delete an instanceReturn or set a valueTypes of operations:Constructorcreates an objectQuerymakes information about the state of an object availableUpdatechanges values of some or all of an objects attributesDestructordeletes or removes an object

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.RelationshipsDenotes associations between classesDepicted with a line labeled with the name of the relationshipMay be directional (depicted with a triangle; e.g., a patient schedules an appointment)Classes may be related to themselves (e.g., employees and managers who may be members of the same class)Multiplicity indicates how many of one class are related to another classPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.MultiplicitiesDepartmentBossEmployeeChildBossEmployee1110..*11..*Exactly one:A department has one and only one bossZero or more:An employee has zero to many childrenOne or more:A boss is responsible for one or more employeesPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Association ClassesCommon in many-to-many relationshipsUsed when attributes about the relationship between two classes needs to be recordedStudents are related to courses; a Grade class provides an attribute to describe this relationshipIllnesses are related to symptoms; a Treatment class provides an attribute to describe this relationship

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Generalization & Aggregation AssociationsGeneralization denotes inheritanceProperties and operations of the superclass are valid for the sub-classDepicted as a solid line with a hollow arrow pointing at the superclassAggregation denotes a logical a-part-of relationshipComposition denotes a physical a-part-of relationshipPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Sample Class Diagram

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Simplifying Class DiagramsFully populated class diagrams of real-world system can be difficult to understandCommon ways of simplifying class diagrams:Show only concrete classesThe view mechanism shows a subset of classesPackages show aggregations of classes (or any elements in UML)

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Object DiagramsClass diagrams with instantiated classesExample: instead of a Doctor class, create an actual doctor, say Dr. SmithPlace values into each attributeUsed to discover additional attributes, relationships and/or operations or those that are misplacedPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Example Object Diagram

PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.7 Steps to Structural ModelsCreate CRC CardsReview CRC Cards & identify missing objects, attributes, operations and/or relationshipsRole-play the CRC cardslook for breakdowns & correct; create new cards as necessaryCreate the class diagramReview the class diagramremove unnecessary classes, attributes, operations and/or relationshipsIncorporate patternsReview and validate the modelPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Verifying & Validating the ModelAnalyst presents to developers & usersWalks through the modelProvides explanations & reasoning behind each classRulesEach CRC card is associated with a classResponsibilities on the front of the card are included as operations on the class diagramCollaborators on the front of the card imply a relationship on the back of the cardAttributes on the back of the card are listed as attributes on the class diagramPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.Rules for Validating & Verifying the Model (cont.)Attributes on the back of the CRC card each have a data type (e.g., salary implies a number format)Relationships on the back of the card must be properly depicted on the class diagramAggregation/AssociationMultiplicityAssociation classes are used only to include attributes that describe a relationshipPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.SummaryStructural ModelsCRC CardsClass DiagramsCreating CRC Cards and Class DiagramsPowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th EditionCopyright 2015 John Wiley & Sons, Inc. All rights reserved.