Professional Documents
Culture Documents
Object Oriented Modeling and Design (Subject Code: 17630) Madeby: SHAIKH ABDULLAH
Object Oriented Modeling and Design (Subject Code: 17630) Madeby: SHAIKH ABDULLAH
ORIENTED
MODELING &
DESIGN
Made by:-
Shaikh Abdullah Irfan
8879575588
Page 1 of 200
NAME : SHAIKH ABDULLAH IRFAN
COURSE : CM6G
ROLL NO : 21
OBJECT ORIENTED MODELING & DESIGN (17630)
CHAPTERS W14 S15 W15 S16
CHP 1 40 24 12 32
CHP 2 48 48 48 28
CHP 3 12 36 38 36
CHP 4 20 36 36 36
CHP 5 12 12 12 12
Page 2 of 200
CHP.1 IMPORTANCE OF MODELING
Q1. What is object orientation? Explain object oriented themes: [S16] [8MKS]
(i) Abstraction
(ii) Encapsulation
Ans 1:
4. Polymorphism: - It means that the same operation may behave differently for
different classes. The move operation behaves differently for the pawn
than for the queen in a chess game.
[Same as Ans2]
Page 3 of 200
Q2. Describe any two features/principles/themes of OO (Object Oriented).
(2 marks for each feature, any 2 features can be considered) [W14,W15] [4MKS]
Ans 2: 1) Abstraction
2) Encapsulation
3)Modularity
4)Hierarchy
5) Sharing
The burden of calling code for data execution and operations separately
can be minimized by combining data properties and behavioral properties of an
entity together. In object oriented program data structure and procedure is
defined in single class definition.
Page 4 of 200
Q3.What is attributes? Explain with suitable example. [S15][4MKS]
Ans: Attributes:
For Example :
Class Person has attributes Name, Birth date and weight. Name is string,
Birthdate is Date and Weight is integer.
Page 5 of 200
Q4. Define model. Why modeling is important? [W14] [4MKS]
Ans 4:
Q5. Give relationship among object, dynamic and functional model. [W14] [4MKS]
Ans 5:
The dynamic model specifies allowable sequences of changes to objects from the
object model. The states of the dynamic model can be related to classes of
attribute and links values of an object, events can be represented as
operations on the object model. The object model concepts of generalization,
aggregation and inheritance also apply to the dynamic model.
Page 6 of 200
Object and functional model:
All four components of the functional model can be related to the object model
processes. The functional model shows the processes that have to be
implemented in the methods of the objects. The processes in the functional
model show the objects that are related by function. Often one in- or output is
the target (client) of a process. The other inputs are the parameters (suppliers).
These client-supplier relationships establish implementation dependencies
between the related classes.
The relationship between these two models is that the dynamic model states
when operations are performed, and the functional model states how they
are performed and which arguments are needed. There is however a
difference between operations on actors and operations on data stores. Because
actors are active objects, the dynamic model has to specify when it acts. The
data stores are passive objects, they only respond to updates and queries,
therefore you do not have to specify in the dynamic model when they act.
Page 7 of 200
Q6. Explain Object Modeling Technology (OMT) by Rambaugh. [W14,S15,S16]
[4MKS]
Ans 6:
1. Object model: The object model represents the static and most stable
phenomena in the modeled domain. Main concepts are classes and
associations with attributes and operations. Aggregation and generalization
(with multiple inheritances) are predefined relationships.
Page 8 of 200
Q7. Write the importance of modeling. [S16] [4MKS]
Ans:
Modeling is a central part of all activities that lead up to the deployment o f good
software. It is required to build quality software.
Importance of Modeling:
Page 9 of 200
Q8. What is modeling? What are four principles of modeling? [S15,W15,S16]
[4MKS]
2. Every model may be expressed at different levels of precision: All the users
and developers both may visualize a system at different levels of details at
different times.
Page 10 of 200
Q9.i)What is UML? Where it is used? [W13] [4MKS]
(UML definition: 1 Marks and where it is used (minimum three uses): 3 Marks)
Ans :
Definition: The Unified Modeling Language (UML) is a language that unifies the
industry’s best engineering practices for modeling system. The UML is not
simply a notation for drawing diagrams, but a complete language for
capturing knowledge about a subject and expressing knowledge regarding
the subject for the purpose of communication. The UML defines nine types of
diagrams.
Uses:
Page 11 of 200
ii)Give overview of UML. [S14] [4MKS]
Ans :
f) It helps in visualizing systems as it is and how it will appear in the future once
it is developed.
a) Visualize
b) Specify
c) Construct and
Major Goals of UML : The major goals of UML are Described Below :
5) Important goals of UML is to promote the growth of the object tools market.
Page 13 of 200
Q10.i) Describe OMG Model driven architecture. [W9,W10]
Ans ii:
UML:
It was created and developed by Grady Booch, Ivar Jacobson and James
Rumbaugh at Rational Software during 1994–95 with further development led by
them through 1996.In 1997 it was adopted as a standard by the Object
Management Group (OMG), and has been managed by this organization ever since.
In 2000 the Unified Modeling Language was also accepted by the International
Organization for Standardization (ISO) as an approved ISO standard.
OMG:
Example of OMG:
3.Meta-Object Facility
Page 14 of 200
Q11. Describe conceptual model of UML? [S14,W14,S15] [4MKS]
Ans:
UML 2.0 has 13 types of diagrams divided into three categories: Six
diagram types represent static application structure, three represent general
types of behaviors, and four represent different aspects of interactions .
These diagrams can be categorized hierarchically as shown in the following
block diagram:
Page 15 of 200
Q12. Explain different relationship in UML. [S12,S15] [4MKS]
(At least two types of relations Explanation with example – 2Marks each. )
2. Class Level
Links
A Link is the basic relationship among objects. It is used in object diagrams. Helps
in understanding the relationship between objects, with data values and
multiplicity diagram.
Association
Page 16 of 200
An association represents a family of links. A binary association (with two ends)
is normally represented as a line. An association can link any number of classes.
An association with three links is called a ternary association. An association can
be named, and the ends of an association can be adorned with role names,
ownership indicators, multiplicity, visibility, and other properties. The classes
may be associated with each other by aggregation or generalization.
Aggregation
Composition
Class diagram showing Composition between two classes at top and Aggregation
between two classes at bottom
Generalization
Class diagram showing generalization between one super class and two subclasses
Page 17 of 200
The Generalization relationship ("is a") indicates that one of the two related
classes (the subclass) is considered to be a specialized form of the other (the
super type) and the super class is considered a 'Generalization' of the subclass.
Realization
Ans:
Page 18 of 200
Q14. What is meant by architectural modeling? [S16] [4MKS]
Ans:
a. The use case view of a system encompasses the use cases that describe the
behavior of the system as seen by its end users, analysts, and testers.
Page 19 of 200
c. The process view of the system encompasses the threads and processes that
form the systems concurrency and synchronization mechanisms.
e. The deployment view of a system encompasses the nodes that form the
system’s hardware topology on which the system executes.
Page 20 of 200
Q15.i) Describe rational unified software development life cycle with its all
phases.
(Description of software development life cycle with four correct phases and
diagram: 4M)
Ans:
The UML is largely process independent i.e it is not any particular software
development life cycle. However, to get the most benefit from the UML, you
should consider a process that is:
1. Inception
It is the first phase of the process, when the seed idea for the
development is brought up.
2. Elaboration
It is the second phase of the process, when the product vision and its
architecture are defined. In this phase, the system’s requirements are
articulated, prioritized and base lined.
3. Construction
It is the third phase of the process, when the software is brought from
an executable architectural baseline to being ready to be transitioned to
the user community.
4. Transition
It is the fourth phase of the process, when the software is turned into the hands
of the user community.
Page 21 of 200
Page 22 of 200
Q16.i) Describe Architectural Meta Model. [S14,W14] [4MKS]
1.Design View:
the design view of a system is structural view of the system. This view
primarily supports the functional requirements of the system. The design view of
a system includes the classes, interfaces and collaborations that from the
vocabulary of the problem and its solution. Class diagram and object diagram
from the design view of the system.
2. Process view:
The dynamic behavior of system can be seen using the process view. This view
primarily addresses the performance, scalability, and throughput of the
system. The different diagram such as the state diagram, activity diagram,
sequence diagram, and collaboration diagram are used in this view.
Page 23 of 200
3. Implementation view:
implementation view of system includes the components and files that are used
to assemble and release the physical system. The component diagram of UML
captures the implementation view.
4. Deployment view:
Use case diagram of UML describes the behaviours of the system as seen by the
end user, analysts and testers. Use case diagram captures the static view
of the system.
Page 24 of 200
Q17.Mention the UML diagram used for OO analysis and OO design. [W14] [4MKS]
(Any four UML diagram for OO analysis -2 Marks, Any four UML diagram for OO
design -2 Marks)
Ans:
1. Class Diagram
2. Object Diagram
3. Use case Diagram
4. Profile Diagram
5. Activity Diagram
6. Interaction Diagram
7. State chart Diagram
1. Class Diagram
2. Component Diagram
3. Composite Diagram
4. Deployment Diagram
5. Object Diagram
6. Package Diagram
Page 25 of 200
Q18. i)Describe various UML diagram. [W14] [4MKS]
Ans:
UML defines nine types of diagrams: class (package), object, use case, sequence,
collaboration, state chart, activity, component, and deployment.
UML defines nine types of diagrams: class (package), object, use case, sequence,
collaboration, state chart, activity, component, and deployment.
Class Diagrams:
Class diagrams are the backbone of almost every object oriented method,
including UML. They describe the static structure of a system. It shows a set of
classes, interfaces and collaboration and their relationships.
Object Diagrams:
Use case diagrams model the functionality of system using actors and use
cases and their relationships.
Sequence Diagrams:
Collaboration Diagrams:
Page 26 of 200
State chart Diagrams:
Activity Diagrams:
Activity diagrams illustrate the dynamic nature of a system by modeling the flow
of control from activity to activity. An activity represents an operation on some
class in the system
that results in a change in the state of the system. Typically, activity diagrams
are used to model workflow or business processes and internal operation.
Component Diagrams:
Deployment Diagrams:
Page 27 of 200
ii) Explain how UML diagrams are classified. [W15] [4MKS]
Ans:
1. Class diagram
2. Object diagram
4. Sequence diagram
5. Collaboration diagram
7. Activity diagram
8. Component diagram
9. Deployment diagram
7. Activity diagram
1. Class diagram
2. Object diagram
An object diagram shows a set of objects and their relationships. Object diagram
addresses the static design view of a system.
A use case diagram shows a set of use cases and actors and their relationships.
Use case diagram addresses the static design view of a system.
Page 28 of 200
4. Sequence & Collaboration diagram
6. Activity diagram
An activity diagram is a special kind of a state chart diagram that shows the flow
from activity to activity within the system. Activity diagram addresses the
dynamic view of a system.
7. Component diagram
8. Deployment diagram
Page 29 of 200
iii) List and classify various UML diagrams. [S16] [4MKS]
Ans:
1. Structure Diagram
a. Class Diagram
b. Object Diagram
c. Deployment Diagram
d. Component Diagram
2. Behavior Diagram
a. Activity Diagram
d. Interaction Diagram
i. Sequence Diagram
Page 30 of 200
CHP.2 CLASS MODELING
Q1. Mention and explain any four properties of objects? [S10,S15] [4MKS]
Q2. Define object and class. State how they are different and give suitable
example of each.(Definition of object-1M, Definition of class-1M, any one
difference-1M, example ½ M each) [S10,S14,S16] [4MKS]
Ans:
Definition of object:-
Definition of class:-
Page 31 of 200
Difference:-
Example:-
Page 32 of 200
Q3.i)Which symbols are used in class diagram? Give an example diagram. [W13] [
4MKS](Minimum two symbols used in class diagram: 2 Marks, Any Example of class
diag.: 2 Marks)
Ans:
Page 33 of 200
Example:
Page 34 of 200
ii) Explain class diagram with suitable example. [S14,S15] [4MKS]
Ans:
Example:
Page 35 of 200
Q4. Draw class diagram for ATM system. [S14,W14,S15] [4MKS]
Ans:
Page 36 of 200
Q5. Draw and explain notations used for object diagram. [S16] [4MKS]
Ans:
Page 37 of 200
Q6. State and explain notations used to draw class diagram. Draw a neat class
diagram for ATM – money withdrawal.
(Any 4 class diagram notations- each 1M, ATM -money withdrawal class diagram
with correct notation 4M)
Note: any other class diagram showing ATM -money withdrawal shall be
considered. [W15] [8MKS]
Ans:
Notation:
Page 38 of 200
2) Association – Association is a kind of a structural relationship. Objects in
association are at the same level. Association defines a relationship between two
or more classes.
teaches
teacher student
It represents relationships that relate to two or more other classes where the
relationships have common characteristics. The symbol used to denote
association is solid line.
Notation:
Page 39 of 200
3) Multiplicity – Multiplicity gives no. of instances of one class that may relate to
single instance of an associated class.The no. of instances a class may have is
known as multiplicity. Multiplicity in an association specifies how many objects
participate in a relationship. Multiplicity decides the number of related objects.
Multiplicity is generally explained as “one” or “many,” but in general it is a
subset of the non-negative integers.
1 One only
Notation:
Page 40 of 200
4) Association Class: An association class is an attribute of an association. It is also
a class.
Notation:
Notation:
Notation:
Page 41 of 200
Page 42 of 200
Q7.Draw different relationship used in class diagram and draw class diagram for
ATM system.[S14] [4MKS]
Ans:
1. Dependency
2. Generalization
3. Association
4. Aggregation
5. Realization
Page 43 of 200
Q8. Explain following types of relationships with notation:
(i) Realization
(ii) Generalization
(iii) Dependency
(iv) Association
(v) Aggregation
Ans:
2. Between use cases and the collaborations that realize them. Graphically, a
realization relationship is rendered as a cross between a generalization and a
dependency relationship, as in figure below:
Page 44 of 200
iii) Dependency It is a semantic relationship between two things in which a
change to one thing may affect the semantics of the other thing. Graphically, a
dependency is rendered as a dashed line, possibly directed, and occasionally
including a label, as in figure below:
Notation:
Page 45 of 200
Q9. Describe the term dependencies with respect to class diagram. [S9,S15]
[4MKS]
Ans:
Dependency is a weaker form of bond which indicates that one class depends on
another because it uses it at some point in time. One class depends on
another if the independent class is a parameter variable or local variable of a
method of the dependent class. This is different from an association, where an
attribute of the dependent class is an instance of the independent class.
Sometimes the relationship between two classes is very weak. They are
not implemented with member variables at all. Rather they might be
implemented as member function arguments.
Page 46 of 200
Q10. i) Explain generalization and inheritance. [W14,S15,S16] [4MKS]
Ans:
3. The class being derived is called as super class and its derived classes are
called as subclasses.
5. The super class holds common attributes, operations and association; the
subclasses add specific attributes, operations & associations
Notation:
Page 47 of 200
Example:
Page 48 of 200
ii) State the importance of generalization in class diagram with suitable example.
Ans:
Page 49 of 200
Q11. Describe qualification with appropriate example. [W9,W10,W14] [4MKS]
Ans: Qualified association: It uses the special attribute qualifier which reduces
the Effective multiplicity of an association.
Notation:
Page 50 of 200
Q12. Define interface with suitable example and explain its importance.(Define
interface -1Mark, example-1Mark, Importance-2 Marks ) [S14,S15] [4MKS]
Ans:
Importance:-
Page 51 of 200
Q13.Explain the “operation” in class diagram. [W9,W13] [4MKS]
Ans:
Page 52 of 200
Q14.What is realization? Explain with example. [W9,W13] [4MKS]
Ans:
2. Between use cases and the collaborations that realize them. Graphically, a
realization relationship is rendered as a cross between a generalization and a
dependency relationship, as in figure below:
Page 53 of 200
Q15. Describe role name with example. [W9,W14,S15][ 4MKS]
Ans:
When a class participates in a association it has got a specific role which it plays
in that relationship. It can be explicitly named the role a class plays in an
association. A role names the behavior of an entity participating in a particular
context. In other words we may say that a role is the face that an abstraction
presents to the world.
Role name: - A role is one end of an association. A binary association has two
roles, each of which may have a role name. A role name is a name that
uniquely identifies one end of an association. Roles provide a way of viewing a
binary association as a traversal from one object to a set of associated objects.A
role name is written next to the association line near the class that plays the
role.
Example:
Page 54 of 200
Q16.i) What are the packages(or Define packages)? Explain with suitable
example. [S11,S12,W12,S14,W14] [4MKS]
ii) What are the packages? Describe its purpose. [S9,W14] [4MKS]
Ans:
Packages
Example:
Package org.hibernate
The members of the package may be shown within the boundaries of the
package. In this case the name of the package should be placed on the tab.
Page 55 of 200
Q17. Write down the advantages and disadvantages of class and advanced class
diagrams. [W13] [4MKS]
Ans:
Class Diagram:
Advantages:
Disadvantages:
1. The programmer may need to learn UML to build the class diagram in the first
place.
2. The time spent building the class diagram may add to overall development
time.
Advantages:
Disadvantages:
Ans:
Page 57 of 200
ii) Hospital management system. [W12]
Ans:
Page 58 of 200
iii) Online bus reservation system. [W13]
Ans:
Page 59 of 200
iv) Draw neat class diagram for Railway Reservation System.
Note: any other class diagram showing railway reservation system shall be
considered.
Ans:
Page 60 of 200
Q19. Explain object diagram attributes and methods. [S12,S14] [4MKS]
Ans:
Object diagram
Attributes
It is a data value held by the objects in a class. Each attribute has a value for
each object instance. Each attribute name is unique within a class. Name, age,
weight are the attributes of person object.
Method
A method is the implementation of an operation for a class. Eg. The class file
have an operation print. Different methods are implemented to print binary
files, ASCII files. All these methods logically performs the same task of printing a
file, so they can referred by operation print. However each method may be
implemented by different piece of code
Ans:
[Q19]
Ans:
[Q19]
Page 61 of 200
Q22.Describe link in brief with appropriate example. [W9,W10,S12,W13,S14]
[4MKS]
Page 62 of 200
Q24. Explain multiplicity with all its notations. [W10,W12,W14,S15,W15] [4MKS]
Multiplicity – Multiplicity gives no. of instances of one class that may relate to
single instance of an associated class. The no. of instances a class may have is
known as multiplicity. Multiplicity in an association specifies how many objects
participate in a relationship. Multiplicity decides the number of related objects.
Multiplicity is generally explained as “one” or “many,” but in general it is a
subset of the non-negative integers.
1 One only
Notations:
Page 63 of 200
Example 1:
Example 2:
Page 64 of 200
Q25. What is meaning of: [S16] [4MKS]
(i) Attributes
Ans:
Attributes are listed in the second part of Class Box. Each attribute name
may be followed by optional details. Each attribute name is Unique within a
class.
For Example: Class Person has attributes Name, Birthdate and weight. Name
is string, Birthdate is Date and Weight is integer.
Page 65 of 200
(ii) link attributes with reference to class and object:- Link attribute allow adding
properties to association between two classes/objects.
For example: In the below example company and person has a link/association
between them which has link attributes as description, datehired and salary. These
attributes are placed inside the association class job. Association class is linked to
association line with dashed line.
Page 66 of 200
Q26.
Ans:
Association Class:
Example:
Page 67 of 200
Inheritance:
2.The class being derived is called as super class and its derived classes are called
as subclasses.
Example:
Page 68 of 200
2) How you can use association as a class. [S14] [4MKS]
Diagram:
Page 69 of 200
Q27.Describe role name with example. [W9,W14,S15] [4MKS]
Ans: (Q15)
Ans:
Page 70 of 200
Q29.
Ans: [Q11]
Example:-
Ans:
[Q15,Q11]
iii) Define multiplicity and qualification with appropriate example. [S16] [4MKS]
Ans:
[Q24,Q11]
Page 71 of 200
Q30. Define following terms with notations: [W15] [4MKS]
1) Object
2) Class
3) Qualified association
4) Ordered association
Ans:
1) Object:
Notation:
Page 72 of 200
2)Class:
- Once class has been defined we can create any no. of objects belonging
to the same class.
Notation:
Page 73 of 200
at the many end of an association. A qualifier is drawn as a small box on
the end of the association line near the class it qualifies.
Notation:
4) Ordered association:
Usually the objects on the "many" side of an association have no explicit order,
and can be regarded as a set. Sometimes the objects on the many side of
an association have order. Writing {ordered} next to the multiplicity dot
indicates an ordered set of objects of an association.
Notation:
Page 74 of 200
Q31.
[W12,W14] [4MKS]
Properties:
1. Aggregation is the “Part-whole” or “a- part-of” relationship in which objects
representing the components.
2. An Aggregation is a specialized association.
3. Aggregation is tightly looped from of association with same extra semantics.
4. Example shows that a document consists of many sentences.
5. Aggregation is drawn like association, except a small diamond indicates the assembly
end of the relationship.
Example:
Page 75 of 200
Q32.
Ans:
Page 76 of 200
ii) Explain how generalization is useful in ATM case study. [S10] [4MKS]
Ans:
Page 77 of 200
iii) a)Explain multiple inheritance with suitable example. [W12,S14] [4MKS]
Ans:
Multiple inheritance is a relationship that exists among different classes and interface.
One class may have multiple super classes or interfaces. Also many classes may have
many sub classes or interfaces. This is called as multiple inheritance.
Multiple inheritance allows to establish the relationship of many classes. It allows to
share attributes and operations of the classes.
Multiple inheritance is very useful property of object orientation. It is complicated to
understand when no. of classes are more.
Page 78 of 200
b) How will you show implementation of multiple inheritance? Explain with example
and diagram?(Correct explanation - 2 Marks, Example with diagram - 2 Marks)
Ans: [S14][4MKS]
Multiple Inheritance:
It is defined as a class which can inherit features from two or more classes.
Multiple inheritance permits a class to have more than one super class and to inherit
features from all of its parents.
As shown in above figure Consultant Manager and Permanent Manager are inheriting
features from more than one parent.
Page 79 of 200
Q33. Explain grouping constraint with example? [S11,W13] [4MKS]
(Explanation: 4 Marks)
Module and sheet are grouping constraints. A module is a logical grouping constructs which
capture one perspective or view of a situation. A sheet is merely a notational convenience
for fitting object models on to fixed sized pieces of paper.
Module:
Sheet:
A complex model will not fit on a single piece of paper. A sheet is the mechanism for
breaking a large object model down into a series of pages. A sheet is a single printed page.
Each module consists of one or more sheets. As a rule we never put more than one module
per sheet. A sheet is just a notational convenience, not a logical construct. Each sheet has a
title and a name or number. Each association and generalization appears on a single sheet.
Classes may appear on multiple sheets.
Page 80 of 200
Q34.Describe recursive aggregates (composition) with proper diagram and example.
[W14,S15] [4MKS]
Ans:
Page 81 of 200
Q35. Describe propagation of operation with diagram and example.
Ans:
Propagation of Operation:
3. As moving aggregate moves its parts, the move operation propagates to the parts.
Example/diagram:
[OR]
Propagation of Operation:
Page 82 of 200
Q36.
a) Describe/Explain Abstract class and concrete class with diagram. (Description – 1 Mark
each, Diagram – 2 Marks)
[W9,S11,S12,W14] [4MKS]
Ans:
Definition
Abstract class: It cannot be used to create objects. So it cannot be instantiated. Classes that
has no direct instances, but whose descendant classes have direct instances are known as
abstract class. Abstract classes are incompletely implemented i.e. the class has interfaces
without implementations.
Concrete class: It is a class that is instantiable means it can have direct instances. A
concrete class may have abstract subclasses. It can be a leaf class in the inheritance tree.
Example:
Page 83 of 200
b) What is abstract class? What is its function? Give an example? [W13] [4MKS]
(Abstract class definition 2 Marks, with its functions and example: 6 Marks)
Ans:
Definition
Abstract class:
It cannot be used to create objects. So it cannot be instantiated. Classes that has no direct
instances, but whose descendant classes have direct instances are known as abstract
class. Abstract classes are incompletely implemented i.e. the class has interfaces without
implementations.
Function:
1) Abstract classes are useful to create an abstract super class to encapsulate classes
that participate in the same aggregation or association.
2) Some abstract classes appear naturally in the application domain. Other abstract
classes are artificially introduced as a mechanism for promoting code reuse.
3) Abstract classes organize features common to several classes. These classes are frequently
used to define methods to be inherited by subclass.
4) Abstract class can define the protocol for an operation without supplying a
corresponding method. This is called as an abstract operation. An abstract operation is
specified by a comment in braces.
Page 84 of 200
Q37.
1) Metadata. [W9,S11,W12,W14,S15]
Metadata is a data about data.
Eg:- class definition could be a metadata.
Most of the real world application have metadata.
Computer language implementation also use metadata on huge level.
Models are inherently metadata, since they describe the things being modeled. a
relational database management system use metadata. A person can define
information.
Explanation of example:-Each car model has its own attributes and associations. Each car
model object also describes a set of physical cars owned by persons. Each car
receives the common attributes from car model but also own list of particular attributes
such as serial number, color and a list of options. Car Model object as a pattern, a piece of
metadata, that describes car objects.
Page 85 of 200
2) Candidate-key. [S11,S12,W14]
The super key for which no proper subset, such a minimal super key are called as
candidate key.
Candidate key can be single or combination of attributes.
It is a minimal set of attributes that uniquely identifies an object or link . It means you
cannot discard an attribute from the candidate key and still distinguish all objects and
links.
A class or association may have one or more candidate keys, each of which may have
different combinations and numbers of attributes. The object id is always a candidate key
for a class.
One or more combinations of related objects are candidate keys for associations.
Notation: - A candidate key is delimited with braces in an object model.
Example:-
A many- to- many association requires both related objects to uniquely identify
each link.
A one-to-many association has a single candidate key: the object on the many side.
A one-to-one association has two candidate keys: either of the objects.
Page 86 of 200
3) Constraint. [S11,S12,W12,W13,W14,S15]
A constraint is a Boolean condition involving model element such as, objects, classes,
attributes, links, associations and generalization sets.
Constraints are commonly used for various elements on class diagrams to
express some condition or restriction. UML specification does not restrict
languages which could be used to describe constraint. Constraint must be somehow
evaluated to true by a correct design of the system.
For a class attribute the constraint in curly braces may follow the attribute.
Bank accounts attribute constraints - non empty owner and positive balance
For a constraint that applies to a single element (such as a class or an association
path),the constraint string may be placed near the symbol for the element, preferably
near the name, if any.
Page 87 of 200
What are constraints? How they are applied? [S15,S16] [4MKS]
Ans:
Constraints:
A constraint is a Boolean condition involving model element such as, objects, classes,
attributes, links, associations and generalization sets.
1. Constraints on Objects:
The structure of model expresses many constraints but sometimes it is helpful to add
explicit constraints. Examples of some constraints are:
Page 88 of 200
2. Constraints on Generalization Sets:
Disjoint
Overlapping
Complete
Incomplete
3. Constraints on Links:
Page 89 of 200
Q38.
A. List three models and explain functional model in detail. [W15] [4MKS]
1. Object Model
2. Dynamic Model
3. Functional Model
Functional model:
3. A data flow diagram is a graph whose nodes are processes and arcs are data flows.
Page 90 of 200
Three Models:
1. Class Model
2. State Model
3. Interaction Model
Interaction Model:
1. The interaction model describes interaction between objects i.e. how individual
objects collaborate to achieve the behavior of the system a s a whole.
3. Use cases, sequence diagrams and activity diagrams document the interaction
model. Use cases document major themes for interaction between the system and outside
actors.
4. Sequence diagrams show the objects that interact and the time sequence of their
interactions.
5. Activity diagrams show the flow of control among the processing steps of a
computation.
Page 91 of 200
B. Give relationship among object, dynamic, and functional model. [S9] [4MKS]
Ans:
[CHP 1 (Q5)]
Ans:
Dynamic modeling/model:
Page 92 of 200
Q40. Explain functional modeling/model with suitable example. [S9,W9,W10,S14] [4MKS]
Ans:
Functional Modeling
1. The functional model describes computations and specifies those aspects of the
system concerned with transformations of values - functions, mappings,
constraints, and functional dependencies.
2. The functional model captures what the system does, without regard to how or
when it is done.
3. The functional model is represented graphically with multiple data flow
diagrams, which show the flow of values from external inputs, through operations
and internal data stores, to external outputs.
Significance :
Page 93 of 200
Q41. Draw object diagram for:-
Ans:
Page 94 of 200
2) Super shop management system. [W13] [4MKS]
Ans:
Page 95 of 200
Page 96 of 200
Q42. Differentiate between :-
Ans:
[2.8. 1,2,3,4]
Association Aggregation
1.Association is a kind of a structural 1. Aggregation represents “has a”
relationship. relationship.
2. Object are at the same level. 2. Classes are not at the same level.
4. eg :– 4. eg: –
Object teacher is related to Object student. Company and Department are classes.
Department is a part of a company.
5. Notations:- 5. Notations:-
relates
Page 97 of 200
2. Operation and Method. [S9] [4MKS]
Ans:
OPERATION METHOD
1. Operations are action to be taken. 1. Methods are implementations of
operation.
3. Operations are shown in the class 3. Methods are used in class diagram and
diagram. in interaction diagram.
Ans:
Aggregation Composition
1. Aggregation represents “has-a 1. Composition includes who/part
“relationship. relationship.
3. It specifies that one big class can be 3. Composition is one of the form of
related to another small class. aggregation with strong ownership and
coincident lifetime as part of the
whole.
4. Classes are not at the same level. 4. Composition shows complicated
relationships than aggregation.
Page 98 of 200
4. Dynamic modeling and functional modeling. [S11,W13,S15] [4MKS]
Page 99 of 200
CHP.3 BASIC BEHAVIOURAL MODELING
Q1.
Ans:
1) Use case:
2) Actor:
4) System boundaries:
Use
case
Use
case
Use
case
Actor
Ans:
It shows a set of use cases and actors and their relationships. a use case is a description of a
set of sequences of actions that a system performs to get an result to tan actor. It
describe a set of sequences in which each sequence represents the interaction of the
things outside the system with the system itself. It represents functional requirements of
system. For example, for ATM system validating pin for the customer is a behavior of a
system which can be shown as use case. It addresses the static use case view of a system.
These are important in organizing and modeling the behaviors of a system.
Page 101 of 200
Common uses of use case diagram:-
To model the context of a system:- modeling the context of a system involves drawing
a line around the system and representing actors lie outside the system and interact
with it. In use case diagram actors and the meaning of their roles is represented.
To model the requirements of a system:-modeling the requirements of a system
involves specifying what that system should do without respect to how that system
should do it.
Notations:-
[OR]
Note: any other use case diagram showing car rental system shall be considered.
[W15] [6MKS]
Ans:
The primary actor of a use case is the stakeholder that calls on the system to deliver one of
its services. It has a goal with respect to the system –one that can be satisfied by its
operation. The primary actor is often, but not always, the actor who triggers the use case.
A supporting actor in a use case in an external actor that provides a service to the
system under design. It might be a high-speed printer, a web service, or humans that have to
do some research and get back to us. Use case diagram for car rental system:
<<include>> relationships:
Include relationship is used to include one use case within the behavior sequence of
another use case.
Include relationship is use case of indicates direct incorporation of one use case to
another.
An include relationship between use cases means that the base case explicitly
incorporates the behavior of another use case at a location specified in the base.
The include use case never stand alone. When an actor initiates any base use case
then base use case executes included use case.
An include relationship as a dependency can be render with stereotyped as include. To
specify the location in a flow of events in which the base use case includes the behavior
of another, simply write include followed by the name of the use case.
Arrow is placed near the included use case. Arrow is directed from base use case
to included use case.
A extend relationship between use cases means that the base use case
implicitly incorporates the behavior of another use case at a location specified
indirectly by the extending use case.
The extended use case adds itself to the base use case. Most of the time, an
extend relationship has a condition attached to it. The extended use case executes
only when the condition is true.
The base use case may stand alone, but under certain conditions, its behavior
may be extended by behavior of another use case.
An extend relationship as a dependency can be render with stereotyped as extend.
Arrow is directed from extended use case towards base use case.
Example:
(Explanation with example-4 Marks)(Note: Students may right any appropriate example to
show use case generalization. Keywords are parent use case, child use case, sharing
specifications, abstract)
Ans:
Generalization is used when you find two or more use cases that have
commonalities in behavior, structure, and purpose. When this happens, you can
describe the shared parts in a new use case which is child use case.
For e.g.: Place order is main system use case which may get order from phone or
internet, so phone order and internet order are child use cases.
The use cases Phone Order and Internet Order are specializations of the abstract use case
Place Order.
In an Order Management system, the use cases Phone Order and Internet Order
share a lot in structure and behavior. A general use case Place Order is defined
where that structure and common behavior is defined. The abstract use case Place
Order need not be complete in itself, but it provides a general behavioral framework
that the child use cases can then make complete.
The parent use case is not always abstract.
The child use cases can add behavior to the structure that the parent use
case provides, and also modify behavior in the parent.
The child use case is dependent on the structure of the parent use case. The child
use case may add additional behavior to the parent by inserting segments of
behavior into the inherited behavior, or by declaring include- and extend-
relationships to the child use case.
The child may modify behavior segments inherited from the parent, although it must
be done with care so that the intent of the parent is preserved. The structure of the
parent use case is preserved by the child. This means that all behavior
segments, described as steps or sub flows of the parent’s flow of events, must still
exist, but the contents of these behavior segments may be modified by the child.
If the parent is an abstract use case, it may have behavior segments that are
incomplete. The child must then complete those behavior segments and make them
meaningful to the actor.
A parent use case need not have a relationship to an actor if it is an abstract use
case.
If two child use cases are specializing the same parent (or base), the specializations
are independent of one another, meaning they are executed in separate use-
case instances. This is unlike the extend- or include-relationships, where several
additions implicitly or explicitly modify one use-case instance executing the
same base use case.
Both use-case-generalization and include can be reuse behavior among use cases in
the model.
i) Draw use case diagram for railway ticket counter (Use railway ticket counter,
booking clerk)(Correct Use case Diagram 8M; Any relevant diagram shall be considered)
ii) Draw use case diagram for railway reservation.(Any relevant diagram- 8 Marks )
Q6. Draw use case diagram for hospital management. (Any relevant use case diagram with
proper notation - 8 Marks)
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Notations:
1) Object:
Class roles describe the way an object will behave in context. Use the UML object
symbol to illustrate class roles, but don't list object attributes.
Activation boxes represent the time an object needs to complete a task. When an
object is busy executing a process or waiting for a reply message, use a thin gray rectangle
placed vertically on its lifeline.
3) Messages:
Messages are arrows that represent communication between objects. Use half-
arrowed lines to represent asynchronous messages. Asynchronous messages are sent from
an object that will not wait for a response from the receiver before continuing its
tasks.
Page 119 of 200
4) Lifelines:
Lifelines are vertical dashed lines that indicate the object's presence over time.
5) Destroying Objects:
Objects can be terminated early using an arrow labeled "<< destroy >>" that points to
an X. This object is removed from memory. When that object's lifeline ends, you can place
an X at the end of its lifeline to denote a destruction occurrence.
6) Loops:
Ans:
Synchronous Message:
A synchronous message requires a response before the interaction can continue. It's
usually drawn using a line with a solid arrowhead pointing from one object to another. If a
caller sends a synchronous message, it must wait until the message is done, such as
invoking a subroutine.
Asynchronous Message:
Asynchronous messages don't need a reply for interaction to continue. Like synchronous
messages, they are drawn with an arrow connecting two lifelines; however, the
arrowhead is usually open and there's no return message depicted. If a caller sends
an asynchronous message, it can continue processing and doesn‟t have to wait for a
response.
Ans:
Synchronous Messages:
A synchronous message is invoked when the Message Caller waits for the Message
Receiver to return from the message invocation.
A synchronous message is used when the sender waits until the receiver has
finished processing the messages, only then does the caller continue.
Most method calls in object-oriented programming languages are synchronous.
A closed and filled arrowhead signifies that the message is sent synchronously. For
example in given diagram transaction between enrolment staff and enrolment method
is shown with such arrows.
The rectangles on the lifeline are called activation and indicate that an object is
responding to a message. It start when the message is received and ends when the
object is done handling the message.
When messages are used to represent method calls, each activation corresponds to
the period during which an activation record for its call is present on the call stack.If you
show that the receiver has finished processing the message and returns control to the
sender, draw a dashed arrow from receiver to sender, optionally, a value that the
receiver returns to the sender can be placed near the return arrow. For example
Printinvoice() is finishing message shown with dotted line.
Asynchronous Messages:
With an asynchronous message, the sender does not wait for the receiver to finish
processing the message, it continues immediately.
Message sent to a receiver in another process or calls that start a new thread are
example of asynchronous messages.
An open overhead is used to indicate that a message is sent asynchronously.
E.g. RecordConcessionFees() message is given diagram is an asynchronous message.
Ans:
create message:
1. Objects can be created according to the requirement of the system in between the
processing of the system because they are not required for the entire duration of the
sequence diagram’s interaction.
2. If an object does not exist at the beginning of a sequence diagram then it must
be created in the system.
3. The UML shows creation by placing the object notation at the head of the arrow for the
message call that creates an object.
destroy message:
2. If the object is destroyed by itself then „X‟ is placed at the head of the call arrow that
destroys the object.
3. If the object destroys and returns control to another object then „X‟ is placed at the tail
of the return arrow.
Example:
Ans: [W15][6MKS]
1 : Conditional execution:
2. Alt operator is used to check the condition in sequence diagram. The body of the
control operator is divided into multiple sub regions by horizontal dashed lines.
3. Each sub region represents one branch of a conditional. Each sub region has a guard
condition. If the guard condition for a sub region is true, the sub region is executed.
4. However, at most one sub region may be executed. If more than one guard condition is
true, the choice of sub region is nondeterministic and could vary from execution to
execution. If no guard condition is true, then control continues past the control
operator.
5. One sub region may have the special guard condition [else]. This sub region is
executed if none of the other guard conditions are true.
Example:
1. The interaction operator loop means that the combined fragment represents a loop.
3. The loop construct represents a recursive application of the seq operator where the loop
operand is sequenced after the result of earlier iterations.
5. Loop operand could have iteration bounds which may include a lower and an
upper number of iterations of the loop.
6. If loop has no bounds specified, it means potentially infinite loop with zero as
lower bound and infinite upper bound.
7. If only min-int is specified, it means that upper bound is equal to the lower bound, and
loop will be executed exactly the specified number of times.
8. If min and max bounds for the loop are specified then loop will exactly execute that
number of times.
Ans: [W9,S15][8MKS]
Ans: [W9,S12,S15][8MKS]
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans: [S16][4MKS]
Behavioral modeling:
It indicates how software will respond to external events or stimuli. In behavioral model,
the behavior of the system is represented as a function of specific events and time.
1. A use case focuses on the functionality of a system i.e. what a system does for users. It
shows interaction between the system and outside actors. Ex: Student, librarians are
actors, issue book use case.
2. A sequence diagram shows the objects that interact and the time sequence of
their interactions. Ex: Student, librarians are objects. Time sequence enquires for book
check availability – with respect time.
3. An activity diagram specifies important processing steps. It shows operations required
for processing steps. It shows operations required for processing. Ex: issue book, check
availability does not show objects.
1) States
2) Branching
Ans: [4.1.1]
1) States:
2) Branching:
[same as Ans 3) ii ]
Ans: [W15,S16][4MKS]
Ans:
Branching:
Ans:
1. In an activity diagram, Diamond Shape is used for Decision and branches are
represented by lines. The condition written in diamond is the decision criteria.
2. A branch may have one incoming transition and two or more outgoing ones.
3. On each outgoing transition, we place a Boolean expression, which is evaluated only once
on entering the branch.
4. We can use the keyword else to mark one outgoing transition, representing the
path taken if no other guard expression evaluate to true.
5. When two paths of control merge back together, we can also use a diamond
symbol with two input arrow and one output arrow. No guards are necessary on merge.
Notation:
Example:
(Explanation of Decision Making and Branching-4 Marks; activity diagram for book return in
library management system with correct notations-4 Marks)Note: Any other activity
diagram for book return in library management system shall be considered.
Ans:
In an activity diagram, Diamond Shape is used for Decision and branches are
represented by lines. The condition written in diamond is the decision criteria.
A branch may have one incoming transition and two or more outgoing ones.
On each outgoing transition, we place a Boolean expression, which is evaluated only
once on entering the branch.
We can use the keyword else to mark one outgoing transition, representing the path
taken if no other guard expression evaluate to true.
When two paths of control merge back together, we can also use a diamond symbol
with two input arrow and one output arrow. No guards are necessary on merge.
We can achieve iteration by using one action that sets the values of an iterator,
another action that increments the iterator, and a branch that evaluates if the
iteration is finished.
The UML include node types for loops, but these may often be expressed more easily
in text than in graphics.
i) Describe forking and joining in activity diagram. (Explanation of Join min. 2 points – 2
Marks, Explanation of Fork min. 2 points - 2 Marks) [W15][4MKS]
Ans: Join: A join may represent the synchronization of two or more concurrent flows of
control. A join can have two or more incoming transitions and one outgoing transition.
Above the join, the activities associated with each of these paths continue in parallel.
At the join, the concurrent flows synchronize, meaning that each waits until all
incoming flow have reached the join, at which point one flow of control continues below
the join. The notation for a join is a line segment with several activity edges entering it, and
only one edge leaving it.
Fork: A fork can represent the splitting of a single flow of control into two or more
concurrent flows of control. A fork can have one incoming transition and two or more
outgoing transitions, each of which represents an independent flow of control. Below the
fork, the activities associated with each of these paths continue in parallel i.e.
concurrently.The notation for a fork is a line segment with a single activity edge entering it,
and two or more edges leaving it.
Joins and forks should always balance. It means that the number of flows that are going out
from a fork should match the number of flows that are coming into its corresponding join.
(Explanation with example of Join 2M, Explanation with example of Fork 2M)Note: Any
other example showing join and fork operations in activity diagram shall be considered
Ans:
2. A join may have two or more incoming transitions and one outgoing transition.
3. Above the join, activities associated with each of these paths continue in parallel.
4. At the join, the concurrent flows synchronize, means each waits until all incoming flows
have reached at the join, at which point one flow of control continues on below the join.
1. A fork in activity diagram represents the splitting of a single flow of control into two or
more concurrent flows of control.
2. A fork may have one incoming transition and two or more outgoing transitions, each of
which represents an independent flow of control.
3. Below the fork, the activities associated with each of these paths continue in
parallel.
Example:
iii) Explain forking and joining with diagram.(Relevant explanation of forking with diagram
2M, joining with diagram 2M) [S16][4MKS]
Ans:
1. A fork in activity diagram represents the splitting of a single flow of control into two or
more concurrent flows of control.
2. A fork may have one incoming transition and two or more outgoing transitions, each of
which represents an independent flow of control.
3. Below the fork, the activities associated with each of these paths continue in parallel.
2. A join may have two or more incoming transitions and one outgoing transition.
3. Above the join, activities associated with each of these paths continue in parallel.
4. At the join, the concurrent flows synchronize, means each waits until all incoming flows
have reached at the join, at which point one flow of control continues on below the join.
Example:
[same as above]
Ans:
Swim lane:
1. In activity diagram, activity states are partitioned into groups. Each group represents the
entity responsible for those activities. Each group is called as swim lane because visually
each group is divided by a line from its neighbor.
3. Each swim lane has a unique name within its diagram. It represents some real world
entity.
4. Each swim lane represents a high level responsibility for part of the overall activity of an
activity diagram and each swim lane may eventually be implemented by one or more
classes.
5. In an activity diagram partitioned into swim lane, every activity belongs to exactly on
swim lane, but transitions may cross lanes.
Example:
In above diagram we can observe three groups (entities): Customer, sales and Warehouse
Customer performs request product, receive order and pay bill activity.
Ans:[4.1.3 1) ]
(Activity Diagram to print receipt of one transaction in ATM with correct notations-4
Marks)Note: Any other Activity Diagram to print receipt of one transaction in ATM shall be
considered.
Ans: [W12,W15][4MKS]
Ans:
(Activity diagram for purchase book from supplier in library with correct notations
4M)(Note: Any other activity diagram showing purchase book from supplier in library shall
be considered.)
Ans:
Ans:
7) Draw activity and state diagram for online reservation system.(Activity Diagram 4 M;
State Diagram 4 M; any relevant diagram shall be considered) [S16][8MKS]
8) Draw activity diagram with swimlane for online purchase order. (Correct activity diagram
for online purchase order 4M; Any Relevant diagram shall be considered) [S16][4MKS]
Ans:
Ans: [W15][4MKS]
2. Nested activity state may reference another activity diagram that shows the
internal structure of the activity state.
3. It shows the sub graph (sub activity) inside of the activity state which refers to
another diagram. Sub activity can be reused as independent activity.
4. Nested activity diagram gives the result of its activities to the activity in which it resides.
Structure:
Example:
Ans: [S15][4MKS]
State diagram:
The name of the diagram itself clarifies the purpose of the diagram and other details.
It describes different states of a component in a system. The states are specific to a
component/object of a system. A State diagram describes a state machine. Now to clarify it
state machine can be defined as a machine which defines different states of an object and
these states are controlled by external or internal events. State diagram is one of the five
UML diagrams used to model dynamic nature of a system. They define different states of an
object during its lifetime. And these states are changed by events. So, State diagrams
are useful to model reactive systems. Reactive systems can be defined as a system
that responds to external or internal events. State diagram describes the flow of control
from one state to another state. States are defined as a condition in which an object exists
and it changes when some event is triggered. So the most important purpose of State
diagram is to model life time of an object from creation to termination. State diagrams
are also used for forward and reverse engineering of a system. But the main purpose is
to model reactive system.
Ans:
State:
Event:
events are those which represent external response. An event is an instant in time that may
be significant to the behavior of the objects in a class. Events can have associated
arguments.
Action:
Action states cannot be decomposed. Action states are atomic, meaning that events may
occur, but the work of an action state is not interrupted. The work of an action state as a
special case of an activity case of an activity state that cannot be further decomposed.
Activity:
An Activity is the UML way to specify that some relatively long-term amount of work gets
done while an object is in a state. - The work is continuous and interruptible (it stops when
you exit the state)
Activity state can be further decomposed, and their activity being represented by other
activity diagrams. Activity states are not atomic. An activity state as a composite, whose
flow of control is made up of other activity states and action states.
Ans:
The name of the diagram itself clarifies the purpose of the diagram and other details.
It describes different states of a component in a system. The states are specific to a
component/object of a system.
A State chart diagram describes a state machine. Now to clarify it state machine can be
defined as a machine which defines different states of an object and these states are
controlled by external or internal events.
State chart diagram is one of the five UML diagrams used to model dynamic nature of
a system.
They define different states of an object during its lifetime. And these states are
changed by events. So ,State chart diagrams are useful to model reactive systems.
Reactive systems can be defined as a system that responds to external or internal
events.
State chart diagram describes the flow of control from one state to another state.
States are defined as a condition in which an object exists and it changes when some
event is triggered. So the most important purpose of State chart diagram is to model
life time of an object from creation to termination.
State chart diagrams are also used for forward and reverse engineering of a system.
But the main purpose is to model reactive system.
i) What are the components of a state chart diagram?(Any four Components with its use 1
Mark each ) [S15,W15][4MKS]
Ans:
Ans: [W15][4MKS]
A state chart diagram shows flow of control from one state to another state.
Notations:
Ans:
State:
A state is a condition or a situation in the life of an object during which it satisfies some
conditions, performs some activity or waits for some events. It is represented with a
rounded rectangle. Name of the state is written inside the rectangle.
Ans:
Transitions:
An arrow indicating the object to transit from state to the other. The actual trigger event
and action causing the transition are written besides the arrow separate by slash.
Transitions that occur because the state completed an activity are called trigger less
transitions. If an event has to occur after the completion of some event or action, the
event or action is called the guard condition. The transition takes event or action, the
event or action is called Guard condition. The transition takes place after the guard
condition occurs. This guard condition/event/action is depicted by square brackets [ ]
around the description of the event/action (in other word, in the form of a Boolean
express in). An action is atomic, meaning that it cannot be interrupted by an event and
therefore runs to completion. This is in contrast to an activity, which may be interrupted
by other events. Events may include signals, calla, and passing of time or change in state.
Symbol :
Ans: [S15][4MKS]
Sub state:
1. Sequential Sub states are those sub states in which an event common to the composite
states can easily be exercised by each states inside it at any time.
2. sequential sub states partition the state space of the composite state into disjoint states.
3. Below Figure shows Sequential Sub states.
4. A nested sequential state machine may have at most one initial state and one final state.
Consider the problem of modeling the behavior of an ATM. This system might be in one of
three basic states: Idle (waiting for customer interaction), Active (handling a
customer's transaction), and Maintenance (perhaps having its cash store replenished). While
Active, the behavior of the ATM follows a simple path: Validate the customer, select a
transaction, process the transaction, and then print a receipt. After printing, the ATM
returns to the Idle state. You might represent these stages of behavior as the states
Validating, Selecting, Processing, and Printing. It would even be desirable to let the
customer select and process multiple transactions after Validating the account and before
Printing a final receipt.
Ans:
Example:-
In the above example, concurrent sub states are shown. Maintenance is a composite state. It
is decomposed into two concurrent sub-states as testing and commanding. Each of these
concurrent sub-states is further decomposed into sequential sub-states. When control
passes from Idle to Maintenance state, control then forks to two concurrent flows.
Execution of these two concurrent sub-states continues parallel in the system. Each nested
state machine reaches its final state. If one concurrent sub state reaches its final state
before the other, then control in that sub-state waits at its final state. When both
nested state reaches their final state, control from the two concurrent sub-states joins
back into one flow.
Page 165 of 200
Q12. i) Draw and explain state chart diagram for ATM.(Any Relevant state chart diagram for
ATM with proper notation - 5 Marks & Explanation -3 Marks ) [S15][8MKS]
Ans:
1. Prepare a state diagram for each object class with non-trivial dynamic behaviour
showing the events the object receives and sends.
2. Every scenario or event trace corresponds to a path through the state diagram.
State chart diagram for ATM
3. Each branch in Control flow is represented by a state with more than one exit transition.
While Active, the behavior of the ATM follows a simple path: Validate the customer,
select transaction, process transaction & print a receipt. After printing, the ATM returns to
idle state. We represent these stages of behavior as the states Validating, Selecting,
processing & Printing. It would be desirable to let customer select & process multiple
transaction after validating the account & before Printing Final receipt.
The state of ATM changes from Idle to Active when customer enters a credit card in
machine. On entering Active state, entry action read card is performed. Starting with
initial state of substructure, control passes to validating state, then selecting state & then
to processing state.
After processing, control may return to selecting (if customer has selected another
transaction) or it may move on to printing. After printing there’s a complete transaction
back to idle state. Active state has an exit action, which ejects customer’s card.
Ans:
Ans:
[chp1. Q14) ]
Ans:
1. Components
2. Interfaces
You use component diagrams to model the static implementation view of a system. This
view primarily supports the configuration management of a system's parts, made up of
components that can be assembled in various ways to produce a running system.
When you model the static implementation view of a system, you'll typically use
component diagrams in one of four ways.
Ans:
1.Component:
A component is a logical unit block of the system, a slightly higher abstraction than classes.
It is represented as a rectangle with tabs, usually including only its name. A component icon
is a rectangle with two smaller rectangles jutting out from left-hand side. This symbol is
visual stereotype.
2.Interface:
A dependency exists between two elements if changes to the definition of one element may
cause changes to the other. It represented as dotted arrow as shown in figure.
Ans:
Component:
Is Component Replaceable?
1. Component:
A component is a logical unit block of the system, a slightly higher abstraction than classes.
It is represented as a rectangle with tabs, usually including only its name. A
component icon is a rectangle with two smaller rectangles jutting out from left-hand side.
This symbol is visual stereotype.
2.Interface:
A dependency exists between two elements if changes to the definition of one element may
cause changes to the other. It represented as dotted arrow as shown in figure.
Ports are represented using a square along the edge of the system or a component. A port is
often used to help expose required and provided interfaces of a component.
5. Connector:
6. Artifact:
Ans:
[same as Q2 (iii) ]
v) Explain concept of interface and ports.(Relevant explanation of interfaces 2M, ports 2M)
[S16][4MKS]
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Node is a deployment target which represents computational resource upon which artifacts
may be deployed for execution.
1. device
2. execution environment
Execution environment is usually part of a general node or «device» which represents the
physical hardware environment on which this execution environment resides. Execution
environments can be nested (e.g., a database execution environment may be nested in an
operating system execution environment).
Device
Ans:
Ans:
Node:
1. Nodes, just like artifacts, are an important building block in modeling the physical
aspects of a system.
2. A node is a physical element that exists at run time and represents a computational
resource, generally having at least some memory and often processing capability.
3. Node can be used to model the topology of the hardware on which the system
executes. A node typically represents a processor or a device on which artifacts may be
deployed.
Notation:
Ans:
ii) To show a communication between application server and database server through IIs
server:
Ans:
Ans:
Ans:
Ans: [S14][4MKS]
Forward Engineering:
1. Forward engineering is the process of transforming a model into code through a mapping
to an implementation language.
2. Forward engineering results in a loss of information, because models written in the UML
are semantically richer than nay current object-oriented programming language. Hence
models are used in addition to the code.
3. Structural features such as collaborations and behavioral features such as interaction can
be visualized clearly in the UML but not so clearly from raw code.
Reverse Engineering:
1. Reverse engineering is the process of transforming code into a model through a mapping
from a specific implementation language.
3. There is a loss of information when forward engineering models into code, and we
can’t completely recreate a model from code unless our tools encode information in
the source comments that goes beyond the semantics of the implementation language.
Ans: [S14][4MKS]
2. If we want to distinguish these things from the UML’s defined building blocks, we create
a new building block by using stereotypes to specify these new semantics and to give
a distinctive visual cue.
3. If the thing we are modeling is some kind of hardware that itself contains
software, we consider modeling it as a kind of node, as well, so that we can further expand
on its structure.
Ans: [S14][4MKS]
1. Modeling Source Code : Identify the set of source code files of interest and model them as
components.
3. Modeling a Physical Database: Identify the classes that represent our logical database
schema.
4. Modeling Adaptable Systems : Consider the physical distribution of the components that
may migrate from node to node.
5. Forward and Reverse Engineering : Forward means the creation of code from model and
Reverse means the creation of models from code.
1. Modeling an Embedded System: Identify the devices and nodes that are unique to a
system.
2. Modeling a Client/Server System: Identify the nodes that represent system’s client and
server processors.
3. Modeling a Fully Distributed System: Identify system’s devices and processors as for
simpler client/server systems.
4. Forward and Reverse Engineering: Forward means the creation of code from model and
Reverse means the creation of models from code.
Ans: [S14][8MKS]
To model a flow of control that flows through objects and roles, interaction diagram is used.
To emphasize the passing of messages sequence diagram is used.
1. Set the context for the interaction, whether it is a system, subsystem, operation, or class,
or one scenario of a use case or collaboration.
2. Set the stage for the interaction which objects play a by identifying which objects play a
role in the interaction.
3. Set the lifeline for each object.
4. Starting with the message that initiates this interaction, lay out each subsequent message
from top to bottom between the lifelines, showing each message’s properties, as
necessary to explain the semantics of the interaction.
5. To visualize the nesting of messages adorn each object’s lifeline with it’s focus of control.
6. To specify time or space constraints, adorn each message with a timing mark and attach
suitable time or space constraints.
7. To specify flow of control more formally, attach pre and post conditions to each message.
To show the passing of messages in the context of that structure, collaboration diagram is
used.
1. Set the context for the interaction, whether it is a system, subsystem, operation, or a
class, or one scenario of a use case or collaboration.
2. Set the stage for the interaction by identifying which objects play a role in the
interaction.
3. Set the initial properties of each of these objects.
4. Specify the links among these objects, along which messages may pass. Lay out
association link first then other links next and adorn with the suitable path stereotypes.
5. Starting with the message that initiates this interaction, attach each subsequent message
to the appropriate link, setting its sequence number as appropriate. Show nesting by
using decimal numbering.
6. To specify time or space constraints, adorn each message with a timing mark and
attach suitable time or space constraints.
7. To specify flow of control more formally, attach pre and post conditions to each message.
Ans: [S14][6MKS]
Ans: [S13,S14][4MKS]
CRC cards are usually crated from index cards on which there are written:
4. The names of other classes with which the class will collaborate to fulfill its
responsibilities.
5. Author.
Ans: [S14][4MKS]
1. We identify actors that interact with the element. Candidate actors include groups that
require certain behavior to perform their tasks or that are needed directly or indirectly to
perform the element’s functions.
2. We organize actors by identifying general and more specialized roles.
3. For each actor, we consider the primary ways in which that actor interacts with the
element. We also consider interactions that change the state of the element or it’s
environment or that involve a response to some event.
4. We also consider the exceptional ways in which each actor interacts with that element.
5. We organize these behaviors as use cases, applying include and extend relationships to
factor common behavior and distinguish exceptional behavior.
Ans:
Q9. Write any four usage of UML.(1Mark for each use of UML)
Ans: [S13][4MKS]
Unified Modeling language is a standard language for writing software blueprints.It is very
expressive language addressing all the views needed to develop & them deploy such system
UML is language use for :-
1) Visualizing
2) Specifying
3) Constructing
4) Documenting
OOSE : OOSE has a use case driven approach - In this approach, a use case model serves
as a central model from which all other models are derived. A use case model
describes the complete functionality of the system by identifying how everything that is
outside the system interacts with the system.
The use case model is the basis in the development phases such as analysis,
construction (design and implementation) and testing.
The aim of analysis is to understand the system according to its functional requirements.
The objects are found, organized and object interactions are described. The operations
of objects and the internal view of objects is described as well during analysis.
Construction encompasses design and implementation in source code. It is
important that objects in the analysis phase can be found back during construction. This
is called traceability. Besides traceability, components are important during
construction. A component is an already defined piece of source code that can be used
for implementing objects.
In testing the system is verified, meaning that the correctness of the system is
checked according to its specifications.
Reusability :
Using OOSE technique referred by Ivar Jaccobson, we design the system in such a way
that modules of the current system can be directly adopted in designing new system.
OOSE combines object-oriented programming & conceptual modeling concepts.
From object-oriented programming, OOSE mainly uses the concepts of
encapsulation, inheritance and relationships between classes and instances.
Conceptual modeling is used to create different models of the system or organization to
be analyzed with respect to dynamic behavior.
The building blocks or objects can be reuse for designing a model for any application.
By organizing the analysis and design models around sequences of user interaction and
actual usage scenarios, the method produces systems that are more robust and usable,
adapting more easily to changing usage.
For reusability, documentation of all aspects (use case, building blocks, objects, classes,
etc) is required in each phase.
Page 200 of 200