Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc....

19
Structural Modeling Structural Modeling Chapter 7 Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash

Transcript of Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc....

Page 1: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Structural ModelingStructural Modeling

Chapter 7Chapter 7

Alan Dennis, Barbara Wixom, and David Tegarden

John Wiley & Sons, Inc.

Slides by Fred NiedermanEdited by Solomon Negash

Page 2: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 2

Key Ideas

A structural or conceptual model describes the structure of the data that supports the business processes in an organization..The structure of data used in the system is represented through CRC cards, class diagrams, and object diagrams.

Page 3: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 3

Purpose of Structural Models

Reduce the “semantic gap” between the real world and the world of softwareCreate a vocabulary for analysts and usersRepresent things, ideas, and concepts of importance in the application domain

Page 4: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 4

Classes

Templates for creating instances or objects

ConcreteAbstract

Classes represent real world thing. Typical examples include:

Application domain, user interface, data structure, file structure, operating environment, document, and multimedia classes

Page 5: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 5

Attributes & Operations

AttributesUnits of information relevant to the description of the classOnly attributes important to the task should be included

Operations (Methods)Action that instances/objects can takeFocus on relevant problem-specific operations (at this point)

Page 6: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 6

Relationships

GeneralizationEnables inheritance of attributes and operations. Generalization is represented with a-kind-of relationshipExample: we say an employee is a-kind-of-person

AggregationRelates parts to wholesAggregation represents: a-part-of, a-member-of, contained-in, related-to, and associated-with

AssociationOther relationships that do not neatly fit into generalization (a-kind-of) or aggregation (a-part-of)

Page 7: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 7

Your Turn

What classes, attributes, and operations that would be required to describe the process of registration for campus housing?

Page 8: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 8

Responsibilities and Collaborations

ResponsibilitiesKnowing responsibilities are those things that an instance of a class must be capable of knowing

An instance typically knows the values of its attributes and its relationships

Doing responsibilities are those things that an instance of a class must be capable of doing.

An instance of a class can execute its operations, or it can request a second instance

CollaborationObjects working together to service a request

Page 9: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 9

A CRC Card

Front: Class name: ID: Type:

Description:

Responsibilities : Collaborators:

Back:

Attributes:

Relationships:

Generalization (a-kind-of):

Aggregation (has-parts):

Other Associations:

Page 10: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 10

Example Class Diagram

Page 11: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 11

Class Diagram Syntax

A CLASS

AN ATTRIBUTE

AN OPERATION

AN ASSOCIATION

Class 1

-attribute

+operation ()

Attribute name/derived attribute name

operation name ()

1..* 0..1______verb phrase____

Page 12: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 12

More on Attributes

Derived attributes/age, for example can be calculated from birth date and current date

VisibilityPublic (+)Protected (#)Private (-)

Page 13: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 13

Operations & Relationships

More operationsConstructor

Creates object

Query Makes information about state available

Update Changes values of some or all attributes

More RelationshipsClass can be related to itself (role)Multiplicity

Exactly one, zero or more, one or more, zero or one, specified range, multiple disjoint ranges

Association class

Page 14: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 14

Object Identification

Simplifying class diagramsThe view mechanism shows a subset of informationPackages show aggregations of classes (or any elements in UML)

Object identification1. Textual analysis of use-case information

Nouns suggest classes Verbs suggest operations Creates a rough first cut

2. Common object list Incidents Roles

3. Patterns

Page 15: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 15

Object Diagrams

Page 16: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 16

Patterns

Useful groupings of classes that recur in various situationsTransactions

Transaction classTransaction line item classItem classLocation classParticipant class

Page 17: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 17

Steps for Object Identification and Structural Modeling

1. Create CRC cards by performing textual analysis on the use-cases.

2. Brainstorm additional candidate classes, attributes, operations, and relationships by using the common object list approach.

3. Role-play each use-case using the CRC cards.

4. Create the class diagram based on the CRC cards.

5. Review the structural model for missing and/or unnecessary classes, attributes, operations, and relationships.

6. Incorporate useful patterns.

7. Review the structural model.

Page 18: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Create CRC cards.Examine common object lists.Role-play the CRC cards.Create the class diagram.Review the class diagram.Incorporate patterns.Review the model.

Term project

Page 19: Structural Modeling Chapter 7 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by Solomon Negash.

Slide 19

Summary

CRC cards capture the essential elements of a class.Class and object diagrams show the underlying structure of an object-oriented system.Constructing the structural model is an iterative process involving: textual analysis, brainstorming objects, role playing, creating the diagrams, and incorporating useful patterns.

Reference for CRC cards:http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/crc_b/