General oops concepts

1,436 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,436
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
88
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

General oops concepts

  1. 1. GENERAL OOPS CONCEPTS
  2. 2. BASIC CONCEPTS OF OOP  The OOP approach is based on certain concepts that help it attain its goal of overcoming the drawbacks or short comings of convectional programming approaches.
  3. 3. DATA ABSTRACTION  Abstraction is the concept of simplifying a real world concept into its essential elements. To understand the abstraction, let us take an example. You are driving a car. You know essential features to drive a car e.g. gear handling, steering handling use of clutch, accelerator, brakes etc. This is abstraction where we only know the essential things to drive a car without including the background details or
  4. 4. ENCAPSULATION  Encapsulation is the wrapping up of the data and operations/ functions(that operate on the data) into a single unit(called class).  Encapsulation is the way to implement data abstraction. Encapsulation hides the details of the implementation of an object.
  5. 5. MODULARITY  Modularity is the property of a system that has been decomposed into a set of cohesive loosely coupled modules. The justification for partioning a program is that  (i) It reduces its complexity to some degree and  (ii) It creates a number of well defined, documented boundaries within the program
  6. 6. INHERITANCE  inheritance is the capability of one class of things to inherit capabilities or properties from another class. For e.g. in scientific calculator it inherits the features of simple calculator too(addition, subtraction, multiplication , division).
  7. 7. WHY INHERITANCE?  The inheritance was introduced in OO languages because  It ensures the closeness with the real world models.  Inheritance allows the addition of additional features to n existing class without modifying it.  Of its transitive nature. (if A inherits from B and B inherits from C, then A also inherits from C )
  8. 8. IS-A RELATIONSHIP  This type of relationship is represented via inheritance. When a class(say B) inherits from another class, (say A) it becomes a “a kind of” its base class. That is, one can say that class „B‟ IS-A kind of class „A‟. E.g. A „car‟ IS-A vehicle.
  9. 9. HAS-A RELATIONSHIP  In contract to inheritance, when a class owns an object of another class then it is class HAS-A relationship. For e.g. car engine is an object of class type and a class CAR owns engine. i.e , car HAS-A ENGINE. But it is not an engine. Thus no IS-A relationship, just HAS-A relationship. This relationship is also called composition or containership.
  10. 10. Polymorphism  Polymorphism is the ability for a message or data to be processed in more than one form . Languages that support classes but not polymorphism are called object-based languages. Ada is such a language.  Polymorphism is a property by which the same message can be send to objects of several different classes, when each object can respond in a different way depending upon it class.
  11. 11. Advantages and disadvantages of OOP  Advantages  Re-use of code. Linking of code to object and explicit specification of relations between objects allows related objects to share code. Encapsulation allows class definitions to be re-used in other application. The availability of a consistent interface to objects lessens code duplication and thereby improves code reusability
  12. 12.  Ease of comprehension: the classes can be set up to closely represent the generic application concepts and processes. OOP codes are more near to real-world models than other programming methodologies‟ codes.
  13. 13.  Ease of fabrication and maintenance: The concepts such as encapsulation, data abstraction allow for every clean designs. When an object is going into disallows states, which are not permitted, only its methods need be investigated e.g. if student is getting more than maximum marks, only the functions are to be retested. This narrows down search for problems.
  14. 14.  Easy redesign and extension: the same concepts above facilitate easy redesign and extension.
  15. 15. Disadvantages of OOP  With OOP, classes tend to be overly generalized.  The relations among classes become artificial at times.  The OOP programs‟ design is tricky.  Also one need to do proper planning and design for OOP programming.  To program with OOP, programmer need proper skills such as design skills, programming skills, thinking in terms of objects etc.

×