220 likes | 270 Views
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 use case on the course home page. Overview of UML cont.
E N D
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 use case on the course home page.
Overview of UML cont • There are four kinds of relationships in UML: • 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
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
WatchUser WatchRepairPerson Example of Use Case Diagram SimpleWatch ReadTime SetTime ChangeBattery Use case diagram describing the functionality of a simple watch. CEN 4010 Class 5 - 09/13
Example of Class Diagram SimpleWatch 1 1 1 1 2 2 1 1 PushButton Display Battery Time Details of the Time class Class Structure <class name> <attributes> <operations> CEN 4010 Class 5 - 09/13
Example of a Sequence Diagram Set_minutes use case CEN 4010 Class 5 - 09/13
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
Example of Statechart Diagram Statechart diagram for the SetTime use case. CEN 4010 Class 5 - 09/13
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
Example of an Activity Diagram CEN 4010 Class 5 - 09/13
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
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
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
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
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
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
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 case can extend another use case by adding events. This is denoted by the <<extend>> relationship. • A use case can specialize a more general one by adding more detail. CEN 4010 Class 5 - 09/13
More Use Case Diagrams cont Pages 47 -51 in text. Examples: <<extend>> Logon Update user info <<include>> Validate user Track order General use case Authenticate Specialize use cases Authenticate withCard Authenticate withPassword CEN 4010 Class 5 - 09/13
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
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] Dependency relationship Department name:string ssnList:string Employee update(emp:Employee) printList() CEN 4010 Class 5 - 09/13
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
More Class Diagrams cont Employee ssn: string name: string base class getName(): string getSSN(): string Manager Clerk mangID: string station: int derived classes getMangID(): string getStation(): int CEN 4010 Class 5 - 09/13