Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.

Similar presentations


Presentation on theme: "Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML."— Presentation transcript:

1 Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML

2 Programming Logic and Design, Fourth Edition, Comprehensive2 Objectives Understand the need for system modeling Describe the UML Work with use case diagrams Use class and object diagrams Use sequence and communication diagrams

3 Programming Logic and Design, Fourth Edition, Comprehensive3 Objectives (continued) Use state machine diagrams Use activity diagrams Use component and deployment diagrams Diagram exception handling Decide which UML diagrams to use

4 Programming Logic and Design, Fourth Edition, Comprehensive4 Understanding the Need for System Modeling Most programs are part of a larger system System design: detailed specification of how all parts of the system are implemented and coordinated Some guidelines: –Large systems are easier to understand when broken down into subsystems –The larger the system, the more important are modeling techniques –Good models promote communication in the development team

5 Programming Logic and Design, Fourth Edition, Comprehensive5 Understanding the Need for System Modeling (continued) Unified Modeling Language (UML) –Popular design tool –Allows you to break a system into subsystems

6 Programming Logic and Design, Fourth Edition, Comprehensive6 What is UML? UML –Standard way to specify, construct, and document systems –Modeling language, not a programming language –Creates top-view diagrams of business processes –Designed to be non-technical in nature

7 Programming Logic and Design, Fourth Edition, Comprehensive7 What is UML? (continued) UML has 13 diagram types in three major categories: –Structure diagrams –Behavior diagrams –Interaction diagrams Each type supports multiple variations

8 Programming Logic and Design, Fourth Edition, Comprehensive8 What is UML? (continued) Structure diagrams: –Class diagrams –Object diagrams –Component diagrams –Composite structure diagrams –Package diagrams –Deployment diagrams

9 Programming Logic and Design, Fourth Edition, Comprehensive9 What is UML? (continued) Behavior diagrams –Use case diagrams –Activity diagrams –State machine diagrams Interaction diagrams: –Sequence diagrams –Communication diagrams –Timing diagrams –Interaction overview diagrams

10 Programming Logic and Design, Fourth Edition, Comprehensive10 Using Use Case Diagrams Use case diagram: –Shows how a business works from the perspective of someone outside the business –Includes users (employees, customers, suppliers) –Represents only the functions that are visible to the system’s actors Analyze the main events in a system to establish use cases

11 Programming Logic and Design, Fourth Edition, Comprehensive11 Using Use Case Diagrams (continued)

12 Programming Logic and Design, Fourth Edition, Comprehensive12 Using Use Case Diagrams (continued) Each use case has at least one main scenario, but may also have more that are variations Three variations in use cases: –Extend –Include –Generalization

13 Programming Logic and Design, Fourth Edition, Comprehensive13 Using Use Case Diagrams (continued) Extend variation –Shows functions beyond those in the base case –Usually an optional activity

14 Programming Logic and Design, Fourth Edition, Comprehensive14 Using Use Case Diagrams (continued) Stereotype: adds more meaning to the UML vocabulary of shapes –Add “ >” near the relationship line

15 Programming Logic and Design, Fourth Edition, Comprehensive15 Using Use Case Diagrams (continued) Include variation: –When a case can be part of multiple use cases –Shown with an oval and a dashed arrow

16 Programming Logic and Design, Fourth Edition, Comprehensive16 Using Use Case Diagrams (continued) Generalization variation: –When you want to substitute a more specific case for a general one –Use open-headed dashed arrows

17 Programming Logic and Design, Fourth Edition, Comprehensive17 Using Use Case Diagrams (continued) Use case diagrams may show multiple actors

18 Programming Logic and Design, Fourth Edition, Comprehensive18 Using Use Case Diagrams (continued) Use case diagrams are only tools to aid communication Keep them visually pleasing and not overcrowded Use separate diagrams for different points of view: –Might emphasize actors and their relationships –Might emphasize actions and hide some of the specific actors to keep it simple

19 Programming Logic and Design, Fourth Edition, Comprehensive19 Using Use Case Diagrams (continued)

20 Programming Logic and Design, Fourth Edition, Comprehensive20 Using Use Case Diagrams (continued)

21 Programming Logic and Design, Fourth Edition, Comprehensive21 Using Class and Object Diagrams Class diagrams: –Illustrate names, attributes, and methods –Are more useful to programmers than users Class diagram is a rectangle with three sections: –Top: name of the class –Middle: names of attributes –Bottom: names of methods

22 Programming Logic and Design, Fourth Edition, Comprehensive22 Using Class and Object Diagrams (continued) Use generalizations with class diagrams to show: –More general (parent) classes –More specific (child) classes that inherit attributes from parents

23 Programming Logic and Design, Fourth Edition, Comprehensive23 Using Class and Object Diagrams (continued) Association relationship: –Describes the connection between objects –May include information about arithmetic relationships such as cardinality or multiplicity –Shown with a straight line between classes

24 Programming Logic and Design, Fourth Edition, Comprehensive24 Using Class and Object Diagrams (continued)

25 Programming Logic and Design, Fourth Edition, Comprehensive25 Using Class and Object Diagrams (continued) Whole-part relationship: –One or more classes make up the parts of a larger whole class –Also called an aggregation –Use open diamond at the “whole part” end of the line –Represents a “has-a” relationship

26 Programming Logic and Design, Fourth Edition, Comprehensive26 Using Class and Object Diagrams (continued)

27 Programming Logic and Design, Fourth Edition, Comprehensive27 Using Class and Object Diagrams (continued) Object diagram –Models specific instances of classes –Shows a snapshot of an object at one point in time Can use class diagrams or object diagrams interchangeably to suit your needs

28 Programming Logic and Design, Fourth Edition, Comprehensive28 Using Class and Object Diagrams (continued)

29 Programming Logic and Design, Fourth Edition, Comprehensive29 Using Sequence and Communication Diagrams Sequence diagram: –Shows timing of events in a single use case –Horizontal axis represents objects –Vertical axis represents time –Vertical dashed line from x-axis to object shows period of time that the object exists –Horizontal arrows show communication between objects over time

30 Programming Logic and Design, Fourth Edition, Comprehensive30 Using Sequence and Communication Diagrams (continued)

31 Programming Logic and Design, Fourth Edition, Comprehensive31 Using Sequence and Communication Diagrams (continued) Communication diagram: –Emphasizes the organization of objects in a system –Contains sequence numbers to show the precise order in which activities occur –Focus on object roles

32 Programming Logic and Design, Fourth Edition, Comprehensive32 Using Sequence and Communication Diagrams (continued)

33 Programming Logic and Design, Fourth Edition, Comprehensive33 Using State Machine Diagrams State machine diagram: –Shows the different statuses of a class or object at different points in time –Use rounded rectangles for each state, and labeled arrows to show sequence of events that affect the state –Solid dot indicates start and stop states for a class or object

34 Programming Logic and Design, Fourth Edition, Comprehensive34 Using State Machine Diagrams (continued)

35 Programming Logic and Design, Fourth Edition, Comprehensive35 Using Activity Diagrams Activity diagrams: –Resemble flowcharts –Show flow of actions in the system –Use flowchart start and stop symbols (lozenges) to describe actions –Use solid dots to show start and stop states –Use diamonds for decisions, with possible outcomes shown along the branches

36 Programming Logic and Design, Fourth Edition, Comprehensive36 Using Activity Diagrams (continued)

37 Programming Logic and Design, Fourth Edition, Comprehensive37 Using Activity Diagrams (continued) Forks and joins: –Used to show simultaneous activities –Indicated by thick straight lines Fork: –Defines a branch in which all paths are followed simultaneously Join: –Reunites the flow of control after a fork

38 Programming Logic and Design, Fourth Edition, Comprehensive38 Using Activity Diagrams (continued)

39 Programming Logic and Design, Fourth Edition, Comprehensive39 Using Activity Diagrams (continued) Time signal: –Indicates that a specific amount of time has passed before an action is started –Shaped like an hourglass

40 Programming Logic and Design, Fourth Edition, Comprehensive40 Using Component and Deployment Diagrams Component diagram: –Used to emphasize files, databases, documents and components used by a system’s software Deployment diagram: –Focuses on a system’s hardware

41 Programming Logic and Design, Fourth Edition, Comprehensive41 Using Component and Deployment Diagrams (continued)

42 Programming Logic and Design, Fourth Edition, Comprehensive42 Using Component and Deployment Diagrams (continued)

43 Programming Logic and Design, Fourth Edition, Comprehensive43 Diagramming Exception Handling Program code uses try-catch blocks to trap errors and handle them Protected node: –A try block in UML –Uses a rounded rectangle –Exceptions that may be thrown are shown as lightning bolts Handler body node: a catch block in UML

44 Programming Logic and Design, Fourth Edition, Comprehensive44 Diagramming Exception Handling (continued)

45 Programming Logic and Design, Fourth Edition, Comprehensive45 Deciding Which UML Diagrams to Use Each type of UML diagram provides a different view of a system No view is superior to the others Most complete picture is achieved by several views UML diagrams are a communication tool

46 Programming Logic and Design, Fourth Edition, Comprehensive46 Summary UML allows programmers and businesspeople to communicate about system design UML has 13 diagram types Use case diagram shows how business works from the standpoint of those who use the business Class diagram illustrates the names, attributes, and methods of a class or set of classes Object diagram models a specific instance of a class at one point in time

47 Programming Logic and Design, Fourth Edition, Comprehensive47 Summary (continued) Sequence diagram shows the timing of events in a single use case Communication diagram shows the organization of objects in a system State machine diagram shows status of a class or object at a specific point in time Activity diagram shows the flow of actions Use forks and joins to depict simultaneous activities

48 Programming Logic and Design, Fourth Edition, Comprehensive48 Summary (continued) Component diagram emphasizes the files, database tables, documents and other components in a system Each diagram represents a different view of the system


Download ppt "Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML."

Similar presentations


Ads by Google