0% found this document useful (0 votes)
12 views49 pages

Unit 1

The document provides an overview of Object-Oriented System Design, covering key concepts such as object orientation, encapsulation, inheritance, polymorphism, and the importance of modeling in software development. It explains the principles of Object-Oriented Programming (OOP), including the building blocks like classes, methods, attributes, and objects, while emphasizing the benefits of OOP such as reusability and easier debugging. Additionally, it discusses the significance of modeling in creating effective software systems, highlighting different types of UML diagrams used for structural, behavioral, and architectural modeling.

Uploaded by

razorquake2499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views49 pages

Unit 1

The document provides an overview of Object-Oriented System Design, covering key concepts such as object orientation, encapsulation, inheritance, polymorphism, and the importance of modeling in software development. It explains the principles of Object-Oriented Programming (OOP), including the building blocks like classes, methods, attributes, and objects, while emphasizing the benefits of OOP such as reusability and easier debugging. Additionally, it discusses the significance of modeling in creating effective software systems, highlighting different types of UML diagrams used for structural, behavioral, and architectural modeling.

Uploaded by

razorquake2499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

•UNIT-1

•Object Oriented System Design-


Introduction
•UNIT-1
•Introduction

•Object orientation

•Object Identity

•Encapsulation, Information Hiding, Polymorphism

•Generosity

•Importance of Modelling-Principles

•Object oriented modelling

•Introduction to UML-Conceptual model of UML

•Architecture
•Object Orientation
•Object-oriented analysis and design (OOAD) is a technical approach for
analyzing and designing an application, system, or business by applying object-
oriented programming, as well as using visual modelling throughout the software
development process to guide stakeholder communication and product quality.
•What does Object-oriented mean?
•Object-oriented refers to a programming language, system or software methodology that is built
on the concepts of logical objects.
•It works through the creation, utilization and manipulation of reusable objects to perform a
specific task, process or objective.
•The essence of object-oriented is that each of the created objects can be reused in the same and
other programs and applications.
•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 behavior of these
objects is described by methods (functions).
•Objects form a capsule, which combines the characteristics with behavior.
•Objects are intended to enable programmers to map a real problem and its proposed software
solution on a one-to-one basis.
•Object Oriented Programming
•Object Oriented programming (OOP) is a programming paradigm that
relies on the concept of classes and objects.
•It is used to structure a software program into simple, reusable pieces
of code blueprints (usually called classes), which are used to create
individual instances of objects.
•There are many object-oriented programming languages including
JavaScript, C++, Java, and Python.
•A class is an abstract blueprint used to create more specific, concrete
objects. Classes often
•For example, say we created a class car, to contain all the properties a
car must have, color, brand and model. We then create an instance of a
car type object, mica to represent my specific car.
•We could then set the value of the properties defined in the class to
describe my car, without affecting other objects or the class template.
•We can then reuse this class to represent any number of cars.

•Our car class may have a method repaint that changes the colour
attribute of our car. This function is only helpful to objects of type car, so
we declare it within the car class thus making it a method.
•Class templates are used as a blueprint to create individual objects.
These represent specific examples of the abstract class, like mica or
golden retriever. Each object can have unique values to the properties
defined in the class.
Class car{
String model, color, brand;
String repaint(colorchange)
{
color=colorchange;
Return color;
}
Func {}
}
main()
{
Car obj()
obj.model=xyz;
obj.color=blue;
obj.brand=hyundai;

Car obj1;
obj1.model=xyz;
obj1.color=blue;
obj1.brand=hyundai;
Obj.repaint(red);
}
•Uses of Object Orientation

•Below are some of the advantages of object-orientation:

• Complex software systems become easier to understand, since object-


oriented structuring provides a closer representation of reality than other
programming techniques.
• In a well-designed object-oriented system, it should be possible to
implement changes at class level, without having to make alterations at
other points in the system. This reduces the overall amount of
maintenance required.
• Using polymorphism and inheritance, object-oriented programming allows
you to reuse individual components.
• In an object-oriented system, the amount of work involved in revising and
maintaining the system is reduced, since many problems can be detected
and corrected in the design phase.
•Achieving these goals requires:

• Object-oriented tools Object-oriented tools allow you to create


object-oriented programs in object-oriented languages. They allow
you to model and store development objects and the relationships
between them. For example: class diagram, object diagrams, object
state diagrams etc.
• Object-oriented modeling The object-orientation modeling of a
software system is the most important, most time-consuming, and
most difficult requirement for attaining the above goals. Object-
oriented design involves more than just object-oriented
programming, and provides logical advantages that are independent
of the actual implementation.
• Object-oriented programming languages Object-oriented
programming techniques do not necessarily depend on object-
oriented programming languages. However, the efficiency of object-
oriented programming depends directly on how object-oriented
language techniques are implemented in the system kernel.
•Building blocks of Object Oriented Programming
• Classes
• Methods
• Attributes
• Objects
•Classes

•classes are essentially user defined data types. Classes are where we
create a blueprint for the structure of methods and attributes. Individual
objects are instantiated, or created from this blueprint.
•Classes contain fields for attributes, and methods for behaviours and
represent broad categories, like car or dog that share attributes.
•These classes define what attributes an instance of this type will have,
like color, but not the value of those attributes for a specific object.
•Classes can also contain functions, called methods available only to
objects of that type. These functions are defined within the class and
perform some action helpful to that specific type of object.
Objects

Objects are instances of classes created with specific data, for


example in the code snippet below Rufus is an instance of the dog
class.

The state of an object is defined by the data in the object’s attributes


fields.

For example, a puppy and a dog might be treated differently at pet


camp. The birthday could define the state of an object, and allow the
software to handle dogs of different ages differently.
•Methods: Methods represent behaviors. Methods perform actions;
methods might return information about an object, or update an object’s
data. The method’s code is defined in the class definition.

When individual objects are instantiated, these objects can call the
methods defined in the class.

Methods often modify, update or delete data.

Methods are how programmers promote reusability, and keep


functionality encapsulated inside an object. This reusability is a great
benefit when debugging. If there’s an error, there’s only one place to find
it and fix it instead of many.
•Attributes: Attributes are the information that is stored. Attributes are
defined in the class template. When objects are instantiated individual
objects contain data stored in the Attributes field.

The state of an object is defined by the data in the object’s attributes


fields.
• class Parrot:

• # class attribute
• String species = “bird"

• # instance attribute
• def __init__(self, name, age):
• self.name = name
• self.age = age# instantiate the Parrot class
•blu = Parrot("Blu", 10)

•woo = Parrot("Woo", 15)

•# access the class attributes

•print("Blu is a {}".format(blu.__class__.species))

•print("Woo is also a {}".format(woo.__class__.species))

•# access the instance attributes

•print("{} is {} years old".format( blu.name, blu.age))

•print("{} is {} years old".format( woo.name, woo.age))


•Four Principles of OOP
•The four pillars of object oriented programming are:

• Encapsulation: containing information in an object, exposing only


selected information.
• Inheritance: child classes inherit data and behaviors from parent
class.
• Abstraction: only exposing high level public methods for accessing
an object.
• Polymorphism: many methods can do the same task.
•Encapsulation
•Encapsulation in OOP Meaning: In object-oriented computer
programming languages, the notion of encapsulation (or OOP
Encapsulation) refers to the bundling of data, along with the methods
that operate on that data, into a single unit.
•Many programming languages use encapsulation frequently in the
form of classes.
•A class is a program-code-template that allows developers to create
an object that has both variables (data) and behaviors (functions or
methods).
•A class is an example of encapsulation in computer science in that it
consists of data and methods that have been bundled into a single
unit.
•Many programming languages use encapsulation frequently in the
form of classes.
•A class is a program-code-template that allows developers to create
an object that has both variables (data) and behaviors (functions
or methods).
•A class is an example of encapsulation in computer science in that it
consists of data and methods that have been bundled into a single
unit.
Information Hiding
•Information hiding is an important aspect of modularity, and reduces the
information content to only what is important.
•Information hiding is an important aspect to the abstraction of software.

•Specifically, consider that the final software system is the lowest level of
abstraction. All of the software's design details are present at this level.
Information hiding allows us to hide information unnecessary to a
particular level of abstraction within the final software system, allowing
for software engineers to better understand, develop and maintain the
software.
•We use software modules to implement information hiding: the
information contained in the modules should be hidden from those the
rest of the software system outside of the module, and access to this
hidden information should be carefully controlled. This allows us to
maintain a higher level of abstraction in our software, making our
•If information hiding is done well, changes made to the hidden portions
of a module should not affect anything outside of the module. This
allows the software engineers to more readily manage change
(including changes in the requirements).
•For example, a calculation producing a given result may be hidden. It
follows a model of functionality that can be described as a type of
information hiding.
•One advantage of information hiding is yielding flexibility, such as
allowing a programmer to more readily modify a program. This also may
be done by placing source code within modules for easy access in the
future, as the program develops and evolves.
•"Abstraction and encapsulation are complementary concepts:
abstraction focuses on the observable behavior of an
object...encapsulation focuses on the implementation that gives rise
to this behavior”
•an abstraction relates to how an object and its behaviors are
presented to the user and encapsulation is a methodology that helps
create that experience.
•Think about the interface of your mobile phone. Whether you use an
Android operating system or iOS, you don't interact directly with the
code that allows your phone to connect to the internet, send a text
message or play a video game. Instead, you interact with the code
through a user interface that is designed to streamline your
experience and make it easy to access the functions and methods you
need to complete a task. In this case, the interface is abstracted away
from the actual implementation of the code.
•Inheritance
•Inheritance allows classes to inherit features of other classes.

•Inheritance supports reusability.

•If basic attributes and behaviors are defined in a parent class, child
classes can be created extending the functionality of the parent class,
and adding additional attributes and behaviors.
•The benefits of inheritance are programs can create a generic parent
class, and then create more specific child classes as needed. This
simplifies overall programming, because instead of recreating the
structure of the class multiple times, child classes automatically gain
access to functionalities within their parent class.
•Types of Inheritance
✦Single Inheritance − A subclass derives from a single super-class.

✦Multiple Inheritance − A subclass derives from more than one super-classes.

✦Multilevel Inheritance − A subclass derives from a super-class which in turn is derived


from another class and so on.

✦Hierarchical Inheritance − A class has a number of subclasses each of which may have
subsequent subclasses, continuing for a number of levels, so as to form a tree structure.

✦Hybrid Inheritance − A combination of multiple and multilevel inheritance so as to form a


lattice structure.
•Polymorphism
•Polymorphism means designing objects to share behaviors. Using
inheritance, objects can override shared parent behaviors, with specific
child behaviors.
•Polymorphism allows the same method to execute different behaviors in
two ways: method overriding and method overloading.
•Method Overriding: Runtime polymorphism uses method
overriding. In method overriding, a child class can provide a
different implementation than its parent class.
•Method Overloading: Compile Time polymorphism uses method
overloading. Methods or functions may have the same name, but a
different number of parameters passed into the method call. Different
results may occur depending on the number of parameters passed in.
Example: Let us consider two classes, Circle and Square, each with a
method findArea(). Though the name and purpose of the methods in
the classes are same, the internal implementation, i.e., the procedure
of calculating area is different for each class. When an object of class
Circle invokes its findArea() method, the operation finds the area of the
circle without any conflict with the findArea() method of the Square
class.
•Benefits of OOP
• OOP models complex things as reproducible, simple structures

• Reusable, OOP objects can be used across programs


• Allows for class-specific behavior through polymorphism
• Easier to debug, classes often contain all applicable information to
them
• Secure, protects information through encapsulation
•Object Identity
•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.
•An object retains its identity even if some or all of the values of
variables or definitions of methods change over time.
•Several forms of identity:

◦ value: A data value is used for identity (e.g., the primary key of a
tuple in a relational database).
◦ name: A user-supplied name is used for identity (e.g., file name in
a file system).
◦ built-in: A notion of identity is built-into the data model or
programming languages, and no user-supplied identifier is
required (e.g., in OO systems).
•Object identity is typically implemented via a unique, system-
generated OID. The value of the OID is not visible to the external
user, but is used internally by the system to identify each object
uniquely and to create and manage inter-object references.
•The object identity of two objects of the same type is the same, if
every change to either object is also a change to the other object.
Modelling
•Model is a simplification of reality.

• Blueprint of the actual system.

• Specify the structure and behavior of the system.

• Templates for designing the system.

• Helps document the system.


•Advantages of modelling

•Provides standard for software development.

• Reducing of costs to develop diagrams of UML using supporting tools.

• Development time is reduced.

• The past faced issues by the developers are no longer exists.

• Has large visual elements to construct and easy to follow.


The three types of modeling in UML as follows:
1. Structural modeling:
• It captures the static features of a system.
• It consists of the following diagrams:

1. Classes diagrams
2. Objects diagrams
3. Deployment diagrams
4. Package diagrams
5. Composite structure diagram
6. Component diagram
• This model represents the framework for the system and all the components exist here.
• It represents the elements and the mechanism to assemble them.
• It never describes the dynamic behavior of the system.
2. Behavioral modeling
• It describes the interaction within the system.

• The interaction among the structural diagrams is represented here.

• It shows the dynamic nature of the system.

• It consists of the following diagrams:

1. Activity diagrams

2. Interaction diagrams

3. Use case diagrams


• These diagrams show the dynamic sequence of flow in the system.
3. Architectural modeling:
• It represents the overall framework of the system.

• The structural and the behaviour elements of the system are there in
this system.
• It is defined as the blue print for the entire system.

• Package diagram is used


Importance of Modelling
•Modeling is a central part of all activities that lead up to the deployment of good software. It is
required to build quality software.
•Importance of Modeling:

• Modeling gives graphical representation of system to be built.


• Modeling contributes to a successful software organization.
• Modeling is a proven and well accepted engineering technique.
• Modeling is not just a part of the building industry. It would be inconceivable to deploy a new
aircraft or an automobile without first building models-from computer models to physical wind
tunnels models to full scale prototypes.
• A model is a simplification of reality. A model provides the blueprint of a system.
• A model may be structural, emphasizing the organization of the system, or it may be
behavioral, emphasizing the dynamics of the system.
• Models are build for better understanding of the system that we are developing:
•Models help us to visualize a system as it is or as we want it to be.

•Models permit us to specify the structure or behavior of a system.

•Models give us a template that guides us in constructing a system.

•Models support the decisions we have made.


Principles of Modelling
• Principle 1: The model we choose have a profound influence on the
solution we provide.
✓Choose your models wisely.

✓The right models will simplify even the most wicked problem, offering
insights that couldn’t have been gained otherwise.
The wrong models will mislead us, causing to focus on irrelevant issues.
• Principle 2: Every model maybe expressed at different levels of
abstraction.
• Help the stakeholders visualise the look and feel of system.

• Example: An analyst or an end user will want to focus on issues of


what while a developer would like to address the issues of how.

• Principle 3: The best models are connected to reality.

In object oriented systems, it is possible to connect all the nearly


independent views of the system into one semantic whole.


• Principle 4: No single model is sufficient, a set of models is needed to solve any non-trivial
system
• To understand the architecture of such a system, we need several complementary and
interlocking views:

A use case view (exposing the requirements of system).

A design view (capturing the vocabulary of the problem space and solution space).

An interaction view (showing interaction among parts of the system and between
the system and environment).

An implementation (addressing the physical realization of the system).

A deployment view (focusing on system engineering issues).


Object Oriented Modelling
•In the object-oriented approach, the focus is on capturing the structure
and behavior of information systems into small modules that combines
both data and process. 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.

•In analysis phase, OO models are used to fill the gap between problem
and solution. It performs well in situation where systems are
undergoing continuous design, adaption, and maintenance. It identifies
the objects in problem domain, classifying them in terms of data and
behavior.
•The OO model is beneficial in the following ways −

• It facilitates changes in the system at low cost.


• It promotes the reuse of components.
• It simplifies the problem of integrating components to configure large
system.
• It simplifies the design of distributed systems.

Features of Object-Oriented System:


•Encapsulation

•Abstraction

•Relationships

•Inheritance

•Polymorphism
Elements of Object-Oriented System
• Objects − An object is something that is exists within problem domain and
can be identified by data (attribute) or behavior. All tangible entities
(student, patient) and some intangible entities (bank account) are modeled
as object.
• Attributes − They describe information about the object.
• Behavior − It specifies what the object can do. It defines the operation
performed on objects.
• Class − A class encapsulates the data and its behavior. Objects with similar
meaning and purpose grouped together as class.
• Methods − Methods determine the behavior of a class. They are nothing
more than an action that an object can perform.
• Message − A message is a function or procedure call from one object to
another. They are information sent to objects to trigger methods. Essentially,
a message is a function or procedure call from one object to another.

You might also like