In this ppt, I've given real life examples and case studies where the concept of Object Oriented Programming can be applied.
Program examples are also included.
2. Clearing The ‘‘OOP’S’’ Concept !
– 1. Object - Instance of Class
2. Class - Blue print of Object
3. Encapsulation - Protecting our Data
4. Polymorphism - Different behaviors at different instances
5. Abstraction - Hiding our irrelevant Data
6. Inheritance - One property of object is acquiring to
– another property of the object
3. Class & Object
– we have a Class of Laptop under which Lenovo G50, HP envy and Sony viao t5
represents individual Objects. In this context each Laptop Object will have its
own, Model,Year of Manufacture, Colour, Speed,BatteryPower etc.,which form
Properties of the Laptop class and the associated actions i.e., object functions
like Start, Restart, Volume down /up form the Methods of Laptop Class.
– The blueprint is the class...the Laptop is the object. The data of people using
the laptop ,are data stored in the object's properties.
Laptop
Lenovo G50s
HP Envy m6
4. Abstraction & Encapsulation
– Abstraction says, only show relevant details and rest all hide it. For Example,
This Laptop allows you to connect to wifi and surf the internet but it doesn't
show you how its actually done.
– Abstraction & Encapsulation works hand in hand because Abstraction says what
details to be made visible & Encapsulation provides the level of access right to
that visible details.SO, while connecting to the wifi the access to other laptops
are restricted for security purposes.
5. Polymorphmism & Inheritance
– Polymorphism can be defined as the ability of doing the same operation but
with different type of input. The web cam on the Lenovo g50s is having a
functionality of CameraClick(). Now same Lappie is having Butification mode
available in camera, so functionality would be same but with mode. This type is
said to be Static polymorphism or Compile time polymorphism.
– Inheritance is the Ability to extend the functionality from base entity in new
entity belonging to same group. This will help us to reuse the functionality
which is defined before.
6. Laptop Lenovo
Laptop
Lenovo G50s
HP Envy m6
Laptop Lenovo G50s
Laptop
Lenovo
HP
Single level inheritance
Multi-level inheritance
Hierarchical inheritance Hybrid inheritance
9. import RPi.GPIO as GPIO
GPIO.setwarnings(False) # supress the system wornings
GPIO.cleanup() # clean up the GPIO pins i.e make the GPIO pins to low
GPIO.setmode(GPIO.BOARD) # Set the mode of numbering the pins.
GPIO.setup(11, GPIO.IN)
#GPIO pin 11 is the input.
GPIO.setup(12, GPIO.IN)
#GPIO pin 12 as input
GPIO.setup(13, GPIO.IN)
#GPIO pin 13 as input pin
left = GPIO.input(11)
fornt = GPIO.input(12)
right = GPIO.input(13)
#keep on polling for input pins
while 1:
{left = GPIO.input(11)
front = GPIO.input(12)
right = GPIO.input(13)
if left == True or front == True or right == True:
buzz(“Stuck! Move your stick randomly")
if left == False and front == False and right == True:
buzz("move either left ot front")
10. elif left == False and front == True and right == False:
buzz("move either left or right")
elif left == False and front == True and right == True:
buzz("move left")
elif left == True and front == False and right == False:
buzz("move either front or right")
elif left == True and front == False and right == True:
buzz("move front")
elif left == True and front == True and right == False:
buzz("move right")
elif left == True and front == True and right == True:
buzz("better to go back")
else:
buzz(" Checkup appaaratus")
}
11. Problem Statement: How many numbers need to be stored to save
a symmetric NxN matrix in lower diagonal form? (This is our statement
of problem: Note this may be a small piece of another larger problem).
12.
13.
14. • Solution algorithm: In lower diagonal form, the number of values needed go as: 1x1=1, 2x2=3, 3x3=6 ...
• To increase the dimension of the matrix from (N-1)x(N-1) to NxN requires N new values. Therefore our
algorithm is the sum of integers from 1 to N
Problem Statement: How many numbers need to be stored to save a symmetric NxN matrix in lower
diagonal form?
15. SOLUTION
• Call the number of values we need num_elements. How do we compute this value?
(a) Simplest
num_elements = 1 + 2 + 3 + 4 + 5 + .... + N
• Coded specifically for specific values of N. Not very flexible; could be many options depending on
number of values of N possible.
• PROGRAM-
num_elements = 0;
for i = 1:N ;
num_elements = num_elements + i ;
end ;
17. The earths magnetic field is improper along some regions of the surface making
navigation cumbersome for voyagers and travelers.
SO Scientists prepared to study the magnetic field of earth from the 1500
hundreds itself.
They found out that each element on earth had its on magnetic spin intensity.
Thus it showed the direction of the Magnetic field of earth its time period.
So they collect fallen metirots and old rocks and tested them . They ended up
with bizarre results , having no correlation between them.
Finally a Prof. GARY GCATZMAR from university of California ( in 1990’s)
put all the data collected till date regarding this magnetic behavior of earth in a
computer model . Dozen’s of equations describing, temp. , viscocity, diamension
and so forth of the plant. Then he just let it run
18.
19. • To see the world evolve over 100,000
years of stimulated time.
• We can see that the blue region and
yellow region are the main two active
classes ( 1. north pole, 2. south pole)
and each one of its lines are its own
objects.
• These objects have properties and
methods give by those “dozens of
equations”. , along with stimulated
time.
• This proved to state that our planets
Magnetic field will reverse for every
70,000 years.
Before moving forward we have to understand the intensity of this application. The Vectors and matrices as the solution itself. The 3d position of a quadcopter in know by calculation the robot pose which is described by a transformation matrix. SO BY MULTIPLYING THE LOCAL CORDINATE MATRICES WITH THE GLOBAL CORDINATE MATRICES ,WE CAN GET THE EXXACT POSITION O FTHE ROBOT.
Vectors can represent state of all kinds of systems , WE can use it to represent POPULATION DISTRIBUTION , GOOGLE PAGE RANK, PASSSWORD ENCRY, FACE MORPHING, IMAGE COMPR, SEARCHING.