9) Unit 1 Notes
9) Unit 1 Notes
9) Unit 1 Notes
B.tech 3rd Year OOSD (Dr. A.P.J. Abdul Kalam Technical University)
OBJECT ORIENTED SYSTEM DESIGN (BCS - 054)
TOPIC:
Introduction: The meaning of Object Orientation, object identity, Encapsulation, information hiding, polymorphism,
generosity, importance of modelling, principles of modelling, object oriented, modelling, Introduction to UML,
conceptual model of the UML, Architecture.
Object Oriented System Design
Introduction
Systems development is the process of defining, designing, testing, and implementing a new software application or
program. It helps to create an efficient system and identify the areas of improvement.
Programming is used as a tool for System Development.
Studying OOSD is essential because it offers a structured and efficient approach to software development.
Understanding the principles of Object Orientation and Object−Oriented Modeling provides a solid foundation for
creating modular, maintainable, and scalable software systems. I t promotes better code organization and fosters a
natural mapping between real−world entities and software entities.
Need of Object-Oriented Design
The main aim of Object−Oriented Design (OOD) is to improve the quality and productivity of system analysis and
design by making it more usable. It identifies the objects in problem domain, classifying them in terms of data and
behavior.
Studying OOSD is essential because it offers a structured and efficient approach to software development.
Understanding the principles of Object Orientation and Object−Oriented Modeling provides a solid foundation for
creating modular, maintainable, and scalable software systems. It promotes better code organization and fosters a
natural mapping between real−world entities and software entities.
Detail Description of Object-Oriented System Design
The goal of System Design is to create a design that meets the user requirements and supports the business processes.
There are mainly two approaches of system / software development, procedural and object−oriented approach.
Procedure Oriented Approach
For example, a program may involve collecting data from user, performing some kind of calculation on that data and
printing the data on screen when is requested. Calculating, reading or printing can be written in a program with the
help of different functions on different tasks.
In the procedural approach some data is local i.e., within the scope of the function, while there is a need to keep
some data as global which is shared among all the modules. So, thereare chances of accidental modification of global
data that may violate the security of data.
Each function has its own local data and common global data, as shown in Fig. 2.
An OOP method differs from POP in its basic approach itself. All the best features of structured of OOP is developed by
retaining the programming method, in which they have added number of concepts which makes efficient
programming. Object oriented programming methods have number of features and it makes possible an entirely new
way of approaching a program. This has to be noted that OOP retains all best features of POP method like
functions/sub routines, structure etc.
The Advantages And Disadvantages Of OOP are:-
Advantages of OOP:
1. Reusability: OOP allows developers to create code that can be reused in different parts of an application.
This makes development faster and more efficient because developers do not have to write new code from scratch
each time they need to create a new feature.
2. Modularity: OOP allows developers to break down complex systems into smaller, more manageable
modules. This makes it easier to develop, test, and maintain code because changes made to one module do not
affect other parts of the system.
3. Encapsulation: OOP allows developers to hide the implementation details of objects, making it easier to
change the behavior of an object without affecting other parts of the system. This also improves security by limiting
access to sensitive data.
4. Inheritance: OOP allows developers to create new classes by inheriting characteristics from existing
classes. This reduces the amount of code that needs to be written and makes it easier to maintain the codebase.
Disadvantages of OOP:
1. Steep Learning Curve: OOP is a complex paradigm, and it can take time for developers to become
proficient in it. The concepts of inheritance, polymorphism, and encapsulation can be difficult to understand for
beginners.
2. Overhead: OOP code can be more verbose than code written in other paradigms, which can result in
slower performance. Additionally, OOP often requires more memory and processing power than other paradigms.
3. Complexity: OOP can lead to complex code, especially when dealing with large systems that have many
interdependent objects. This complexity can make it more difficult to debug and maintain code.
4. Limited Reusability: Although OOP allows for code reusability, it can also lead to tightly coupled code that
is difficult to reuse in other contexts. This can make it challenging to maintain the codebase in the long run.
Difference between Object Oriented Approach and Procedure Oriented Approach
1 Definition OOP stands for Object Oriented POP stands for Procedural
Programming. Oriented Programming.
The object−oriented approach, however, focuses on objects that represent abstract or concrete things in the real
world. These objects are first defined by their character and their properties, which are represented by their internal
structure and their attributes (data). The behaviour of these objects is described by methods (functions).
Objects form a capsule, which combines the characteristics with behaviour. Objects are intended to enable
programmers to map a real problem and its proposed software solution on a one−to−one basis.
Fig 4. POP and OOP
Object examples can be, 'Customer', 'Order', or 'Invoice'.
Concepts of OOP
The OOPs concepts helps the programmers to analyse the real−world problem and implementit in terms of programming
language.
Features of Object Oriented Programming
Object
An object is anything in the real−world. It exists in the form of physical or abstract. For example, it may represent a person,
animal, bird or anything. For example: Elephant, Lion is an object.
Object identity is a fundamental object orientation concept. Object Identity describes the property of Objects that
distinguishes it from other Objects. Identity is a property of an object that distinguishes the object from all other
objects in the application.
Object Identity Identity
a123 a125
Class is a group of similar types of objects, having similar features and behaviour. In the following Figure different
objects exists in the real world and based on the common features these are categorized into different classes Car,
Flower and Person.
Class is used to describe the structure of objects that how the objects will look likes. Class isalso a pattern or
template which produces similar kind of objects. Class has data members (attributes) and behavior shown by object
also called functionality.
.
Fig.8 Data−Member and Functions of a Class
Encapsulation
Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code
and the data it manipulates. Another way to think about encapsulation is, it is a protective shield that prevents the
data from being accessed by the code outside this shield.
Fig.9. Encapsulation
Examples of Encapsulation:
⮚ School bag is one of the most real examples of Encapsulation. School bag can keep ourbooks, pens, etc.
⮚ In network communication, the data is encapsulated in a single unit in the form of packets. These packets
are delivered over the network.
Fig. 10. Encapsulation in Object−Oriented Approach:
Information Hiding
Information hiding is a powerful OOP feature. Information hiding is closely associated with encapsulation.
Information or data hiding is a programming concept which protects the data from directmodification by other
parts of the program.
Information hiding includes a process of combining the data and functions into a single unitto conceal data within a
class by restricting direct access to the data from outside the class. “Hiding object details (state + behaviour) of a
class from another class”
Real Life Example of Information Hiding:
1. My Name and personal information is stored in My Brain, nobody can access this information directly. For
getting this information you need to ask me about it and it will be up to myself that how much details I
would like to share with you.
2. Facebook may have millions of user accounts. Facebook is just like a Class, it has Private, Public and
Protected members. In private, there may be inbox, some personalphoto or
3. video. In public, it may be some post, or user information like d.o.b, where you live etc and in protected
there may be some post that only your friend can see, and it’s hidden from public.
In object−oriented approach we have objects with their attributes and behaviours that are hidden from other
classes, so we can say that object−oriented programming follows the principle of information hiding.
class Book
String book_title;
String author_name;
+ openBook()
+ closeBook()
+ readBook()
class Student
{
private:
c
h
public: a
}; r
n
a
m
e
[
3
0
]
;
i
n
t
m
a
r s
k ;
void display(); int
main()
{
Student s;
s.marks = 50; // Compilation Error – Not Accessible as the member is private return 0;
}
The accessibility often plays an important role in information hiding. Here the data element marks are private
element and thus it cannot be accessed by main function or any other function except the member function
display() of class student. To make it accessible in mainfunction, it should be made a public member.
Advantages of Information Hiding:
1. It ensures exclusive data access and prevents intended or unintended changes in thedata.
2. It helps in reducing system complexity and increase the robustness of the program.
3. It heightens the security against hackers that are unable to access confidential data.
4. It prevents programmers from accidental linkage to incorrect data.
It may sometimes force the programmer to use extra coding for creating effects for hiding thedata.
Introduction to UML:
Unified Modeling Language (UML) is a general purpose modelling language. The main aim of UML is to define a
standard way to visualize the way a system has been designed. It is quite similar to blueprints used in other fields of
engineering. UML is not a programming language,it is rather a visual language. We use UML diagrams to portray the
behavior and structure of a system. UML helps software engineers, businessmen and system architects with
modelling, design and analysis. The Object Management Group (OMG) adopted Unified Modelling Language as a
standard in 1997. Its been managed by OMG ever since. International Organization for Standardization (ISO)
published UML as an approved standard in 2005.
Three Aspects of UML:
Goals of UML:
There are a number of goals for developing UML but the most important is to define some general− purpose
modelling language, which all modellers can use and it also needs to be made simple to understand and use.
UML diagrams are not only made for developers but also for business users, common people, and
anybody interested to understand the system.
The system can be a software or non−software system. Thus it must be clear that UML is not a development method
rather it accompanies with processes to make it a successful system.
Things:Things are the abstractions that are first−class citizens in a model; relationships tie these
things together; diagrams group interesting collections of things.
There are 4 kinds of things in the UML:
1. Structural things
2. Behavioral things
3. Grouping things
4. Annotational things
A) Structural Things: Structural things are the nouns of UML models. These are the mostly static parts of a model,
representing elements that are either conceptual or physical. In all, there are seven kinds of structural things.
1. Class: A class is used to represent set of objects sharing similar properties and behaviour. It is used to define
the properties and operations of an object. A class whose functionalities are not defined is called an abstract class.
Any UML class diagram notations are generally expressed as below UML class diagrams example,
,
UML Class Symbol
2. Object: An object is an entity which is used to describe the behaviour and functions of a system. The class
and object have the same notations. The only difference is that an object name is always underlined in UML.
The UML notation of any object is given below.
3. Interface: An interface is similar to a template without implementation details. A circle notation represents
it. When a class implements an interface, its functionality is also implemented.
4. Collaboration: It is represented by a dotted ellipse with a name written inside it.
5. Use-case: Use−cases are one of the core concepts of object−oriented modelling. They are used to represent
high−level functionalities and how the user will handle the system.
6. Actor: It is used inside use case diagrams. The Actor notation is used to denote an entity that interacts with
the system. A user is the best example of an actor. The actor notation in UML is given below.
7. Component: A component notation is used to represent a part of the system. It is denoted in UML like given
below,
8. Node: A node is used to describe the physical part of a system. A node can be used to represent a network,
server, routers, etc. Its notation is given below.
Behavioural Things:
Behavioural things are the dynamic parts of UML models. These are the verbs of a model, representing behaviour over
time and space. In all, there are two primary kinds of behavioural things.
1. Messages: An interaction is a behaviour that comprises a set of messages exchanged among a set of objects
within a particular context to accomplish a specific purpose. Graphically, a message is rendered as a directed line,
almost always including the name of its operation display.
2. States: A state machine is a behaviour that specifies the sequences of states an object or an interaction goes
through during its lifetime in response to events, together with its responses to those events.
Grouping Things: Grouping things are the organizational parts of UML models. These are the boxes into which a
model can be decomposed. There is one primary kind of grouping thing, namely, packages.
Packages: A package is a general−purpose mechanism for organizing elements into groups. Graphically, a package is
rendered as a tabbed folder, usually including only its name and, sometimes, its contents.
Annotational Things: Anntational things are the explanatory parts of UML models. These are the comments you may
apply to describe, illuminate, and remark about any element in a model. There is one primary kind of annotation
thing, called a note. A note is simply a symbol for rendering constraints and comments attached to an element or a
collection of elements.
Relationships in the UML
It illustrates the meaningful connections between things. It shows the association between the entities and defines
the functionality of an application. There are four kinds of relationships in the UML:
1. Dependency
2. Association
3. Generalization
4. Realization
1. Dependency is a semantic relationship between two model elements in which a change to one element (the
independent one) may affect the semantics of the other element (the dependent one). Graphically, a dependency is
rendered as a dashed line, possibly directed, and occasionally including a label.
2. Association is a structural relationship among classes that describes a set of links, a link being a connection
among objects that are instances of the classes. Graphically, an association is rendered as a solid line, possibly
directed, occasionally including a label, and often containing other adornments, such as multiplicity and end names.
to the parent.
4. Realization is a semantic relationship between classifiers, wherein one classifier specifies a contract that
another classifier guarantees to carry out. Generalization and a dependency relationship.
UML Diagrams
Any real−world system is used by different users. The users can be developers, testers, business people, analysts, and
many more. Hence, before designing a system, the architecture is made with different perspectives in mind. The
most important part is to visualize the system from the perspective of different viewers. The better we understand
the better we can build the system. A diagram is the graphical presentation of a set of elements, most often
rendered as a connected graph of vertices (things) and paths (relationships).
• A diagram represents an elided view of the elements that make up a system.
• In theory, a diagram may contain any combination of things and relationships.
UML plays an important role in defining different perspectives of a system. These perspectives are
−
• Design
• Implementation
• Process
• Deployment
❖ The center is the Use Case view which connects all these four. A Use Case represents the functionality of the
system. Hence, other perspectives are connected with use case.
❖ Design of a system consists of classes, interfaces, and collaboration. UML provides class diagram, object
diagram to support this.
❖ Implementation defines the components assembled together to make a complete physical system. UML
component diagram is used to support the implementation perspective.
❖ Process defines the flow of the system. Hence, the same elements as used in Design are also used to
support this perspective.
❖ Deployment represents the physical nodes of the system that forms the hardware.
UML deployment diagram is used to support this perspective. The UML includes nine kinds of diagrams:
1. Class diagram
2. Object diagram
3. Use case diagram
4. Sequence diagram
5. Collaboration diagram
6. State−chart diagram
7. Activity diagram
8. Component diagram
UML- Architecture
Software architecture is all about how a software system is built at its highest level. It is needed to think big from
multiple perspectives with quality and design in mind. The software team is tied to many practical concerns, such as:
• The structure of the development team.
• The needs of the business.
• The intent of the structure itself.
Software architecture provides a basic design of a complete software system. It defines the elements included in the
system, the functions each element has, and how each element relates to one another. In short, it is a big picture or
overall structure of the whole system, how everything works together.
To form an architecture, the software architect will take several factors into consideration:
• What will the system be used for?
• Who will be using the system?
• What quality matters to them?
• Where will the system run?
In addition, a clear architecture will help to achieve quality in the software with a well−designed structure using
principles like separation of concerns; the system becomes easier to maintain,reuse, and adapt. The software
architecture is useful to people such as software developers, the project manager, the client, and the end−user. Each one
will have different perspectives to view the system and will bring different agendas to a project. Also, it provides a
collection of several views. It can be best understood as a collection of five views:
1. Use case view
2. Design view
3. Implementation view
4. Process view
5. Development view
Implementation View
1. It is the view that represents the organization of the core components and files.
2. It primarily addresses the configuration management of the system’s releases.
3. With UML, its static aspects are expressed in component diagrams, and the dynamic aspects
are captured in interaction diagrams, state chart diagrams, and activity diagrams.
Process View
1.It is the view that demonstrates the concurrency of the system.2.
It incorporates the threads and processes that make concurrent system and synchronized mechanisms.
3. It primarily addresses the system's scalability, throughput, and performance.
4. Its static and dynamic aspects are expressed the same way as the design view but focus more on
the active classes that represent these threads and processes.
Deployment View
1. It is the view that shows the deployment of the system in terms of physical architecture.
2. It includes the nodes, which form the system hardware topology where the system will be
executed.
3. It primarily addresses the distribution, delivery, and installation of the parts that build the
physical system.
Advantages and Disadvantages of UML:
COURSE OUTCOMES of Unit 1
After the completion of the course, students should be able to:
1. Select the basic elements of modelling such as Things, Relationships and Diagrams depending on the views of
UML Architecture.
2. Apply basic and Advanced Structural Modelling Concepts for designing real time applications.
3. Design Class and Object Diagrams that represent Static Aspects of a Software System.
4. Analyze Dynamic Aspects of a Software System using Use Case, Interaction and Activity Diagrams.
5. Implementation Diagrams to model behavioural aspects and Runtime environment of Software Systems.