Click here to Skip to main content
15,888,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been once asked what are the advantages and disadvantages of object orientation .Well advantages were easy but got stuck on disadvantages.

Any idea what are disadvantages?
Posted

Dear Mpho,

Like anything else, OOP isn't all rainbows and lollipops; it also has its dark side.


The biggest drawback of OOP in terms of general simulation programming is probably that the real world refuses to divide up into neat classes and subclasses. At first glance, it's easy to look around and start dividing things up into classes: furniture is tables and cabinets and chairs, chairs are sofas and armchairs and folding chairs, sofas come in loveseat and sleeper varieties, etc. The problem is, those class divisions aren't intrinsic in the things we're divvying up; they're just the way we happen to see the world. Worse, they're the way we happen to see the world at the moment. Change the situation, and our whole view of the class lines changes. If we're looking for fuel for the fireplace, the interesting class divisions become things like wood vs. metal vs. plastic. OOP insists that the class structure is intrinsic in the things being sorted, and forces us to decide on our class structure up front.

In IF programming, there's another drawback of OOP that only becomes apparent as you get into the details of a project. Now, we know that OOP is supposed to improve program organization by keeping all of the bits of code and data associated with a particular object in a neat little package, and most of the time that's great. The problem in IF programming is that sometimes several objects will interact in complex ways - maybe even ways we didn't necessarily anticipate when writing the program. For example, Bob (an NPC) wants to stop the player from opening a certain door; what happens when the player tries to knock down the door with an axe? The problem is that we have at least four objects interacting here - Bob, the object representing the player character, the door, and the axe. Situations like this can lead to very difficult debugging problems, because we could have methods on all of the involved objects trying to do something special. Getting the right outcome can be tricky.

Fortunately, in practice these sorts of problems seem to be the exception rather than the rule. For the most part, OOP principles are a big help in organizing code in IF. There might be better ways to write IF, but OOP seems to be a pretty good way.

(Source.http://www.tads.org/t3doc/doc/techman/t3oop.htm[^])


and also look this link for better understanding
http://duramecho.com/ComputerInformation/WhatIsObjectOrientedProgramming.html[^]

Thanks
 
Share this answer
 
v4
Comments
fjdiewornncalwe 4-Jan-12 14:56pm    
If you are going to copy and paste your answer from another source, at least link to that source and give credit where credit is due. I added that in for you. +5 from me for the good info.
Sridhar Patnayak 5-Jan-12 23:20pm    
Thanks Marcus
There really aren't very many in the real world:
1) Much harder to hack together code.
2) Much harder to be flexible with your data - you pretty much have to treat things properly rather than dynamically treating it as a plaything. Mind you, this is only a disadvantage when compared to some tricky assembler code designed for speed - generally it is considered a good thing. FORTRAN (well pre OOP) would let you declare a single character and use it as a four dimensional array of floats...

There is an overhead in learning the OOP idea and implementation, but the rewards in terms of reusability, reliability and understandability outweigh that by a large margin in the long run.

Having said that, I wouldn't try to implement a low level interupt handler in a OO way...it is just not suitable!
 
Share this answer
 
Hi I think it's main disadvantage comes straight from its power. One of the most common things done in OOP is to replace parent classes with derived classes in some places, to specialise the behaviour of the code. Well, if not done carefully, it's easy to invalidate some of the assumptions made in the caller code; and that could be very difficult to spot while reviewing the code, because the types you're seeing declared are not the ones actually being used.

In brief: polymorphism can be made not explicit and thus easy to overlook weird behaviours in the derived classes

Have a look on following links also..
http://wiki.answers.com/Q/What_are_Disadvantages_of_object_oriented_programming_language[^]
http://java5.sofpower.com/oopover.pdf[^]
 
Share this answer
 
Basically this is very negative question but every coin has two sides,
here are some of the disadvantages

1. Offers less number of functions. as compared to low level programming which interacts directly with hardware
2. added training cost for developers
3. hard to upgrade existing procedure level programming
 
Share this answer
 
Most business processes are inherently procedural (workflow etc.), so in the context of business applications you will end up creating procedural code.

This is not a disadvantage per say but it is a mismatch to the problem at hand.
 
Share this answer
 
It is powerful for big/complex projects but it is unsuitable for small projects (structured programming is much better in such scenarios).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900