Object-Oriented Systems Analysis and Design Using UML

Object-Oriented Systems Analysis and Design Using UML

Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design, 8e Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Concepts Objects Classes Inheritance

Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-2 Diagrams Structural diagrams Used to describe the relation between classes Behavior diagrams Used to describe the interaction between people (actors) and a use

case (how the actors use the system) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-3 Structural Diagrams Class diagrams

Object diagrams Component diagrams Deployment diagrams Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-4 Behavioral Diagrams

Use case diagrams Sequence diagrams Collaboration diagrams Statechart diagrams Activity diagrams Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-5 Commonly Used UML

Diagrams Use case diagram Describing how the system is used The starting point for UML modeling Use case scenario A verbal articulation of exceptions to the main behavior described by the primary use case Activity diagram Illustrates the overall flow of activities Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall

7-6 Commonly Used UML Diagrams (Continued) Sequence diagrams Show the sequence of activities and class relationships. Class diagrams Show classes and relationships. Statechart diagrams Show the state transitions.

Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-7 An Overview of UML Diagrams Showing How Each Diagram Leads to the Development of Other UML Diagrams (Figure 10.5) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-8

Use Case Modeling Describes what the system does, without describing how the system does it Based on the interactions and relationships of individual use cases Use case describes Actor Event Use case Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall

7-9 A Use Case Example of Student Enrollment (Figure 10.6) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-10 A Use Case Scenario Is Divided into Three Sections: Identification and Initiation, Steps Performed, and Conditions, Assumptions, and Questions (Figure 10.7)

Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-11 Activity Diagrams Show the sequence of activities in a process, including sequential and parallel activities, and decisions that are made. Symbols

Rectangle with rounded ends Arrow Diamond Long, flat rectangle Filled-in circle Black circle surrounded by a white circle Swimlanes Kendall & Kendall

Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-12 Specialized Symbols Are Used to Draw an Activity Diagram (Figure 10.8) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-13 Creating Activity Diagrams

Created by asking what happens first, what happens second, and so on Must determine what activities are done in sequence or in parallel The sequence of activities can be determined from physical data flow diagrams. Can be created by examining all the scenarios for a use case Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-14

Swimlanes Useful to show how the data must be transmitted or converted Help to divide up the tasks in a team Makes the activity diagram one that people want to use to communicate with others Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-15 This Activity Diagram Shows Three Swimlanes:

Client Web Page, Web Server, and Mainframe (Figure 10.9) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-16 Activity Diagrams and Test Plans Activity diagrams may be used to construct test plans. Each event must be tested to see if the system goes to the next

state. Each decision must be tested. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-17 Activity Diagrams Not Created for All Use Cases Use an activity diagram when: It helps to understand the activities of a use case The flow of control is complex

There is a need to model workflow When all scenarios for a use case need to be shown Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-18 Sequence Diagrams Illustrate a succession of interactions between classes or object instances over time Often used to show the processing

described in use case scenarios Used to show the overall pattern of the activities or interactions in a use case Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-19 Specialized Symbols Used to Draw a Sequence Diagram (Figure 10.10) Kendall & Kendall

Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-20 A Sequence Diagram for Student Admission: Sequence Diagrams Emphasize the Time Ordering of Messages (Figure 10.11) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-21

Communication Diagrams Describes the interactions of two or more things in the system that perform a behavior that is more than any one of the things can do alone Shows the same information as a sequence diagram, but may be more difficult to read Emphasizes the organization of objects Made up of objects, communication links, and the messages that can be passed along those links Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall

7-22 A Communication Diagram for Student Admission (Figure 10.12) Communication diagrams show the same information that is depicted in a sequence diagram but emphasize the organization of objects rather than the time ordering. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-23

Class Diagrams Show the static features of the system and do not represent any particular processing. Show the nature of the relationships between classes. Show data storage requirements as well as processing requirements. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-24

Class Diagrams (Continued) Classes Attributes Private Public Protected Methods Standard Custom Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall

7-25 A Class Diagram for Course Offerings: The FilledIn Diamonds Show Aggregation and the Empty Diamond Shows a Whole-Part Relationship (Figure 10.13) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-26 Types of Classes

Entity classes Interface classes Abstract classes Control classes Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-27

Entity Classes Represent real-world items The entities represented on an entity-relationship diagram Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-28 Interface or Boundary Classes Provide a means for users to work with the system.

Human interfaces may be a display, window, Web form, dialogue box, touch-tone telephone, or other way for users to interact with the system. System interfaces involve sending data to or receiving data from others. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-29

Abstract Classes Linked to concrete classes in a generalization/specialization relationship Cannot be directly instantiated Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-30 Control Classes Used to control the flow of activities

Many small control classes can be used to achieve classes that are reusable. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-31 A Sequence Diagram for Using Two Web Pages: One for Student Information, One for Course Information (Figure 10.15 )

Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-32 Create Sequence Diagrams Include the actor from the use case diagram. Define one or more interface classes for each actor. Each use case should have one control class. Examine the use case to see what entity classes are required.

The sequence diagram may be modified when doing detailed design. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-33 Creating a Test Plan from a Sequence Diagram Does each method return correct results? Ensure that entity classes store or obtain the correct attribute values.

Verify that all JavaScript paths work correctly. Ensure that the server control classes work correctly. Ask, What may fail? Determine what to do if something can Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-34 Generalization/Specialization Diagrams

Generalization Inheritance Polymorphism Abstract classes Messages Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall

7-35 Generalization Describes a relationship between a general kind of thing and a more specific kind of thing Described as an is a relationship Used for modeling class inheritance and specialization General class is a parent, base, or superclass Specialized class is a child, derived, or subclass Kendall & Kendall

Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-36 Inheritance Helps to foster reuse Helps to maintain existing program code Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-37

Polymorphism The capability of an object-oriented program to have several versions of the same method with the same name within a superclass/subclass relationship The subclass method overrides the superclass method. When attributes or methods are defined more than once, the most specific one is used. Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-38

Abstract Classes Abstract classes are general classes. No direct objects or class instances, and is only used in conjunction with specialized classes Usually have attributes and may have a few methods Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-39

A Generalization/Specification Diagram Is a Refined Form of a Class Diagram (Figure 10.20) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-40 Statechart Diagrams Used to examine the different states that an object may have Created for a single class

Objects are created, go through changes, and are deleted or removed. Objects States Events Signals or asynchronous messages Synchronous Temporal events Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-41

Statechart Diagrams (Continued) Created when: A class has a complex life cycle. An instance of a class may update its attributes in a number of ways through the life cycle. A class has an operational life cycle. Two classes depend on each other. The objects current behavior depends on what happened previously. Kendall & Kendall

Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-42 A Statechart Diagram Showing How a Student Progresses from a Potential Student to a Graduated Student (Figure 10.22) Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall 7-43

Recently Viewed Presentations