Upload
nasya
View
55
Download
4
Embed Size (px)
DESCRIPTION
Object-oriented modeling UML diagrams. Karolina Muszyńska. Based on : http://www.csun.edu/~dn58412/IS431/IS431_SP13.html G. Schneider , J.P. Winters „Stosowanie przypadków użycia” S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”. Object Modeling. - PowerPoint PPT Presentation
Citation preview
Object-oriented modeling
UML diagrams
Karolina Muszyńska
Based on: http://www.csun.edu/~dn58412/IS431/IS431_SP13.html G. Schneider , J.P. Winters „Stosowanie przypadków użycia” S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu
SI”
Why Object Modeling? Object Concepts
◦Class/Object, Attribute, Behavior, Inheritance, Encapsulation, Message, Polymorphism
Genesis of UML UML Diagrams for Object-Oriented
Analysis◦Use Case Diagrams
2
Object Modeling
Object modeling is a technique for identifying objects within the systems environment and the relationships between those objects.
Object-oriented analysis (OOA) techniques are used to (1) study existing objects to see if they can be reused or adapted for new uses, and (2) define new or modified objects that will be combined with existing objects into a useful business computing application.
The Unified Modeling Language (UML) is a set of modeling conventions (notations) to specify or describe a software system in terms of objects.
3
Object Modeling
Benefits:◦ Break a complex system into manageable
components◦ Create reusable components can be plugged
into other systems or use them as starting points for other projects
◦ “Object-think” is more realistic !!!
4
Object Modeling
An object is something that is or is capable of being seen, touched, or otherwise sensed, and about which users store data and associate behavior.
A class is a set of objects that share common attributes and behavior. A class is also referred to as an object class.
Attributes are the data that represent characteristics of interest about an object.
An instance (or object instance) of an object consists of the values for the attributes that describe a specific person, place, thing, or event.
5
Object Concepts
6
Classes, Objects, Attributes, & Instances
custNo lastName firstName phone street city state
custNo:123 lastName:Doe firstName:Joe phone:1234567 street:AnyStreet city:AnyCity state:AnyState
custNo:234 lastName:Green firstName:Mary phone:3456789 street:OtherStreet city:OtherCity state:OtherState
Doe:CustomerCustomer Green:Customer
changeAddress() changeAddress() changeAddress()
7
Object Concepts … Behavior (method, service) refers to those
activities that the object can do and which correspond to functions that act on the object’s data (or attributes).
Encapsulation is the packaging of data and method together. It shields the internal working of the object from the changes in the outside system. It keeps the system from being affected when changes are made to objects. It is the key to reusability.
All an object needs to know is the set of methods that other objects can perform and what message need to be sent to trigger them.
8
Common Methods Constructor to create a new instance of a class Query to access and get info about the state of
an object but does not alter the state Update to alter the state of an object and
change the value of its attribute(s).
A class supertype is an object class whose instances store attributes that are common to one or more class subtypes of the object.
A class subtype is an object class whose instances inherit some common attributes from a class supertype, and then add other attributes that are unique to an instance of the subtype.
Inheritance means that methods and/or attributes defined in an object class (superclass) can be inherited or reused by another object classes (subclasses).
9
Supertypes & Subtypes
10
Generalization - SpecializationEmployeeName DOB SSN
DateHire CalSeniority()
Executive
Position Location DateAppoint Salary
Update()
ForepersonFactory Station DateAppoint
Wage Rate Update()
WorkerFactory Station Machine Wage Rate
Insert ()
Message is the information passed when one object invokes one or more of another object's methods (behaviors) to request information or some action
11
Object Concepts …
Customer
Order
OrderNo OrderDate OrderStatus
add() change() displayStatus()
displayStatus(123)
Polymorphism means “many forms.” In object-oriented techniques, it means that the same message can be interpreted (and a behavior may be completed) differently by different objects/classes.◦ Methods of the same name in different classes.◦ Methods of the same name (but different
parameters) in the same class◦ Insert(customer) is different from
insert(inventory-item) as different info need to be collected and stored.
12
Object Concepts …
Methodological storm in object-oriented solutions (1989-94)◦ over 50 various object-oriented methods/solutions
Unified Modeling Language (UML)◦ Third generation OO method◦ An attempt to combine advantages of previous
methods Basis for the UML standard
◦ Object Modeling Technique (J. Rumbaugh) – UML diagrams notation, analysis and design
◦ Object Oriented Analysis and Design (G. Booch) – analysis and design
◦ Object Oriented Software Engineering (I. Jacobson) – business modeling, use cases
13
Genesis of UML
14
UML Diagrams
Structure diagrams. A type of diagram that depicts the elements of a specification that are irrespective of time. This includes class, object, package, composite structure diagrams and implementation diagrams: component and deployment diagrams.
Behavior diagrams. A type of diagram that depicts behavioral features of a system or business process. This includes activity, state machine, and use case diagrams as well as the four interaction diagrams.
Interaction diagrams. A subset of behavior diagrams which emphasize object interactions. This includes sequence, communication, interaction overview, and timing diagrams.
15
UML Diagrams
Modeling the functions of the system (with a use case diagram).
Modeling the objects within the scope of the system and their relationships (with class and object diagrams for each use case, and then for the integrated system).
Modeling the interactions between objects to complete a function/use case (with a sequence diagram and activity diagram for each use case).
Modeling the behavior / logic of the objects (with a statechart diagram for each complex class).
16
Most common UML Diagrams
17
UML Diagrams
STATECHART DIAGRAM FOR OBJECT “Order”
Enter New Customer
Create New Order
:customer :orderCreate Order
SHIP ORDERCREATE ORDER
ORDER
CUSTOMER
SHIPMENT
USE CASE DIAGRAM CLASS DIAGRAM FOR USE CASE “Create New Order”
SEQUENCE DIAGRAM FOR USE CASE “Create
New Order”
Order Clerk
Order Clerk
:shipment
Create Shipment
Use case modeling is the process of modeling a system’s functions in terms of business events, who initiated the events, and how the system responds to the events.
A use case is a complete sequence of related actions (a scenario), both automated and manual, for the purpose of completing a business function: What the system must do.
An actor represents an external entity that needs to interact with the system to exchange information. An actor is a user, a role, which could be an external system as well as a person.
A temporal event is a system event that is triggered by time. (The actor of a temporal event use case is time.)
18
Use Case Modeling
Use Case Diagram is a functional description (use cases, actors) of the entire system: functions being supported by the system
Use Case Diagram does NOT indicate data flows or flows of information in and out the system (they are identified later in interaction diagrams)
19
USE CASE DIAGRAM
An extension use case extends the functionality of an original use case to add new behaviors or actions to the basic course. An extension use case can only be invoked by the use case it is extending.
An abstract use case contains typical course steps that were common to two or more original use cases. An abstract use case reduces redundancy and promotes reuse.
20
Extension and Abstract Use Cases
“Class registration” is the basic course of actions.On special occasions, “Registration for special classes” and/or “Insufficient prerequisites” will be invoked.Special cases add new data/behaviors to the normal case.
21
Extension Use Cases(“extend” relationship)
<<extend>> <<extend>>
Class registration
Registration for special classes
Insufficient prerequisites
“Track sales & inventory” includes “Reorder Supplies” and “Generate reports”
22
Abstract Use Cases (“include” relationship)
<<include>>
<<include>>
Track sales & inventory
Reorder supplies
Generate reports
“Place order by telephone” or “Place order via webpage” are possible types of “Place order”“Sales Representative” plays all roles of “Client”
23
Inheritance among Actors or Use Cases
Place order
Place order by telephone
Place order via webpage
Client
Prepare sales reportSales
Representative
CRUD (Create, Read, Update, Delete) type use cases are used when application is meant to store data and one actor interacts with it (e.g. database maintenance, order management, etc.).
24
CRUD Use Cases vs. Individual Use Cases
Place order
Check order status
Cancel order
Client
Administer warehouse state DataBase
Administrator
Salesman
Each use case should include documentation in the form of scenarios
Scenario is a sequence of actions documenting a behavior
Each use case should have at least the main scenario but it is preferable to include the alternative scenarios as well
Both main and alternative scenarios precisely describe the full functionality represented by a use case
Additional important elements of the use case documentation include: pre-conditions and post-conditions
25
Use Case Documentation
Identify actors (look at the sources and destinations of major inputs and outputs)
Identify use cases (major system functions) Identify the system boundary Identify associations between actors and use
cases Identify additional associations between use
cases (“extend”, “include”) Identify inheritance relationships among use
cases and actors
26
Building a Use Case Diagram