Hello everyone.

What are the disadvantages/shortcomings of object oriented Programming?:eek:

Hello everyone.

What are the disadvantages/shortcomings of object oriented Programming?:eek:

Google provided a ton of results..... here is just the first hit:

http://wiki.tcl.tk/13398

@ TylerSBrenton: If (s)he asked, you should at least have the common curtosey to provide an answer that isn't a google result.

@ sosina abraha:
There are two branches of programming: functional, and object-oriented. Functional languages leave the entire language at your disposal without having to import other "classes". The problem that arises with functional languages, is that you end up re-typing out code again and again. For instance, let's say you're creating a program that requires networking protocols like TCP/IP and HTTP. So, you spend the time writing the program, and it works perfectly. Now, you go to write another program, some time later, and you require the TCP/IP and HTTP protocols this time. You are going to find yourself re-typing or copy-and-pasting the code from the old program - this can prove to be time consuming, and perhaps even cause big errors in the code. Also note, most functional languages, are scripting languages.

Now, with Object Oriented Programming approaches code importing a little differently. In Java, let's say, you have the option to just use the standard code base, which can keep small programs neat and tidy. But for larger applications, it starts turning into a functional approach to things - and not to mention, some things in Java just aren't possible without importing some classes. Object-Oriented Languages make use of "objects", "classes", "inheritance"...things like that. A class is an object definition, and an object is a creatable/destroyable instance of a class - it's a roundabout definition, but it's the best I can do for the moment. Inheritance allows other classes to keep their inherent functions (or, as Java-heads call them, "methods"), and expand on the number of methods available to the user through that one class.

For more on this, Wikipedia is always a good reference, and if you would like to get into Object-Oriented Programming, Java would be a good place to start - it teaches you what you need to know about OOP, and without the complexities of operator overloading and pre-processor calls inherent in C++.

There are two branches of programming: functional, and object-oriented. Functional languages leave the entire language at your disposal without having to import other "classes". The problem that arises with functional languages, is that you end up re-typing out code again and again. For instance, let's say you're creating a program that requires networking protocols like TCP/IP and HTTP. So, you spend the time writing the program, and it works perfectly. Now, you go to write another program, some time later, and you require the TCP/IP and HTTP protocols this time. You are going to find yourself re-typing or copy-and-pasting the code from the old program - this can prove to be time consuming, and perhaps even cause big errors in the code.

That's why we have libraries...

Now, with Object Oriented Programming approaches code importing a little differently. In Java, let's say, you have the option to just use the standard code base, which can keep small programs neat and tidy. But for larger applications, it starts turning into a functional approach to things - and not to mention, some things in Java just aren't possible without importing some classes. Object-Oriented Languages make use of "objects", "classes", "inheritance"...things like that. A class is an object definition, and an object is a creatable/destroyable instance of a class - it's a roundabout definition, but it's the best I can do for the moment. Inheritance allows other classes to keep their inherent functions (or, as Java-heads call them, "methods"), and expand on the number of methods available to the user through that one class.

Or... not. You've sort of described how the language works, but not really touched on why that's important. Object oriented languages (e.g. Java, Smalltalk) provide a way of modeling an environment as a set of objects and methods detailing how the objects interact. There are also ways of representing an objects relation to another (e.g. the stuff about inheritance). As the project grows, the code should not become more functional; it might use many methods, but that's not the same as being functional. Procedural programming (e.g. C), allows you to define a set of procedures (or functions) and run them in a specific order. Some people might make the argument that OOP style is possible in C, but it's messy. Functional programming langauges (e.g. Lisp, Haskell) usually have very terse solutions to problems, but as they usually are non-imperative (i.e. lack side effects such as variable state), they aren't very popular for programs that have to retain state.

For more on this, Wikipedia is always a good reference, and if you would like to get into Object-Oriented Programming, Java would be a good place to start - it teaches you what you need to know about OOP, and without the complexities of operator overloading and pre-processor calls inherent in C++.

Complexities of operator overloading and pre-processor calls? :lol:

You might also consider Python, Ruby, or Smalltalk if you're wanting to try an OO language. Java is widely used, but it's certainly not the flagship language for the OO paradigm...

@ sosina abraha:
There are two branches of programming: functional, and object-oriented.

What about Logical (Prolog) and Procedural (C/Fortran)

From the way I was tought things, function programming is synonymous with procedural programming.

As for the "complexities" of operator overloading and pre-processor commands, I consider those complexities, because if you overload an operator, and you are developing a large application, the operator overloading can be lost in the lines, and become a serious source of frustration - something I've experienced in the past, and which has led me to keep away from C and C++. As for pre-processor commands, I just don't see a point for them aside from incorporating header files.

I'm a Lisp (primarily), Python, Perl, Java, BASIC, Expect and shell programmer by trade, and am learning Linux-based x86 assembly - all languages which have no imminent focus on pre-processor calls.

I know I didn't provide a complete definition of Object-Oriented Programming, but I got the ball rolling, and provided the OP with a direct link to information (Wikipedia), instead of just a "just google it" response.

Functional programming langauges (e.g. Lisp...

Lisp is object-oriented, but not forcefully object-oriented, like Java. :cheesy: Not to mention, Lisp prides itself on not locking itself down to one solution per problem.

From the way I was tought things, function programming is synonymous with procedural programming.

You were taught wrong. From wikipedia:

Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming emphasizes the application of functions, in contrast with imperative programming, which emphasizes changes in state and the execution of sequential commands.[1]

The articles on procedural and imperative programming have notes mentioning that the two terms are mostly interchangeable.

As for the "complexities" of operator overloading and pre-processor commands, I consider those complexities, because if you overload an operator, and you are developing a large application, the operator overloading can be lost in the lines, and become a serious source of frustration - something I've experienced in the past, and which has led me to keep away from C and C++. As for pre-processor commands, I just don't see a point for them aside from incorporating header files.

Operator overloading is one of the things I wish Java had. Of course, there is a matter of when it's appropriate to use operator overloading. As to pre-processor commands, they definitely have a point if you know what they do.

I'm a Lisp (primarily), Python, Perl, Java, BASIC, Expect and shell programmer by trade, and am learning Linux-based x86 assembly - all languages which have no imminent focus on pre-processor calls.

Congrats on your trade. Hopefully your OS-specific assembly will get you far. The pre-processor calls from C(++) are compiler functions, before the code actually gets translated to machine code.

I know I didn't provide a complete definition of Object-Oriented Programming, but I got the ball rolling, and provided the OP with a direct link to information (Wikipedia), instead of just a "just google it" response.

You gave a basic explanation in terms of a small subset of keywords typically associated with OOP. You didn't actually answer the OP's question (admittedly, I didn't either).

Lisp is object-oriented, but not forcefully object-oriented, like Java. :cheesy: Not to mention, Lisp prides itself on not locking itself down to one solution per problem.

Lisp is better known as a functional language. While it might support objects, I don't know that it's really OO (see my previous statement about C). Only used it a very small amount though, so I could be wrong.

@OP: Sorry for the hijacking. As to your question, the drawbacks from OOP typically relate to system design, when an OO model doesn't match your data organization. There might also be issues if you need low level code, such as a kernel, since an OO model is done at a level with the hardware abstracted away.

Lisp can be used very much like a OO language, just as C can be used like a Functional language with the correct libraries. But the framework and libraries included are Functional for Lisp and Procedural for C and the languages (as I would assume) are grouped according to to the norm.

Regards,

Tyler S. Breton

Types of programming paradigms (note I am not saying types of Programming languages):

  • Imperative - C, Ada, Pascal, Modula 2
  • Functional - LISP, FP
  • Aggregate - SQL, Mathematica
  • Concurrent - SR, Lynx
  • Dataflow language - Val, Sisal, Post
  • Declarative - Prolog, Godel
  • Object Oriented - C++, Java, C#

Functional languages leave the entire language at your disposal without having to import other "classes". The problem that arises with functional languages, is that you end up re-typing out code again and again.

You can always use packages...

Lisp is object-oriented

Object oriented and Funtional programming are two different paradigms altogether. Saying LISP is object oriented would be completely wrong.

One of the disadvantages of Object Oriented programming I can think of is clubbing the program to death by overusing the abstraction mechanism. As said by someone "Object oriented programming is actually writing simple programs the complicated way."

Lisp certainly is object oriented, if that's what you want. With Lisp's macros and lexical scoping, you can do anything. Common Lisp was the first ANSI-standardized object oriented language, ever.

Common Lisp is not really a 'functional' programming language, it's a language that lets you program the way you want. It has variables that you may modify -- that are mutable -- so you can use it in a brain-dead manner the way you would use C. You could also choose not to modify your variables, and you have lexical scoping, which means you can use it in a functional manner. Scheme is better at that, though, since CL is kind of weird with its 'apply' and whatnot. Lisp certainly is better for object oriented programming than, say, C++ or Java, in the general sense.

The best language for programs that need to retain state, though, is Haskell, IMO. No other language handles state transformation in a better way. None that I've heard of.

Object orientedness is really about having objects pass messages to one another. The purpose of inheritance in languages like C++ is to allow for a form of dynamic typing. Object oriented is really a subset of what Lisp offers, since an object is nothing more than a function that takes some finite enumeration of method names as its first argument, along with a list of further arguments. Common Lisp has more explicit object orientation, with classes and the like.

Type of programming language should not be confused with what the langauge is capable of doing.

Pure object oriented langauges are langauges of the type Java, C# etc. wherein you have to have a class -- it is a must. As a matter of fact even C++ isn't a object oriented language as such, it would be more appropriate to call it a Multi paradigm supported langauge since you can write imperative as well as object oriented code.

In the same way it would be inappropriate to call Javascript and ASP technology as Object oriented langauges -- they are object Based languages which utilise objects.

LISP, ML etc. are functional languages though LISP shines out to be a multi pardigm supporting language with support for OO features.

BTW object orientedness is all about classes and not objects -- that would be object based you are talking about...

Thank you.

Technically, Java is forcing you to use objects but it's not fully object oriented. Smalltalk on the other hand exemplifies the OO paradigm better, since everything is an object. By everything, I mean it includes methods, data, and aggregations thereof. In Java or C#, you get data aggregations with related methods, but the methods (and sometimes the data) are not objects themselves (though they might return an object).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.