MCS 032
MCS 032
Session 2019-20
Course Code : MCS-032
Course Title : Object Oriented Analysis and Design
Assignment Number : MCA (III)/032/Assignment/2019-20
Maximum Marks : 100
Last Date of Submission : 31st October, 2019 (For July, 2019 Session)
15th April, 2020 (For January, 2020 Session)
Note: – These answers should just be treated as reference, not the final answer
to be written in assignments. Just do not directly copy it in your assignments
Q1. What is OOAD? Explain concepts of objects and class with the help of examples and
diagrams.
Ans 1:
Object-oriented analysis and design (OOAD) is a popular technical approach for analyzing and designing
an application, system, or business by applying object-oriented programming, as well as using visual
modeling throughout the development life cycles to foster better stakeholder communication and
product quality.
What is Class?
A class is an entity that determines how an object will behave and what the object will contain. In other
words, it is a blueprint or a set of instruction to build a specific type of object.
Syntax
class <class_name>{
field;
method;
}
What is an Object?
An object is nothing but a self-contained component which consists of methods and properties to make
a particular type of data useful. Object determines the behavior of the class. When you send a message
to an object, you are asking the object to invoke or execute one of its methods.
From a programming point of view, an object can be a data structure, a variable or a function. It has a
memory location allocated. The object is designed as class hierarchies.
Syntax
You need to model real-life beings, i.e., dogs into software entities.
Moreover, the million dollar question is, how you design such software? Here is the solution-
You can see the picture of three different breeds of dogs below.
Stop here right now! List down the differences between them.
Some of the differences you might have listed out maybe breed, age, size, color, etc. If you think for a
minute, these differences are also some common characteristics shared by these dogs. These
characteristics (breed, age, size, color) can form a data members for your object.
Next, list out the common behaviors of these dogs like sleep, sit, eat, etc. So these will be the actions of
our software objects. So far we have defined following things,
Class - Dogs
Data members or objects- size, age, color, breed, etc.
Methods- eat, sleep, sit and run.
Now, for different values of data members (breed size, age, and color) in class, you will get different dog
objects.
You can design any program using this OOPs approach.
While creating a class, one must follow the following principles.
Single Responsibility Principle (SRP)- A class should have only one reason to change
Open Closed Responsibility (OCP)- It should be able to extend any classes without modifying it
Liskov Substitution Responsibility (LSR)- Derived classes must be substitutable for their base classes
Dependency Inversion Principle (DIP)- Depend on abstraction and not on concretions
Interface Segregation Principle (ISP)- Prepare fine grained interfaces that are client specific.
Q2. What is message passing? Explain links and associations with the help of examples and
diagrams.
Ans 2: message passing is a technique for invoking behavior (i.e., running a program) on a computer. The
invoking program sends a message to a process (which may be an actor or object) and relies on the
process and the supporting infrastructure to select and invoke the actual code to run. Message passing
differs from conventional programming where a process, subroutine, or function is directly invoked by
name. Message passing is key to some models of concurrency and object-oriented programming.
Message passing is used ubiquitously in modern computer software. It is used as a way for the objects
that make up a program to work with each other and as a means for objects and systems running on
different computers (e.g., the Internet) to interact. Message passing may be implemented by various
mechanisms, including channels.
The logical and physical connection between objects is known as links. On the other hand, a collection of
links are specified by an association. The common function of a link is to describe the relationship
between objects and connect them with each other. In contrast, an association is used to connect
related classes.
For example, the project management system involves various general relationships, including manage,
lead, execute, input, and output between projects, managers, teams, work products, requirements, and
systems. Consider, for example, how a project manager leads a team
1 Binary associations
A binary association relates two classes. For example, one binary relationship in the project
management system is between individual workers and their units of work, and another binary
relationship is between individual workers and their work products.
In a UML class diagram, a binary association is shown as a solid-line path connecting the two related
classes. A binary association may be labeled with a name. The name is usually read from left to right and
top to bottom; otherwise, it may have a small black solid triangle next to it where the point of the
triangle indicates the direction in which to read the name, but the arrow is purely descriptive, and the
name of the association should be understood by the classes it relates.
Figure shows various associations within the project management system using the most basic notation
for binary associations. The associations in the figure are as follows:
A worker is responsible for work products and performs units of work Units of work consume work
products as input and produce work products as output.
Notice that a binary association should be named using a verb phrase. Recall from Chapter 2 that you
discover associations by focusing on verbs.
Q3. What are activities in Object Oriented Analysis? Critically explain challenges in Object
Identification. Also explain concept of objects identity and persistent objects.
Ans 3; Object oriented analysis:
Analysis is the first stage of the development process. It is also the first step in producing high-
performance software. Analysis is central to the performance tuning process.
Identify classes
1. Actor’s identification
Occlusion: Objects like dogs or cats can be hidden behind one another, as a result, the features that can
be extracted from them are not strong enough to say that they are an object.
Viewpoint changes: In cases of different viewpoints of an object, the shape may change drastically and
hence the features of the object will also change drastically. This causes a detector which is trained to
see a given object from one viewpoint to fail on seeing it from other viewpoints.
Object identity is a fundamental object orientation concept. With object identity, objects can contain or
refer to other objects. Identity is a property of an object that distinguishes the object from all other
objects in the application.
There are many techniques for identifying objects in programming languages, databases and operating
systems. According to the authors the most commonly used technique for identifying objects is user-
defined names for objects. There are of course practical limitations to the use of variable names without
the support of object identity.
To identify an object with a unique key (also called identifier keys) is a method that is commonly used in
database management systems. Using identifier keys for object identity confuses identity and data
values. According to the authors there are three main problems with this approach:
1. Modifying identifier keys. Identifier keys cannot be allowed to change, even though they are user-
defined descriptive data.
2. Non-uniformity. The main source of non-uniformity is that identifier keys in different tables have
different types or different combinations of attributes. And more serious problem is that the attribute(s)
to use for an identifier key may need to change.
3. "Unnatural" joins. The use of identifier keys causes joins to be used in retrievals instead of simpler and
more direct object retrievals.
A persistent object is an object that has been assigned a storage location in a federated database. When
you commit the transaction in which you create a persistent object, that object's data is saved in the
database; the object can then be accessed by other processes. A persistent object continues to exist
beyond the duration of the process that creates it. In contrast, a transient object exists only within the
memory of the process that creates it; when that process terminates, the transient object ceases to exist.
Q4. Draw a sequence diagram for online transmission of video lecture from a Studio.
Make necessary assumptions.
Ans 4:
Q5. What is UML? Briefly explain different types of UML diagrams. Explain advantages of
using UML .
Ans : The Unified Modeling Language (UML) is a general-purpose, developmental, modeling language in
the field of software engineering that is intended to provide a standard way to visualize the design of a
system.
The creation of UML was originally motivated by the desire to standardize the disparate notational
systems and approaches to software design. It was developed by Grady Booch, Ivar Jacobson and James
Rumbaugh at Rational Software in 1994–1995, with further development led by them through 1996.
The current UML standards call for 13 different types of diagrams: class, activity, object, use case,
sequence, package, state, component, communication, composite structure, interaction overview,
timing, and deployment.
These diagrams are organized into two distinct groups: structural diagrams and behavioral or interaction
diagrams.
Class diagram
Package diagram
Object diagram
Component diagram
Deployment diagram
Activity diagram
Sequence diagram
State diagram
Communication diagram
Timing diagram
Class Diagram
Class diagrams are the backbone of almost every object-oriented method, including UML. They describe
the static structure of a system.
Package Diagram
Package diagrams are a subset of class diagrams, but developers sometimes treat them as a separate
technique. Package diagrams organize elements of a system into related groups to minimize
dependencies between packages.
Object Diagram
Object diagrams describe the static structure of a system at a particular time. They can be used to test
class diagrams for accuracy.
Component Diagram
Component diagrams describe the organization of physical software components, including source code,
run-time (binary) code, and executables.
Deployment Diagram
Deployment diagrams depict the physical resources in a system, including nodes, components, and
connections.
Activity Diagram
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.
Sequence Diagram
Sequence diagrams describe interactions among classes in terms of an exchange of messages over time.
Use Case Diagram
Use case diagrams model the functionality of a system using actors and use cases.
State Diagram
Statechart diagrams, now known as state machine diagrams and state diagrams describe the dynamic
behavior of a system in response to external stimuli. State diagrams are especially useful in modeling
reactive objects whose states are triggered by specific events.
Communication Diagram
Communication diagrams model the interactions between objects in sequence. They describe both the
static structure and the dynamic behavior of a system. In many ways, a communication diagram is a
simplified version of a collaboration diagram introduced in UML 2.0.
Interaction overview diagrams are a combination of activity and sequence diagrams. They model a
sequence of actions and let you deconstruct more complex interactions into manageable occurrences.
You should use the same notation on interaction overview diagrams that you would see on an activity
diagram.
Timing Diagram
A timing diagram is a type of behavioral or interaction UML diagram that focuses on processes that take
place during a specific period of time. They're a special instance of a sequence diagram, except time is
shown to increase from left to right instead of top down.
Advantages of UML
What this implies is that you need to know just 20% of the UML language to explain 80% of your
modeling needs. You do not need to know or comprehend the entire notation, to communicate
effectively using UML diagrams. Knowing a subset of the notation equips you just fine.
Q6. Draw class diagram for Online admission system in Graduation Programmes of an Open
University, which offer admission to the students on the basis of merit list created using
marks obtained at 10+2 level. Make necessary assumptions.
Ans :
Q7. Draw a DFD for Online Banking System. Make necessary assumptions required.
Ans :
Q8. What is state diagram? Draw state diagram for online Train Ticket
Booking. Make necessary assumptions required.
Ans
A state diagram is a type of diagram used in computer science and related fields to describe the
behavior of systems. State diagrams require that the system described is composed of a finite
number of states; sometimes, this is indeed the case, while at other times this is a reasonable
abstraction.