View
249
Download
0
Category
Preview:
Citation preview
7/29/2019 Chap1 Oops
1/18
anuraggie-java@yahoo.co.in
Website: http://www.anuragkumar.co.nrNeed Technical Assistance?+919415793893
Gain your IT expertise from the expert
anuraggie-java@yahoo.co.in
Chapter-1
Object Oriented Programming Presented by Anurag Kumar
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
2/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Process Oriented Model Programs are written around What is happening i.e.
emphasis is on the procedure.
Procedural Languagesuch as C Languagefollows this
model.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
3/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Object Oriented Model Programs are written around Who is being affectedi.e.
emphasis is on data rather than the procedure.
Object Oreinted Languagessuch as Java, C++,
Smalltalk, Ada, ObjectPascalfollows this model.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
4/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Whats an Object An object is a software bundle of variables and related
methods.
These variables and methods are formally known as
instance variables and instance methods.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
5/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Whats a Class A class is a blueprint or prototype that defines the
variables and methods common to all objects of acertain kind.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
6/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Messages Software objects interact and communicate with each
other by sending messages to each other. When objectA wants object B to perform one of B's methods, object
A sends a message to object B.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
7/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
What makes a MessageThree components comprise a message:
1. The object to whom the message is addressed
2. The name of the method to perform
3. Any parameters needed by the method
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
8/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
The Benefits of Messages An object's behavior is expressed through its methods,
so (aside from direct variable access) message passingsupports all possible interactions between objects.
Objects don't need to be in the same process or even onthe same machine to send and receive messages backand forth to each other.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
9/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
The Three OOP Principles1. Encapsulation
2. Inheritance
3. Polymorphism
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
10/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
1. Encapsulation As you can see from the diagrams, the object's variables
make up the center or nucleus of the object. Methodssurround and hide the object's nucleus from other
objects in the program. Packaging an object's variableswithin the protective custody of its methods is calledencapsulation.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
11/18Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Benefits of Encapsulation Modularity--The source code for an object can be
written and maintained independently of the sourcecode for other objects. Also, an object can be easily
passed around in the system.
Information hiding--An object has a public interfacethat other objects can use to communicate with it. Butthe object can maintain private information and methods
that can be changed at any time without affecting theother objects that depend on it.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
12/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
2. Inheritance Inheritance is the process by which objects of one
class acquire the properties of objects of anotherclass.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
13/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
The Benefits of Inheritance Reusability:Subclasses provide specialized behaviors
from the basis of common elements provided by thesuperclass. Through the use of inheritance,
programmers can reuse the code in the superclassmany times.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
14/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
3. Polymorphism Polymorphism means the ability to take more than one
form.
Its a feature that allows one interface to be used for a
general class of actions
Shape
draw()
Circle
draw()
Rect
draw()
Triangle
draw()
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
15/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Benefits of OOPS Through inheritance, we can eliminate redundant
code and extend the use of existing classes.
The principle of data hiding helps the programmer to
build secure programs that cannot be invaded bycode in other parts of the program.
It is possible to map objects in the problem domainto the objects in the program domain.
Object oriented systems can be easily upgradedfrom small to large systems.
Software complexity can be easily managed.
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
16/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
Applications of OOP Real-time Systems
Simulation & Modelling
Object Oriented Databases
Expert Systems
Neural Networks and Parallel Programming
Decision Support and Office Automation Systems
CAD/CAM Systems
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
17/18
Website: http://www.anuragkumar.co.nranuraggie-java@yahoo.co.in
AssignmentsQ.1 What is Object-Oriented Programming? How is it
different from the Procedure-Oriented (Procedural)Programming?
Q.2 Distinguish between the following terms:a) Objects and Classes
b) Data Abstraction and Data Encapsulation
c) Inheritance and Polymorphism
d) Dynamic Binding and Message Passing
anuraggie-java@yahoo co in
anuraggie-java@yahoo co in
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/7/29/2019 Chap1 Oops
18/18
anuraggie-java@yahoo.co.in
Website: http://www.anuragkumar.co.nr
Need Technical Assistance?
+919415793893
Gain your IT expertise from the expert
anuraggie-java@yahoo.co.in
End of Chapter-1 Thank You
http://www.anuragkumar.co.nr/http://www.anuragkumar.co.nr/Recommended