Object Oriented Programming
OBJECT- ORIENTED PROGRAMMING (OOP) represents an attempt to make programs more closely model the way people think about and deal with the world. In the older styles of programming, a programmer who is faced with some problem must identify a computing task that needs to be performed in order to solve the problem. Programming then consists of finding a sequence of instructions that will accomplish that task. But at the heart of object-oriented programming, instead of tasks we find objects – entities that have behaviors, that hold information, and that can interact with one another. Programming consists of designing a set of objects that model the problem at hand. Software objects in the program can represent real or abstract entities in the problem domain. This is supposed to make the design of the program more natural and hence easier to get right and easier to understand.
An object-oriented programming language such as JAVA includes a number of features that make it very different from a standard language. In order to make effective use of those features, you have to “orient” your thinking correctly.
OBJECT- ORIENTATION is a set of tools and methods that enable software engineers to build reliable, user friendly, maintainable, well documented, reusable software systems that fulfills the requirements of its users. It is claimed that object-orientation provides software developers with new mind tools to use in solving a wide variety of problems. Object-orientation provides a new view of computation. A software system is seen as a community of objects that cooperate with with each other by passing messages in solving a problem.
An object-oriented programming laguage provides support for the following object-
Objects and Classes
• Object-oriented programming takes advantage of our perception of world
• An object is an encapsulated completely-specified data aggregate containing attributes and behavior
• Data hiding protects the implementation from interference by other objects and defines approved interface.
• An object-oriented program is a growing and shrinking collection of objects that interact via messages
• You can send the same message to similar objects, the target decides how to implement or respond
to a message at run-time.
• Objects with same characteristics are called instances of a class
• Classes are organized into a tree or hierarchy.
• Two objects are similar if they have the same ancestor somewhere in the class hierarchy
• You can define new objects as they differ from existing objects
• Benefits of object-oriented programming include:
- reduced cognitive load (have less to think about and more natural paradigm)
- isolation of programmers (better team programming)
- less propagation of errors
- more adaptable/flexible programs