Kiến trúc máy tính và hợp ngữ - Chapter 6: Structural modeling
Describe how classes relate to one another
Three basic types in UML
Generalization
Enables inheritance of attributes and operations
Aggregation
Relates parts to wholes
Association
Miscellaneous relationships between classes
27 trang |
Chia sẻ: huyhoang44 | Lượt xem: 1018 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Kiến trúc máy tính và hợp ngữ - Chapter 6: Structural modeling, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Chapter 6:Structural ModelingObjectivesUnderstand 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 between the structural and use case models.Structural ModelA formal way of representing the objects that are used and created by a business systemPeoplePlacesThingsDrawn using an iterative processFirst drawn in a conceptual, business-centric wayThen refined in a technology-centric way describing the actual databases and filesSTRUCTURAL MODELSStructural ModelsMain goal: to discover the key data contained in the problem domain and to build a structural model of the objectsProblem DomainSolution DomainStructuralModelingA Common LanguageStructural models create a well-defined vocabulary shared by users and analystsClasses created during analysis are not the classes that programmers develop during implementationThis refinement comes laterTypical structural models:CRC cardsClass (and Object) diagramsClasses, 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 performRelationshipsDescribe how classes relate to one anotherThree basic types in UMLGeneralization Enables inheritance of attributes and operationsAggregationRelates parts to wholesAssociationMiscellaneous relationships between classesCRC CARDSResponsibilities & CollaborationsResponsibilitiesKnowingDoingCollaborationObjects working together to service a requestFront-Side of a CRC CardBack-Side of a CRC CardCLASS DIAGRAMSElements of a Class DiagramAttribute VisibilityAttribute visibility can be specified in the class diagramPublic attributes (+) are visible to all classesPrivate attributes (-) are visible only to an instance of the class in which they are definedProtected attributes (#) are like private attributes, but are also visible to descendant classesVisibility helps restrict access to the attributes and thus ensure consistency and integrityOperationsConstructorCreates objectQueryMakes information about state availableUpdateChanges values of some or all attributesMore Elements of Class DiagramsMultiplicitiesDepartmentBossEmployeeChildBossEmployee1110..*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 employeesMore MultiplicitiesEmployeeSpouseEmployeeVacationEmployeeCommittee10..112..411..3, 5Zero or one:An employee can be married to 0 or 1 spouseSpecified range:An employee can take 2 to 4 vacations each yearMultiple disjoint ranges:An employee can be in 1 to 3 or 5 committeesSample Class DiagramSimplifying 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)Object DiagramsCREATING CRC CARDS AND CLASS DIAGRAMSObject IdentificationTextual analysis of use-case informationNouns suggest classesVerbs suggest operationsCreates a rough first cutCommon object listIncidentsRolesPatternsUseful groupings of classes that recur in various situationsTransactionsTransaction classTransaction line item classItem classLocation classParticipant class7 Steps to Structural ModelsCreate CRC CardsExamine common object listsRole-play the CRC cardsCreate the class diagramReview the class diagramIncorporate patternsReview the modelSummaryStructural ModelsCRC CardsClass DiagramsCreating CRC Cards and Class Diagrams
Các file đính kèm theo tài liệu này:
- ch06_4517.ppt