Oop’s Concept and its Real Life Applications

Shar_1 3,460 views 21 slides Dec 04, 2015
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

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.


Slide Content

OOP’S Presentation Submitted By, Sharwon Pius M. 2013/B/17

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

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.

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.

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.

Single level inheritance Multi-level inheritance Hierarchical inheritance Hybrid inheritance

OOPS APPLICATIONS AND PROBLEMS Engg . Numerical Method Text Processing SCIENCE , GUI by Case study .

The Problem statement is to make a cheap blind aid . ENGG. .

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")

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 ") }

NUMERICAL MEATHODs & TEXT PROCESSING 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).

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?

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 ;

CASE STUDY EARTH MAGNETIC FIELD REVERSAL

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

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.

FINALE

THANK YOU ANY QURIES ….?