Unit I (Introduction)
Unit I (Introduction)
Object
From the perspective of human cognition, an object is any of the following:
analysis
is
method
of
analysis
that
examines
requirements from the perspective of the classes and objects found in the
vocabulary of the problem domain.
OOA is a collection of like-minded requirements modeling and analysis
techniques for software systems.
Object-oriented design is the process of planning a system of interacting
objects for the purpose of solving a software problem.
Object-oriented design is a method of design encompassing the process
of objects oriented decomposition and a notation for depicting both logical
and physical as well as static and dynamic models of the system under
design.
Page 1 of 7
Class
A class is a set of objects that share a common structure, common behavior,
and common semantics.
A single object is simply an instance of a class.
What isnt a class? An object is not a class. Objects that share no common
structure and behavior cannot be grouped in a class because, by definition,
they are unrelated except by their general nature as objects.
We can further divide the interface of a class into four parts:
1. Public: a declaration that is accessible to all clients
2. Protected: a declaration that is accessible only to the class itself and
its subclasses
3. Private: a declaration that is accessible only to the class itself
4. Package: a declaration that is accessible only by classes in the same
package
Abstraction
The process of separating the how from the whathow an operation is
performed inside a class, as opposed to whats visible to the class useris
called
abstraction.
Abstraction
is
an
important
aspect
of
software
Encapsulation
Encapsulation is an Object Oriented Programming concept that binds
together the data and functions that manipulate the data, and that keeps
both safe from outside interference and misuse. Data encapsulation led to
the important OOP concept of data hiding.
Data encapsulation is a mechanism of bundling the data, and the
functions that use them and data abstraction is a mechanism of exposing
only the interfaces and hiding the implementation details from the user.
C++ supports the properties of encapsulation and data hiding through the
creation of user-defined types, called classes.
Polymorphism
The ability to use an operator or function in different ways in other words
giving different meaning or functions to the operators or functions is called
polymorphism. Poly refers to many. That is a single function or an operator
functioning in many ways different upon the usage is called polymorphism.
Page 4 of 7
Inheritance
One of the most useful aspects of object-oriented programming is code
reusability. As the name suggests Inheritance is the process of forming a
new class from an existing class that is from the existing class called as
base class, new class is formed called as derived class.
This is a very important concept of object-oriented programming since this
feature helps to reduce the code size.
Modularity
Modularity is the property of a system that has been decomposed into a set
of cohesive and loosely coupled modules.
Modularity is designing a system that is divided into a set of functional units
(named modules) that can be composed into a larger application. A module
represents a set of related concerns. It can include a collection of related
components, such as features, views, or business logic, and pieces of
infrastructure, such as services for logging or authenticating users. Modules
are independent of one another but can communicate with each other in a
loosely coupled fashion.
Hierarchy
Hierarchy is a ranking or ordering of abstractions.
Page 5 of 7
The two most important hierarchies in a complex system are its class
structure (the is a hierarchy) and its object structure (the part of
hierarchy).
A hierarchy is an organizational structure in which items are ranked
according to levels of importance. Most governments, corporations and
organized religions are hierarchical.
Interface
An interface is a programming structure/syntax that allows the computer to
enforce certain properties on an object (class). For example, say we have a
car class and a scooter class and a truck class. Each of these three classes
should have a start_engine() action. How the "engine is started" for each
vehicle is left to each particular class, but the fact that they must have a
start_engine action is the domain of the interface.
In summary the Interface separates the implementation and defines the
structure, and this concept is very useful in cases where you need the
implementation to be interchangeable. Apart from that an interface is very
useful when the implementation changes frequently. Some say you should
define all classes in terms of interfaces, but I think recommendation seems
a bit extreme.
Interface can be used to define a generic template and then one or more
abstract
classes
to
define
partial
implementations
of
the
interface.
Page 6 of 7
abstract) and can contain properties (which are also implicitly public and
abstract).
Implementation
In order to implement objects, we will abandon dot notation (which does
require built-in language support), but create dispatch dictionaries that
behave in much the same way as the elements of the built-in object
system. We have already seen how to implement message-passing behavior
through dispatch dictionaries. To implement an object system in full, we
send messages between instances, classes, and base classes, all of which
are dictionaries that contain attributes.
Page 7 of 7