views:

231

answers:

8

I've got some real nay-sayers on my hands here, and I'm trying to give them the reason why OOP was developed in the first place. I realize that OOP is not perfect for all problems and situations, but it was developed for a reason...

My guess would be, that a few of those reasons would be:

  • Maintainability
  • Re-usability
  • Document-ability
  • Abstraction of Complex Technologies
  • Dynamic Extension at Runtime...
  • Probably some things that I'm not even aware of yet...

But I really don't have much to back this up, and I was wondering why OOP was developed in the first place, and it's history.

What were the people who developed OOP trying to accomplish? What led them to develop OOP?

+3  A: 

I've always held the opinion that Object Oriented Programming was created so that we could think about complex problems in ways that humans could understand:

Everything in the world is an object, objects have properties, and some objects can even perform actions (or have actions performed on them).

Justin Niessner
+1  A: 

One reason you can contribute to the debate is that OOP helps model the real world using classes, functions and properties to define concrete concepts and objects in an abstract way. One could argue that OOP hoped to aid developers in modeling code after the real world processes and objects that make up a particular problem space.

Achilles
A: 

Polymorphism is important in OO design patterns.

Dave
-1: How the hell does this answer the question?
Platinum Azure
+1  A: 

A good book for this is Object-Oriented Software Construction by Bertrand Meyer (widely considered a foundational text of object-oriented programming). From the Wikipedia page:

The book, known among its fans as "OOSC", presents object technology as an answer to major issues of software engineering, with a special emphasis on addressing the software quality factors of correctness, robustness, extendibility and reusability. It starts with an examination of the issues of software quality, then introduces abstract data types as the theoretical basis for object technology and proceeds with the main object-oriented techniques: classes, objects, genericity, inheritance, Design by Contract, concurrency, and persistence. It includes extensive discussions of methodological issues.

Pascal Thivent
@Pascal Thivent: Did you intend to link to the following page instead? http://en.wikipedia.org/wiki/Object-Oriented_Software_Construction
stakx
@stakx Yes!! Thanks for pointing that out.
Pascal Thivent
+1  A: 

Paul Graham has a good list of reasons why people like OOP:

http://www.paulgraham.com/noop.html

Andreas Brinck
To be honest, that doesn't sound much like a "list of reasons why people like OOP", more like "list of reasons why I think OOP-programmers suck". It's always funny seing people talk down on other types of languages or programmers instead of trying to sell their own favorite stuff.
Lasse V. Karlsen
A: 

I think that what motived OOP in the first place are these facts (or should I say assumptions?):

  • we naturally think in term of objects/things
  • objects are good to capture/model reality
  • objects can be used uniformly throughout the dev. process (requirement, analysis, implementation)

Whether this is really true is another question. See Do We Think in Terms of Objects.

The essence of OOP is

  • object = identity + data + behavior

What are the exact features provided in OOP language is also another question. See the wikipedia page.

PS: A lot of so-called object-oriented code is actually procedural code disguised into object-oriented code. The main problem with OOP as we know it, is that it requires experience to capture collaboration between objects when a responsibility can not be trivially assigned to one object.

ewernli
+1  A: 

The theory aside, what really drove the adoption of OOPS was the arrival of Windows-based GUIs.

If you're just programming a DOS or Mainframe terminal application then you really don't need OOP, sure it might be useful but there's no compelling reason to adopt it. However as soon as you start coding for any 'wimp' based GUI then handling it efficiently without OOP is very hard, particularly as soon as you get beyond a simple system.

I cut my teeth coding for Mac back when Pascal was the default language, you had to handle your own main event loop, and do such things walk through the rectangles to redraw a window when it was in the background covered by windows in front of it. Consequently vast amounts of even the simplest program were concerned with basic infrastructure and it was not a trivial task to keep one's interfaces clean so the code did not descend into tangled spaghetti. The same was true of Windows (read any of the early Charles Petzold 'programming windows' books) and the various other GUIs around at the time.

The adoption of OOP vastly simplified this as OOP is a natural fit for GUIs. Nowadays we regard this as obvious and natural but it wasn't always so and certainly the adoption of OOP was regarded as something of a major challenge to programmers at the time. However the result has been that all new programmers since the late 90s have grown up with OOPs because it really is needed to handle GUIs with the result that it's pretty much the default way to code and consequently it's usage has spread widely beyond the interface.

Cruachan
+2  A: 

Alan Kay, who coined the term "Object-Oriented Programming," has explained his thinking on a few occasions.

Essentially, he got the idea from biology — the way each cell is a self-contained entity and only interacts with other cells through "messages," without knowing anything about how the other cell actually works, and all these autonomous entities add up to a living organism. He thought that this way of dividing responsibility up, with lots of entities that took care of themselves and communicated only by sending messages, would make it easier to keep programs organized. He's also said that he views the World Wide Web as an extension of this model.

Chuck
I like this answer! :-D Nature would know the best way to go about it.
leeand00