0% found this document useful (0 votes)
15 views

Lecture 1

The document discusses object oriented design and its key concepts including classes, objects, encapsulation, inheritance, polymorphism and abstraction. It provides examples of classes like Mobile and objects like specific phones. It also discusses implementing object oriented design principles in real world scenarios like modeling a cell phone using classes, objects, inheritance and other concepts.

Uploaded by

Rohit Kumar
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)
15 views

Lecture 1

The document discusses object oriented design and its key concepts including classes, objects, encapsulation, inheritance, polymorphism and abstraction. It provides examples of classes like Mobile and objects like specific phones. It also discusses implementing object oriented design principles in real world scenarios like modeling a cell phone using classes, objects, inheritance and other concepts.

Uploaded by

Rohit Kumar
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/ 28

UNIVERSITY INSTITUTE OF ENGINEERING

DEPARTMENT OF AIT - CSE


Bachelor of Engineering (CSE)
Advanced Programming (CST-346)
By: Dr. Rahul Rastogi(E10843)

Lecture -1 DISCOVER . LEARN . EMPOWER


Introduction to Object Oriented Design 1
Chapter Course Objectives

This subject aims to focuses on Advanced concept of C++ and advanced data structure to
1.
students. It focuses on advanced level analysis of algorithm and computational mathematics.

Chapter Course Outcomes


• Explain the data structure and OOPS concepts using C++.
• Apply the shortest path and minimum spanning algorithms in computer networks.
• Examine the complexity of searching and sorting algorithms, and optimization through
arrays, linked structures, stacks, queues, trees, and graphs.
1.
• Decide and implement an appropriate graph algorithm and hashing function in computer
networks for data security.
• Construct security encryption and decryption algorithms using computational mathematics
and graph algorithm. 2
Contents
 Object Oriented Design mechanism

3
Object Oriented Design

4
Motive
 To explain how a software design maybe represented as a set of
interacting objects that manage their own state and operations.

 To introduce various models that describe an object-oriented design

To introduce various design patterns.

5
What is class?
We can define a class by following ways:
An abstract data type.
or
A template data.
or
Collections of rules
or
Collection of different data types and certain functions which acts on
that data.

6
Example of class?

Name: Human
_____________________
Data types: height, length
weight etc.
_____________________
Functions:
walk(),speak(),movehand(),
smell() etc..

7
What is Object?
We can define a Object by following ways:

An instance of class


or
Real world entity.

*Every object have its own memory area known as context area of an
object.
“Creation of Object means providing the memory to the member of
classes”

8
• Class text
•{
• Int I ,j ,k;
• Meth()
•{ I,j,k
• //FUNCTIONALITY Meth()
•}
•}

• Text ob;
• Text *ob=new Text() Context area of an Object

9
Example of Object?

Peter

Human is generalization of Peter

10
Characteristics of OOD
 Objects are abstractions of real-world or system entities and
manage themselves.
 Objects are independent and encapsulate state and
representation information.
 System functionality is expressed in terms of object services
 Shared data areas are eliminated
 Objects may be distributed
 Objects communicate by message passing
 Objects may execute sequentially or in parallel

11
Object Oriented Paradigm
Following are the paradigm of OOPs:
• Encapsulation
• Inheritance
• Polymorphism

**Abstraction (generic concept not limited to OOPs)

12
Encapsulation
“Wrapping up data and function into a single unit is termed as
Encapsulation”.
We achieve data hiding fundamental form encapsulation (various
access modifiers).
E.g. Class.
class: login
______________________________
Variables:User name ,password
(private accessibility)
______________________________
Function:login(username,password)

13
Inheritance
“To achieve the properties (except private) form parent class (super
class ) to child class (sub class) is known as inheritance”.
“By inheritance a class, one is creating the same nomenclature of child
class as of its parent class ”.
Five types of inheritance are possible:
Single inheritance
Multilevel Inheritance
Multiple Inheritance
Hybrid Inheritance
Hierarchical Inheritance
14
[1]
15
Polymorphism
“One thing can be represented in many form is known polymorphism” .
We have two types of polymorphism:

• Compile Time polymorphism (Early Binding)


E.g. Constructor Overloading, Function Overloading
• Run Time polymorphism(Late Binding)
E.g. Function Overriding

“Super class reference variable can refer to the object of its subclass”

16
Class Abc Class test extends Abc
{ {
Void Abc() Void Abc()
{ {
fun1 fun2
} }
Main() }
{

ob.Abc()

}
}
17
Abstraction
“Hiding the complexity and showing essential feature”.
“A generic concept not limited to OOPs”.
E.g. Mobile phone. How my phone works internally
but I know how to make calls.

18
Implementation of OOD (Real Scenario)
Let's have an example of cell phone. Cell phone is treated as an object,
was invented for calling and messaging. But now numerous features are
adding day by day and still in progress. In figure each type of mobile
have its own features along with basic functionality.

Mobile

Symbian Android Mac

19
Implementation of OOD (Real Scenario)
Contd… class: Mobile
______________________________
Class : Properties:
A plan which describes the objects.  No_Sim_slots
 IEMIcode
 Processor
Object:
______________________________
Mobile ob1=new Mobile(); Methods:
Mobile ob2=new Mobile(); Dial
Each object can behave different Connect_wifi
ConnectBluetooth
as per their characteristics. SendMessage
Recievemessage
20
Implementation of OOD (Real Scenario)
Contd…
A principle known as SOLID needs to be satisfied while creating a class:
1. SRP( The Single Responsibility Principle):A class should have one, and
only one responsibility.
2.OCP (The Open Closed Principle) - You should be able to extend a
classes behavior, without modifying it. (Inheritance)
3.LSP (The Liskov Substitution Principle) - Derived classes must be
substitutable for their base classes. (Polymorphism)
4.ISP (The Interface Segregation Principle) -Make fine chopped
interface instead of huge interface as client cannot be forced to
implement an interface which they don't use.
5.DIP (The Dependency Inversion Principle) - Depend on abstractions, 21
Implementation of OOD (Real Scenario)
Contd…
Abstraction:
To call anybody we just dial a number showed on screen but how we
don’t bother to know.
Press green icon to connect but we are unaware how it is doing.
Ex. Public void dial() /* Called by user without knowing the internal working*/
{
//certain logic to display the number
println(“Dial a number”);
}
22
Implementation of OOD (Real Scenario)
Contd…
Encapsulation:

Class :
Private IMEI mobile
code Instance
Public :
variable
Instance
Variable
Private methods

23
Implementation of OOD (Real Scenario)
Contd… Class Samsung: Mobile
{
Polymorphism: Public void dial()
Ex. {
println(“Dial a number”);
}
Public void dial( String mode)
{
println(“Dial a number with video”);
}
/*method overloading*/
}

24
Implementation of OOD (Real Scenario)
Contd…
Inheritance: Achieve reusability

Mobile Mobile Mobile

Samsung Samsung Samsung Oppo

Single Hierarchal

Samsung A9
25
Multilevel
Conclusion
By above example we can conclude by using four pillars of OOPs we can
develop a good program and connecting it with real world.

26
References
Images link-
[1] https://simplesnippets.tech/inheritance-in-java-types-of-inheritance/
Online Video Link-
• https://nptel.ac.in/courses/106/105/106105151/
Research Paper:
• http://onlinepubs.trb.org/Onlinepubs/trr/1993/1408/1408-012.pdf
• https://www.researchgate.net/publication/327633163_ADVANCE-RABIN_KARP_ALGORITHM_FOR_STRING_MATCHING
• https://glossary.informs.org/notes/spanningtree.pdf

Textbooks / Reference Books


1.Competitive Programmer’s Handbook by Antti Laaksonen ISBN-10:3319725467, Springer Publishers.
2.“Introduction to Algorithms (Eastern Economy Edition)” by Thomas H Cormen and Charles E Leiserson ISBN-10:
9788120340077, PHI Learning Pvt. Ltd.
3.Data Structures Using C and C++ by Aaron M Tenenbaum ISBN-10: 9332549311, Pearson Education India.
4.Applied Asymptotic Analysis (Graduate Studies in Mathematics) ISBN-10: 082184-789, American Mathematical
Society.
5.“The Algorithm Design Manual” by Steven S. Skiena ISBN-10:1849967202, Springer Publishers
6. “Data Structures and Algorithms Made Easy: Data Structures and Algorithmic Puzzles” by Narasimha Karumanchi
ISBN-10: 819324527X CareerMonk Publications
7. “Algorithms” by Robert Sedgewick and Kevin Wayne ISBN10 032157351X Addison-Wesley Professional
8. “Advanced Data Structures” by Peter Brass ISBN-10 0521880378 Cambridge University Press
27
THANK YOU

For queries
Email: [email protected]
28

You might also like