Object-oriented programming is claimed to
promote greater flexibility and maintainability in programming, and is widely popular
in large-scale software engineering. Furthermore, proponents of OOP claim that OOP is
easier to learn for those new to computer programming than previous approaches, and that
the OOP approach is often simpler to develop and to maintain, lending itself to more
direct analysis, coding, and understanding of complex situations and procedures than
other programming methods.
Object-oriented programming(OOP) emphasizes the following concepts:
Class - The unit of definition of data and behavior (functionality) for some kind-of-thing.
For example, the 'class of Dogs' might be a set which includes the various breeds of dogs. A class
is the basis of modularity and structure in an object-oriented computer program. A class should
typically be recognizable to a non-programmer familiar with the problem domain, and the code for a
class should be (relatively) self-contained and independent (as should the code for any good
non-OOP function). With such modularity, the structure of a program will correspond to the aspects
e problem that the program is intended to solve. This simplifies the mapping to and from the problem
Object - an instance of a class, an object (for example, "Lassie" the Dog) is the
run-time manifestation (instantiation) of a particular exemplar of a class. (For the class
of dogs which contains breed types,an acceptable exemplar would only be the subclass
'collie'; "Lassie" would then be an object in that subclass.) Each object has its own data,
though the code within a class (or a subclass or an object) may be shared for economy.
Method - (also known as message) how code can use an object of some class. A method
is a form of subroutine operating on a single object. Methods may be divided into queries
returning the current state and commands changing it: a Dog could have a query Age to say
how old it is, and command chase (Rabbit target) to start it chasing a rabbit. A method may
also do both, but some authorities (e.g. Bertrand Meyer) recommend they be kept separate.
Sometimes access to the data of an object is restricted to the methods of its class. A member of a class or object is a method or a data item describing the state of an object.
In some languages the general term is feature.
Inheritance - a mechanism for creating subclasses, inheritance provides a way to define a
(sub)class as a specialization or subtype or extension of a more general class: Dog is a subclass
of Canidae, and Collie is a subclass of the (sub)class Dog. A subclass inherits all the members of
its superclass(es), but it can extend their behaviour and add new members. Inheritance is the "is-a"
relationship: a Dog is a Canidae. This is in contrast to composition, the "has-a" relationship:
a Dog has a mother (another Dog) and has a father, etc.
Multiple inheritance - a Dog is both a Pet and a Canidae - is not always supported, as
it can be hard both to implement and to use well.
Encapsulation - ensuring that code outside a class sees only functional details of that class, but
not implementation details. The latter are liable to change, and could allow a user to put
an object in an inappropriate state. Encapsulation is achieved by specifying which classes
may use the members of an object. The result is that each object exposes to any class a
certain interface - those members accessible to that class. For example, an interface can
ensure that puppies can only be added to an object of the class Dog by code in that class.
Members are often specified as public, protected and private, determining whether they are
available to all classes, sub-classes or only the defining class. Some languages go further:
Java uses the protected keyword to restrict access also to classes in the same package, C#
and VB.NET reserve some members to classes in the same assembly using keywords internal (C#)
or Friend (VB.NET), and Eiffel allows one to specify which classes may access any member.
Abstraction - The ability of a program to ignore the details of an object's (sub)class
and work at a more generic level when appropriate; For example, "Lassie" the Dog may be treated
as a Dog much of the time, but when appropriate she is abstracted to the level of Canidae
(superclass of Dog) or Carnivora (superclass of Canidae), and so on.
Polymorphism - Polymorphism is behavior that varies depending on the class in which
the behavior is invoked, that is, two or more classes can react differently to the same message.
For example, if Dog is commanded to speak this may elicit a Bark; if Pig is commanded to speak
this may elicit an Oink.
An object-based language is a language that has most of the properties of an object-oriented
language, but may lack some. For example Visual Basic lacks inheritance, while a Prototype-based
programming language relies on prototypes instead of classes to create objects.
Matching Real World
According to some OOP proponents, translation from real-world phenomena/objects (and vice versa)
is eased because of a direct mapping from the real-world to the object-oriented program
(generally a many-to-one). OOP was even invented for the purpose of physical modelling in the
Simula-67 programming language. However, not all proponents agree that real-world mapping is
facilitated by OOP, or is even a worthy goal (Bertrand Meyer, OOSC2, pg. 230). Further, many
domains, such as legal, financial, and abstract ideas, have no substantial physical counterpart.
OOP as a new paradigm, point of view, and marketing term
OOP is subject to much contention as to its precise definition and its principal ideas.
In the most general terms, OOP is the practice of writing program text that is decomposed into modules that encapsulate the representation of one
data type per module, instead of into collections of functions that call each other, or clauses
that trigger each other. OOP concepts and practices have been brought together, with associated
terminology, to create a new programming framework. Together, the ideas behind OOP are said to be
so powerful that they create a paradigm shift in programming. (Other programming paradigms, such
as functional and procedural programming, focus primarily on actions -- or, in logical programming,
on assertions -- that trigger execution of program code.)
OOP arose independently out of research into simulation system oriented languages, with SIMULA 67, and out of research into highly secure
system architectures, with capability-based OS and CPU architectures.
Some experts say that the original definition of object-orientation came from the object in grammar.
The requirements for software are always subject-oriented. However, since the requirements for the
subject are often complicated, subject-oriented programs end up tending to be complicated and
monolithic. Therefore, as an alternative, some researchers started thinking in an object-oriented way. This represented
a paradigm shift from the usual or previous subject-oriented mode of thinking.According to
object-oriented principles, the verb in a program statement is always attached to the object,
and the logic associated with a requirement is likewise handled in the object. The following are
some examples of the ways by which a subject-oriented requirement is translated into object-oriented
Subject-oriented: The Sales Application saves the Transaction
Object-oriented: The Transaction saves itself upon receiving a message from the Sales Application
Subject-oriented: The Sales Application prints the Receipt
Object-oriented: The Receipt prints itself upon receiving a message from the Sales Application
One distinguishing feature of OOP is the handling of subtypes of data types.
Object's data are generally required to satisfy programmer-defined constraints (i.e., class invariants).
A datatype restricted by such a constraint constitutes a subtype of the same datatype without the
constraint. These constraints are then both relied upon and preserved by the actions (methods) that
are defined for the data.,
Data constraints may be either explicitly declared or implicitly assumed by the programmer. In either
case, object-oriented languages provide mechanisms for ensuring that such assumptions or constraints
remain local to one part of the program. Constraints on and assumptions about data are usually included
in the documentation of object-oriented programs.
OOP itself has been used to market many products and services, and the actual definitions and benefits attributed to OOP have often been colored by commercial marketing goals. Similarly, many programming languages reflect a specific view or philosophy of OOP that is narrower and, in certain respects, less general than that embodied in the more general or standard definition.
As noted above, at the end of the previous section, widely-used terminology distinguishes object-oriented programming from object-based programming. The former is held to include inheritance (described below), while the latter does not.
The exact definitions of some of these terms show some variation, depending on point of view. In particular, languages with static typing often reflect and embody slightly different views of OO from those reflected by and embodied in languages with dynamic typing, due to a focus on the compile-time rather than the run-time properties of programs.
Note: Abstraction is important, but not unique, to OOP. Other programming paradigms employ it as well.
Reusability is the benefit most often claimed for OOP. However, that claim is unlikely to be true, as reuse of software is as old as the invention of the subroutine, reputedly prior to 1950. In fact, reuse is frequently disputed as being a primary, or even a large, benefit. The ease of translation to and from the target environment, the (improved) ability to maintain a program once written, the ability to do localized debugging, and the (improved) ability to do much larger parallel development efforts, are all cited as more significant reasons to use an OOP language.
OOP is often called a paradigm rather than a style or type of programming, to emphasize the point that OOP can change the way software is developed by actually changing the way in which programmers and software engineers think about software. As a paradigm, OOP is about overall system design as much as it is about programming. A system is designed by defining the objects that will exist and interact within the system. Due to encapsulation, the code that actually does the work is irrelevant to an object, and to the people using the object. The challenge in OOP, therefore, is of designing a sane object system.
It should be noted that there are distinct parallels between the object-oriented paradigm and systems theory. OOP focuses on objects as units in a system, whereas systems theory focuses on the system itself. In between, one may find software design patterns or other techniques that use classes and objects as building blocks for larger components. Such components can be seen as an intermediate step from the object-oriented paradigm towards the more "real-life oriented" models of systems theory.
Our Object Oriented Systems Development curriculum comprises of the following:
Object & Data Labs Certificate Program
With each of our course areas we offer a corresponding certification program consisting of core and elective courses. Object & Data Labs's certification is a great way to enhance and advance any career involved with cutting-edge technology. See Certificates for more information. There is also a substantial discount available for purchasing a certification course block in advance, see our Tuition Discount page for details.