Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What is that feature according to you that has made object oriented programming so much successful ?

  1. Message Passing
  2. Inheritance
  3. Polymorphism
  4. Encapsulation

Or some other feature that you may like to introduce.

Also I would like to know that what is the connection between Abstract Data type and Object Oriented programming?

share|improve this question
    
popular and successful are not synonymous –  kevin cline Dec 14 '12 at 5:38
add comment

closed as not constructive by gnat, Walter, Robert Harvey, GlenH7, Ryathal Dec 12 '12 at 21:35

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

11 Answers

up vote 74 down vote accepted

I'd suggest that the most important characteristic of object oriented programming is that of complexity management.

The human brain can only hold so many concepts at one time - the oft quoted limit of remembering 7+/-2 independent items comes to mind.

When I'm working on a 600kloc system at work, I can't hold the whole thing in my head at once. If I had to do that, I'd be limited to working on much smaller systems.

Fortunately, I don't have to. The various design patterns and other structures that we've used on that project mean that I don't have to deal with the entire system at once - I can pick up individual pieces and work on them, knowing that they fit into the wider application in well defined ways.

All of the important OO concepts provide ways to manage complexity.

Encapsulation - let me deal with an external API that provides me with various services, without worrying how those services are implemented.

Abstraction - let me concentrate on the essential characteristics and ignore what's not relevant.

Composition - let me reuse components that have already been built in new combinations

Polymorphism - let me ask for a service without worrying about how different objects might provide it in different ways.

Inheritance - let me reuse an interface or an implementation, providing only the pieces that are different from what has gone before.

Single Responsibility Principle - lets keep the purpose for each object clear and concise, so it's easy to reason about

Liskov Substitution Prinicple - let's not lay traps for each other by introducing odd dependencies

Open/Closed Principle - let's allow extension and modification in ways that don't require us to risk breaking existing code

Dependency Injection - let's take composition to the next level and assemble the components together much later.

Interface oriented development - let's take abstraction to the next level and only depend on the abstraction, never on a concrete implementation.

share|improve this answer
5  
+1. I can only vote once, which is a shame this deserves more. –  Richard Nov 2 '10 at 9:18
1  
There's a corollary to this, it's a shame I can't find the reference right now but I'll try to remember to look it up and edit the comment. So a study of code review practices found that code reviews tended to take longer to find bugs in OO code than procedural code, because the flow jumps around more in OO code. Practices like TDD and pair programming mitigate that, but it's still an interesting (and to me, unexpected) result. –  user4051 Nov 2 '10 at 10:46
4  
This might be the perfect answer - information full, yet short enough so the reader doesn't have to read a novel. Bravo –  Tim Claason Nov 2 '10 at 13:45
    
@Graham Lee: I'd be interested in reading that study. –  Frank Shearar Nov 2 '10 at 17:45
2  
@Frank @Bevan: portal.acm.org/citation.cfm?id=337343 –  user4051 Nov 2 '10 at 22:04
show 2 more comments

My top three features. Object Composition - allowing objects to collaborate. Polymorphism - supports dynamic behaviors at runtime. Inheritance - by reusing code and modifying behavior through methods overriding.

ADT - you can have that even in non object-oriented languages like Pascal. A stack or a queue are examples of ADT.

share|improve this answer
    
"ADT - you can have that even in non object-oriented languages like Pascal. A stack or a queue are examples of ADT.": True. But OOP makes it easier to define the interface of an ADT and provide different, interchangeable implementation (interface / abstract class <---> subclasses / concrete classes). As far as I know it is not as easy in Pascal. –  Giorgio Dec 12 '12 at 15:08
add comment

I think inheritance is the most important point of OOP.

[from game development] You can create something like a Drawable class, with rendering methods and attributes, and create a Spaceship and Planet class, which inherits from Drawable. Take all objects from those [and other Sprite child], throw in a drawableObjArray and just call the draw method for every object. You just need to know that it's an Drawable.

share|improve this answer
2  
Really?? Polymorphism is WAY more important and does not require inheritance (from a theoretical standpoint). –  Thomas Eding Sep 11 '12 at 16:49
    
Does not even require virtual functions just use function pointers. –  Calmarius Dec 12 '12 at 13:51
1  
Alan Kay's original concept of OO didn't even include inheritance because he didn't like how it was implemented in previous systems. –  Michael Borgwardt Dec 12 '12 at 14:11
add comment

The Data Hiding provided by Encapsulation.

share|improve this answer
    
This is an answer? ADTs provide data hiding (which is why they're called "data abstractions") –  Frank Shearar Nov 2 '10 at 14:29
    
@Frank, He asked for specific features and when I wrote this answer, there was only one other and I was trying not to duplicate. –  user1842 Nov 2 '10 at 18:29
    
Fair enough, but encapsulation's not exactly specific to OO. I should check this myself, but I'm pretty sure we were doing encapsulation long before OO. –  Frank Shearar Nov 2 '10 at 20:48
1  
@Frank, I agree it's not specific to OO, it's just one of it's main features. –  user1842 Nov 2 '10 at 21:46
    
That's true of most OOPLs, but not of all. CLOS is a notable exception. –  Frank Shearar Nov 2 '10 at 22:47
show 1 more comment

in simple words OOP is the key for re-usability and encapsulation that results in the production of large frameworks that makes the life easy for programmers in this era as the can just call the API's and do what day want most often.

as ur question is about the 4 features of OOP so you can say

  1. Inheritance and 4. Encapsulation are the most important features and other two are very much necessary to achieve the first two

so 1. Message Passing and 3. Polymorphism are actually supporting 2. Inheritance and 4. Encapsulation.

  1. Inheritance and 4. Encapsulation are key to success for OOP
share|improve this answer
add comment

A feature that hasn't been mentioned yet by any of the other answers: domain modeling. Because people tend to think about doing things with or to objects, and about objects having intrinsic properties, it's very easy to model a problem or workflow using object-oriented software. Essentially, it allows us to use our existing ability to deal with nouns, verbs and adjectives in code.

share|improve this answer
add comment

Abstraction

Providing the necessary services hiding the unnecessary things. See my explanation here- http://programmers.stackexchange.com/questions/16070/just-what-is-abstraction/16080#16080

share|improve this answer
    
Typo: "Absraction" should be "Abstraction" –  Vetle Nov 2 '10 at 11:00
    
@vetler Fixed now. Thanks. –  Gulshan Nov 2 '10 at 12:37
add comment

It is somewhat successful because it encourages the use of the human mind's organization of things into objects. People are generally good at seeing relationships of things - things like differences, similarities and behavior. OO encourages developing software to mimic human conceptualization of the world.

Making software development similar to how we view the world makes it easier for our minds to handle the complexity.

share|improve this answer
    
Maybe it's because of more experience with procedural, but after using both methods, I still find procedural more intuitive to do than OOP. I still like the good parts of both styles, though. –  Juha Untinen Dec 12 '12 at 15:54
add comment

"ADT vs objects" has been asked a number of times here. The one-line answer is "ADTs and objects are the inverse of each other - what one abstracts neatly the other cannot; each allows flexibility in different ways."

For a longer answer, see William Cook's On Understanding Data Abstraction, Revisited. Briefly, objects allow you to easily use multiple implementations/representations of some datum (something that looks like a list could be an array, or a self-balancing tree, or...) but make it hard to add new operations (because you have to add that new operation to each of your representations), while ADTs make it easy to add new operations on your data type, but make it hard to have multiple implementations.

Edit: I'd said that message passing was what made OO successful. Based on Jonas' comment, that's not right, because most languages that people consider OO don't use message passing. Since it's not right, I culled it from my answer.

share|improve this answer
1  
Message passing can hardly be the answer since none of the successful OOP languages uses it. –  Jonas Nov 2 '10 at 15:10
    
Your OO isn't necessarily my OO. And most languages that are called OO are not, by Alan Kay's definition. I forget the exact quote, but Kay's said that objects were not what was important about Smalltalk, but message-passing (and that most missed this point). –  Frank Shearar Nov 2 '10 at 16:18
    
@Jonas I guess, upon rereading the question and my answer, that I'm half-saying "OO isn't successful, since so few languages do it right." But I only say things like that when I'm wearing my flame-proof suit. –  Frank Shearar Nov 2 '10 at 16:30
add comment

Graphical user interfaces. In the late eighties, early nineties, when Macs, Amigas, Atari STs, Windows and GEM began to replace character based user interfaces, it became obvious that languages like C are not well-suited to write GUI programs. While traditional data processing is considered as a "input data -> processing -> output data" schema, which could be done in a procedural language just as well, OOs features just came handy to handle the inherent complexity of a GUI.

share|improve this answer
1  
+1 for mentioning GUI applications. Object-orientation was the tool that allowed to implement GUI's, which were otherwise (with procedural code) quite difficult to manage. –  Giorgio Dec 12 '12 at 14:42
add comment

In my opinion, the last three features are the most important once that impacted the wide spread usage of OOP:

2. Inheritance
3. Polymorphism
4. Encapsulation

Edit: Another point would be IDE and graphical interface development environments like Visual studio and Eclipse. As they embrace OOP languages, thus more and more designs tended towards OOP.

And of course SOLID Principles are the once that make the software products ROCK solid deliverable :)

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.