Вы находитесь на странице: 1из 13

OOPS

---------- FRP
 There are different types of
programming techniques:
 1. Unstructured Programming

 2. Procedural Programming

 3. Modular programming ( procedures

of a common functionality are grouped


together into separate modules.)
4. Object oriented programming.
(organized around the objects .. This
really cares about the object.)
 The first step in OOP is to identify all
the objects you want to manipulate and
how the relate each other. Once object
is identified we generalize it as a class
of objects.
 A real instance of class is called the
object.
 A class is a collection of one or more
variables possibly of different data
types grouped together in a single file
name.
 Object:
 Objects are key things in understanding
object oriented languages. The best example
for objects are the things which you around
you. ( the table, chair, PC, your dog etc.,) An
entity that has a well defined role in the
application domain and has state, Behavior
and identity.
 Real World objects have two characteristics:
They have state and Behavior.
 For example the object Dog has state:
( Name, color, breed ) and the same has the
behavior like (Barking, fetching etc.,). Another
example is Bicycle has state (Gear, current
pedal balance etc.,) and it has behavior like
 A software object maintains state in one
or more variables. A variable is an item
of data named by an identifier.
Messages

 Objects interact and communicate to


each other thro messages. When
object A wants object B to perform one
of the B’s methods it shall send a
message to object B.
 Some time the receiving object needs
more information about so that it
exactly knows what to do… For
example, when you want to change the
gears on your bicycle, you have to
indicate which gear you want. This
 The parts of the message are:
 1. the object to which the message is
addressed. ( Your bicycle)
 2. Name of the method to be
performed. ( Change Gears)
 3. Any parameters needed by that
method (lower Gear)
 These three are enough for the object
to perform the desired job. No other
context is required.
 Benefits of messages :
 Message passing supports all possible
interaction between the objects.
 Objects need not be in Same process or
 Class:
 In real world, you often have many
objects of the same kind. For example,
your bicycle is just one of many bicycles
in the world. Using OOPS we can say
that your Bicycle is an instance of the
class of objects known as “Bicycles”
 Bicycles have some state and behavior
in Common. But, each bicycles state is
independent of others and can be
different.
 So, in OOPS its possible to have many
objects of the same kind that share
characteristics : Rectangles, Employee
records etc., you can take the
 A class is a blue print that defines the
variables and methods common to all
objects of a certain kind.
Features of OOPS:
 Abstraction: Abstraction is a process of
describing some system in a way that
highlights relevant information or suppresses
irrelevant information. ( It’s a mechanism by
which unwanted or irrelevant information can
be hided).
 This makes understanding the process very
easier.
 Encapsulation: Encapsulation is a process by
which the contents of the class can be
protected from outside interference and
misuse. It is a way of binding data and code
together.
 Encapsulation are clearly necessary for: 1.
The need to clearly distinguish between
 Modularity is necessary to structure
complex applications designed and
implemented by team of programmers.
 Inheritance:
 This is a concept by which the
properties of one entity is a variable to
another.
 OOPS allows classes to be defined in
terms of other classes…. For example,
mountain Bikes, road bikes and
tandems are all subclasses of Bicycle
Class.
 However Subclasses are not limited to
the states and behaviors provided to
them by their Super class.
 Access Specifiers:
 1. private .
 2. Public.
 3. Protected.
 Access Specifiers serves as a boundary
between the accessible boundary and
inaccessible boundary of the class.
 Static and Dynamic Binding:
 If the system determines how to
implement an action at compile time it
is called early binding or static binding.
Static binding leads to run time
efficiency since the compiler can
optimize the code before executing it.
 If the decision is made dynamically at
the run time then it is called late
binding or Dynamic Binding. High
flexibility and high level of problem
abstraction is available here.
 Languages with OOP:

Вам также может понравиться