GeekInterview.com
Series: Subject:
Question: 25 of 271

What are the demerits of Object Oriented Programming(OOPS)?

Asked by: Interview Candidate | Asked on: Jun 25th, 2007
Showing Answers 1 - 2 of 2 Answers
prateeks88

Answered On : Nov 4th, 2008

View all answers by prateeks88

Considering the demerits of the OOPS I would say that-itis a lenthy process and takes time for coding(increases the no. of lines of code) as compared to the procedurals BUTOOPS simplifiesthe complex programmes and has much more advantges over its neglectable diadvantges

Yes  1 User has rated as useful.
  
Login to rate this answer.
swamisivakumar

Answered On : Aug 10th, 2009

View all answers by swamisivakumar

Personally I find oops code can get very hard to read, even well written code. The problem is inheritance and polymorphism.The problem with inheritance is that if you want to figure out what a given method does, you have to search up the class hierarchy until you find its definition. In a way, inheritance is worse than goto--at least with goto the destination is somewhere in your function but with inheritance it could be in any number of files. The problem with polymorphism means that simply finding a function with the right name is not sufficient, you have to also look at the parameters. Trying to read code without a good class browser is almost impossible. It IS impossible once you get into virtual functions where the decision of which function gets called is only determined at runtime.For example, suppose you're trying to figure out the following line of code obj.Write(a);. Which function is being called? Well, if you're lucky and you know what type obj is then you probably only have about 10 different versions of Write() to pick from depending upon what a is. If you're unlucky and obj can be of several types, then you got a lot of work cut out for you.Two other oops features that can get really hard to read are operator overloading (fortunately it's rarely used), and class properties that look like simple variable assignment but are really complex function calls.My very first exposure to oops programming was as an intern at Sun Labs (just downstairs from the tcl team) where my job was to instrument C++ kernel code to determine where time was being spent. Kernel programming is hard enough, but the real bear was just trying to read the well-written but deeply inherited code.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.