CEN 4010 Class 5 0913 Introduction to Unified

  • Slides: 22
Download presentation
CEN 4010 Class 5 – 09/13 Introduction to Unified Modeling Language (UML) cont •

CEN 4010 Class 5 – 09/13 Introduction to Unified Modeling Language (UML) cont • • • Project Review - Classes 4 Diagrams – – • • • statechart activity Modeling Concepts More on Diagrams Rational Rose Note: See example the course home page. CENuse 4010 case Class on 5 - 09/13

Overview of UML cont • There are four kinds of relationships in UML: 1.

Overview of UML cont • There are four kinds of relationships in UML: 1. 2. 3. 4. • • Dependency Association Generalization Realization Dependency (between two things) – a change to one thing may affect the semantics of the other thing. Association – describes links i. e. , a connection among objects. CEN 4010 Class 5 - 09/13 2

Overview of UML cont • • Generalization (specialization/generalization) – objects of a specialized element

Overview of UML cont • • Generalization (specialization/generalization) – objects of a specialized element (the child) are substitutable for object of the generalized element (the parent). Realization – a semantic relationship between classifiers, i. e. , a classifier (interface) specifies a contract to be carried out by another classifier (class). CEN 4010 Class 5 - 09/13 3

Example of Use Case Diagram Simple. Watch. User Read. Time Set. Time Watch. Repair.

Example of Use Case Diagram Simple. Watch. User Read. Time Set. Time Watch. Repair. Person Use case diagram describing the functionality of a simple watch. Change. Battery CEN 4010 Class 5 - 09/13 4

Example of Class Diagram Simple. Watch 1 2 Push. Button Class Structure <class name>

Example of Class Diagram Simple. Watch 1 2 Push. Button Class Structure <class name> <attributes> <operations> 1 Display 1 1 1 2 1 Battery Time Details of the Time class CEN 4010 Class 5 - 09/13 5

Example of a Sequence Diagram Set_minutes use case CEN 4010 Class 5 - 09/13

Example of a Sequence Diagram Set_minutes use case CEN 4010 Class 5 - 09/13 6

UML Diagrams - Statechart • A statechart diagram shows a state machine that describes

UML Diagrams - Statechart • A statechart diagram shows a state machine that describes the behavior of an individual object. A state machine consists of states, transitions, events (things that trigger a transition), and activities (the response to a transition). • Statecharts focus on the external events that result in an object changing state. • Useful when modeling reactive systems. • Very useful when validating the specification of a system. CEN 4010 Class 5 - 09/13 7

Example of Statechart Diagram Statechart diagram for the Set. Time use case. CEN 4010

Example of Statechart Diagram Statechart diagram for the Set. Time use case. CEN 4010 Class 5 - 09/13 8

UML Diagrams - Activity • An activity diagram is a special kind of statechart

UML Diagrams - Activity • An activity diagram is a special kind of statechart diagram that shows the flow from activity to activity within a system. • Used to model the functionality of the system w. r. t. the flow of control among objects. • Activities are states that represent the execution of a set of operations. CEN 4010 Class 5 - 09/13 9

Example of an Activity Diagram CEN 4010 Class 5 - 09/13 10

Example of an Activity Diagram CEN 4010 Class 5 - 09/13 10

Modeling Concepts • System – an organized set of communicating parts designed for a

Modeling Concepts • System – an organized set of communicating parts designed for a specific purpose, or – a purposeful collection of components that work together to achieve some objective. • Subsystem – part of a system. Subsystems can usually operate as independent systems in their own right. • A component is a physical and replaceable part of a system that conforms to and provides the realization for a set of interfaces. CEN 4010 Class 5 - 09/13 11

Modeling Concepts cont • Modeling is a means for dealing with the complexity of

Modeling Concepts cont • Modeling is a means for dealing with the complexity of systems and subsystems. • A rule of thumb is that each entity in a model should contain at most 7 +/- 2 parts. [Miller, 1959] • A view focuses on a subset of a model to make it understandable. • Logical view – used to visualize, specify, and document your decisions about the vocabulary of your domain and the structural and behavioral way things collaborate. CEN 4010 Class 5 - 09/13 12

Modeling Concepts cont • Physical view – used to construct the executable system. •

Modeling Concepts cont • Physical view – used to construct the executable system. • Logical things live in the conceptual world, the physical things live in the world of bits i. e. , they can be executed on a machine. • Note, in UML several logical views are carried over to their physical counterparts. E. g. , an interface for a class (logical model) is carried over to the physical component that realizes it. CEN 4010 Class 5 - 09/13 13

Modeling Concepts cont • Terms: – – data type, abstract data type instance, object,

Modeling Concepts cont • Terms: – – data type, abstract data type instance, object, class operations, attributes generalization, superclass, subclass, abstract class, • Falsification – Process of demonstrating that relevant details have been incorrectly represented or not represented at all. Contradiction! • Prototyping. CEN 4010 Class 5 - 09/13 14

More Use Case Diagrams • Recall: – Actors are external entities that interact with

More Use Case Diagrams • Recall: – Actors are external entities that interact with the system. E. g. , ATM user, bank teller, authentication server, central database. – Use cases describe the behavior of the system as seen from an actor’s point of view. • Use case characteristics: – describes a function provided by the system as a set of events that yields a visible result for the actors. – actors initiate a use case to access system functionality. CEN 4010 Class 5 - 09/13 15

More Use Case Diagrams cont • Use case characteristics cont: – use cases can

More Use Case Diagrams cont • Use case characteristics cont: – use cases can initiate other use cases. – actors and use cases communicate i. e. , exchange information. • We will use the use case template provided on the web page. (Go through sections of template) • A scenario is an instance of a use case describing a concrete set of actions. • Use cases describe all possible cases. CEN 4010 Class 5 - 09/13 16

More Use Case Diagrams cont • A solid line in a use case diagram

More Use Case Diagrams cont • A solid line in a use case diagram represents the communication between an actor and a use case. • In real applications some use cases are part of several other use cases. This is denoted by the <<include>> relationship. • A use can extend another use case by adding events. This is denoted by the <<extend>> relationship. • A use can specialize a more general one by adding more detail. CEN 4010 Class 5 - 09/13 17

More Use Case Diagrams cont Pages 47 -51 in text. Examples: <<extend>> Logon Update

More Use Case Diagrams cont Pages 47 -51 in text. Examples: <<extend>> Logon Update user info <<include>> Validate user Authenticate with. Password Track order General use case Authenticate with. Card Specialize use cases CEN 4010 Class 5 - 09/13 18

More Class Diagrams • Notation conventions: – Object names are underlined. – Class names

More Class Diagrams • Notation conventions: – Object names are underlined. – Class names start with an uppercase letter. – Object names are unique. • A link represents a connection between two objects. • An object diagram shows a set of objects and their relationships. (Requirements analysis) • A relationship is a connection among things. CEN 4010 Class 5 - 09/13 19

More Class Diagrams cont • A dependency is a using relationship that states a

More Class Diagrams cont • A dependency is a using relationship that states a change in specification of one thing may affect another thing that uses it, but not necessarily the reverse. [Booch ’ 99] Department Dependency relationship name: string ssn. List: string Employee update(emp: Employee) print. List() CEN 4010 Class 5 - 09/13 20

More Class Diagrams cont • A generalization is a relationship between a general thing

More Class Diagrams cont • A generalization is a relationship between a general thing (superclass or parent) and a more specific kind of thing (subclass or child). A. k. a “is-a-kind-of” relationship. Note objects of the child maybe used anywhere the parent may appear, but not the reverse. [Booch ’ 99] • A child inherits the properties of it parents. • An operation of the child that has the same signature as an operation of the parent overrides the operation of the parent. CEN 4010 Class 5 - 09/13 21

More Class Diagrams cont Employee ssn: string name: string base class get. Name(): string

More Class Diagrams cont Employee ssn: string name: string base class get. Name(): string get. SSN(): string Manager Clerk mang. ID: string get. Mang. ID(): string derived classes station: int get. Station(): int CEN 4010 Class 5 - 09/13 22