You are on page 1of 62

Lecture five

Object and Class Structuring,


and Dynamic Interaction

11/21/2023 1
I. Object and Class Structuring

11/21/2023 2
Lecture Outline

 Overview of object and class structuring


 Describes modeling application classes and objects
 Overview of object and class structuring categories
 Describes external classes and boundary classes
 Describe the different types of boundary classes and objects
 Describe entity classes and objects
 Describe the different types of control classes and objects
 Describe application logic classes and objects

11/21/2023 3
Object and class Structuring Criteria
 Determining the software objects is the next step after
defining the use cases and developing the static model.
 But there is no one unique way to decompose a system into
objects
 Because the decision is based on the analyst judgment
 Whether objects are in the same class or in a different
class depends on the nature of the problem. Example:
cars, vans and trucks
 In automobile catalog – (object in the same class)
 For vehicle manufacturer – (object of different class)

11/21/2023 4
Object and class Structuring Criteria
 Object and class structuring criteria are provided to assist the
designer in structuring a system into objects.
 Look for real-world objects in the problem domain and then
design corresponding software objects.

 It is necessary to determine what software classes and objects


are needed to realize each use case.
 Before starting dynamic modeling
 The structuring criteria categorize software classes and objects by the roles
they play

11/21/2023 5
Modeling Application Classes and Objects

11/21/2023 Classification of Application classes by Stereotype 6


Object and Class Structuring Criteria
 In this step, classes should be categorized in order to
group together, based on their similar characteristics.
 The categorization in previous slide applies equally to
classes and objects.
 B/c an object is an instance of a class.
 Object has the same stereotype as the classes

11/21/2023 7
Object and class Structuring Categories
 Most applications will have objects from each of the four
categories.
 However, different types of applications will have a
greater number of classes in one or other category.

 Information-intensive systems will have several entity classes


(Static model is so important).
 Real-time systems are likely to have several device I/O
boundary classes. (state-dependent control classes)

11/21/2023 8
Object and class Structuring Categories
 The four main objects and classes categories:
1. Entity Objects: encapsulates information and provides access
to the information it stores
2. Boundary Objects: interfaces to and communicates with the
external environment
 User interaction objects: object that interacts with and interfaces
to a human user
 Proxy objects: object that interfaces to and communicates with an
external system or subsystem
 Device I/O objects: object that receives input from and/or outputs
to a hardware I/O device

11/21/2023 9
Object and class Structuring Categories
 The four main objects and classes categories (Cont..)
3. Control Objects: object that provides the overall coordination
for a collection of objects (reading assignment: read the following
types of control objects)
 Coordinator objects: overall decision maker of all related objects
 State-dependent objects: object whose behaviour varies in each of
its states.
 Timer objects:
4. Application logic Objects: object that contains the details of the
application logic.
To hide the application logic separately from the data
It can be business logic, algorithm and service.

11/21/2023 10
Object and class Structuring Categories
 In most cases, what category an object fits into is usually
obvious.
 However, in some cases, it is possible for an object to
satisfy more than one of the aforementioned criteria.

 Example: an object can have entity object and algorithm


object characteristics.
 In such cases, allocate the object to the category it seems to fit
best.

11/21/2023 11
External Class and Software Boundary Classes
 External classes are classes that are outside the software
system and that interface to the system.
 Boundary classes are classes inside the system that
interface to and communicate with the external classes.
 Consider the external classes to determine the boundary
classes.
 Each of the external classes communicates with a boundary
class.
 There is usually a one-to-one association between the
external class and the internal boundary class.

11/21/2023 12
External Class and Software Boundary Classes
 External classes interface to software boundary classes as
follows:

 An external user class interfaces to and interacts with a user


interaction class.
 An external system class interfaces to and communicates with
a proxy class.

 An external device class provides input to and/or receives


output from a device I/O boundary class.

 An external timer class signals to a software timer class.

11/21/2023 13
Boundary Classes and Objects

 The three different types of boundary classes:

User interaction object.


Proxy objects
Device I/O objects

11/21/2023 14
User Interaction Objects
 Communicates directly with the human user.
 Receiving input from the user and providing output to the
user via standard I/O devices.

Example of user interaction class and object


11/21/2023 15
Proxy Objects
 Interfaces to and communicates with an external system.
 Local representative of the external system and hides the
details of “how” to communicate with the external system.

11/21/2023 Example of proxy class and object 16


Device I/O Objects
 Provides the software interface to a hardware I/O device.
 Device I/O boundary objects are needed for nonstandard
application specific I/O devices.

11/21/2023 Example of input class and object 17


Device I/O Objects

Example of output class and object


11/21/2023 18
Device I/O Objects

11/21/2023 Example of I/O class and object 19


Depicting External Classes and Boundary Classes

11/21/2023 Banking System External classes and Boundary classes 20


Entity Classes and Objects
 It is a software object that stores information.
 Entity objects store data and provide limited access to that
data via the operations they provide.

11/21/2023 Example of entity class and object 21


Control Classes and Objects
 Provides the overall coordination of the objects that
realize a use case.

 Simple use cases do not need control objects.

 Depending on the characteristics of the use case, the


control object may be state-dependent.
 A coordinator object is an overall decision-making object
that determines the overall sequencing for a collection of
related objects.
 The decision is based on the input it receives

11/21/2023 22
Control Classes and Objects

11/21/2023 Example of coordinator class and object 23


Control Classes and Objects
 A state-dependent control object is a control object whose
behavior varies in each of its states.
 A finite state machine is used to define a state-dependent
control object.

11/21/2023 Example of state-dependent control class and object 24


Control Classes and Objects
 A timer object is a control object that is activated by an
external timer. (real-time clock, OS clock)
 It either performs some action itself or activates another
object to perform the desired action.

11/21/2023 Example of a timer class and object 25


Application Logic Classes and Objects
 A business logic object defines the business-specific application logic for
processing a client request.

 Usually a business logic object accesses various entity objects during its
execution.

 If the business rule can be executed by accessing two or more entity objects,
there should be a separate business logic object.

 See next slide… where withdrawal transaction manager business logic


accesses three entity objects to serve its purpose.

 If accessing one entity object is sufficient to execute the business rule, it


could be provided by an operation of that object.

11/21/2023 26
Application Logic Classes and Objects

Example of business logic class and object


11/21/2023 27
Application Logic Classes and Objects
 An algorithm object encapsulates an algorithm used in
the problem domain.
 More prevalent in real-time, scientific, and engineering
domains.
 Simple algorithms are usually operations of an entity
object that operate on the data.
 An algorithm object frequently has to interact with other
objects in order to execute its algorithm.

 Encapsulate and excite the algorithm


 Coordinator object (supervise other objects)

11/21/2023 28
Application Logic Classes and Objects

11/21/2023 Example of algorithm class and object 29


Application Logic Classes and Objects
 A service object is an object that provides a service for
other objects.
 A service object never initiates a request; however, in
response to a service request it might seek the assistance
of other service objects.

 Service objects play an important role in service-oriented


architectures.

 Also client/server, component-based Software architecture

11/21/2023 30
Application Logic Classes and Objects

11/21/2023 Example of service class and object 31


II. Dynamic Interaction Modeling

11/21/2023 32
Lecture Outline
 Overview of object interaction modeling
 Communication diagrams
 Sequence diagrams
 Describes message sequence numbering on interaction
diagrams
 Introduces dynamic interaction modeling
 Describe stateless dynamic interaction modeling
 Examples of dynamic interaction modeling

11/21/2023 33
Object Interaction Modeling
 A communication diagram is an interaction diagram that
depicts a dynamic view of a group of objects interacting
with each other by showing the sequence of messages
passed among them.
 A communication diagram is developed for each use case
 Only objects that participate in the use case are depicted

 The sequence in which the objects participate in each use


case is depicted by means of message sequence numbers.

11/21/2023 34
Object Interaction Modeling

11/21/2023 Use case diagram for the View Alarms use case 35
Object Interaction Modeling

11/21/2023 Communication diagram for the View Alarms use case 36


Object Interaction Modeling
– Sequence diagram: shows object interactions arranged in
time sequence.
• Can also depict loops and iterations

– Sequence diagrams and communication diagrams depict


similar information, but in different ways.

– Usually either communication or sequence diagrams are


used to describe a dynamic view of a system.
– Numbering the messages on sequence diagram is not
essential, it can be shown from the top to the bottom.

11/21/2023 37
Object Interaction Modeling

11/21/2023 Sequence diagram for the View Alarms use case 38


Analysis and Design Decision in Object Interaction Modeling

 In the analysis model, messages represent the information


passed between objects.
 Interaction diagrams (communication or sequence ) help
in determining the operations of the objects.
 But, the information is more important at this stage

 During design:
 The type operations
 Kind of message passed between objects
 Object type

11/21/2023 39
Sequence Diagram Vs Communication Diagram
 Sequence diagrams:
 Clearly shows the order of the messages
 Indicating the objects connection is more difficult
 Iterations and decision statements can obscure
 Communication diagrams :
 Shows the layout of the objects (connection)
 Message sequence is less readily visible

 The communication diagrams are the COMET preference


 Important step in the transition to design (To create the
initial software architecture)

11/21/2023 40
Massage Label on Interaction Diagram
 A message label has the following syntax:
 [sequence expression]: Message Name (argument list)
 Dynamic interaction modeling is carried out for each use
case.
 Dynamic interaction modeling can be either state-
dependent or stateless.

11/21/2023 41
Stateless Dynamic Interaction Modeling
 The main steps in the stateless dynamic interaction
modeling approach are:
 Start with the use case
 Consider the objects needed to realize the use case
 Determine the sequence of message communication among
the objects
 Two dynamic interaction modeling examples:
 Use case for View Alarms
 Use case for Process Delivery Order

11/21/2023 42
Example of Stateless Dynamic Interaction Modeling

11/21/2023 Use case description 43


Example of Stateless Dynamic Interaction Modeling

 Determine objects needed to realize use case:


 Two objects participate
 User interaction object (Operator Interaction)
 Service object (Alarm Service)

 Determine message communication sequence:


 Operator Interaction object make a request
 Alarm Service responds with the desired information

11/21/2023 44
Example of Stateless Dynamic Interaction Modeling

11/21/2023 Message sequence 45


Object Interaction Modeling

11/21/2023 Communication diagram for the View Alarms use case 46


Example of Stateless Dynamic Interaction Modeling

 Example 2: Stateless dynamic interaction modeling of an


online shopping service-oriented system.

11/21/2023 Use case diagram for the Make Order Request use case 47
Example of Stateless Dynamic Interaction Modeling

11/21/2023 48
Use case description
Example of Stateless Dynamic Interaction Modeling

 Determine objects needed to realize use case:

 User interaction object (Customer Interaction)


 Service one (Customer Account Service)
 Service two (Credit Card Service)
 Service three (Delivery Order Service)
 Service four (Email Service)
 Coordinator object (Customer Coordinator)

11/21/2023 49
Example of Stateless Dynamic Interaction Modeling

 Determine message communication sequence:


 Customer Interaction makes an order request to Customer
Coordinator (M1 and M2)
 Customer Coordinator needs to request account information
from Customer Account Service (M3 and M4)

 Customer Coordinator needs to request credit card


authorization from Credit Card Service (M5)
 The credit card authorization request is approved (M6)

11/21/2023 50
Example of Stateless Dynamic Interaction Modeling

 Determine message communication sequence:

 Customer Coordinator needs to store the order at Delivery


Order Service (M7 and M8)

 The system confirms the order to the user (M9 and M10)

 Sends a confirmation email via the email service (M9a)

11/21/2023 51
Example of Stateless Dynamic Interaction Modeling

11/21/2023 Message description 52


Example of Stateless Dynamic Interaction Modeling

11/21/2023 Communication Diagram : Main Sequence 53


Example of Stateless Dynamic Interaction Modeling

11/21/2023 Sequence diagram : main sequence 54


Example of Stateless Dynamic Interaction Modeling

 Determine alternative sequence:

 The scenario diverges from the main scenario at step M4A.


 The alternative response to the account request of step M3 is
M4A [no account]:
 Account does not exist

 The message sequence for this alternative scenario is M4A


through M4A.8

11/21/2023 55
Example of Stateless Dynamic Interaction Modeling

11/21/2023
Alternative message description 56
Example of Stateless Dynamic Interaction Modeling

11/21/2023 Sequence diagram : alternative sequence for Create New Account 57


Example of Stateless Dynamic Interaction Modeling

 Determine alternative sequence:


 The scenario also diverges from the main scenario at step
M6A.
 The alternative response to the authorized credit card
request of step M5 is M6A [denied]:
 Credit card denied

 The message sequence for this alternative scenario is M6A


through M6A.2.

11/21/2023 58
Example of Stateless Dynamic Interaction Modeling

11/21/2023 Alternative sequence description 59


Example of Stateless Dynamic Interaction Modeling

11/21/2023 Communication diagram : alternative sequence for Credit Card denied 60


Example of Stateless Dynamic Interaction Modeling

11/21/2023 Generic communication diagram (main + alternative sequences) 61


Thank You !!!

?
11/21/2023 62

You might also like