in reply to I dislike object-oriented programming in general

No programming paradigm can aspire to completeness.
All four styles: procedural, OO , declarative and functional should have their place.
Bad feelings towards one of them is perhaps not the best starting point, but often OO evangelists say that OO is not a silver bullet and then continue forgetting this ( a style figure which may be compared to paralipsis).
I don't think that good design should model the world, it needs to serve other purposes, including the ones you mention. The design patterns are a good example.
Tabari
  • Comment on Re: I dislike object-oriented programming in general

Replies are listed 'Best First'.
Re^2: I dislike object-oriented programming in general
by erroneousBollock (Curate) on Oct 20, 2007 at 06:25 UTC
    I don't know why, but I've always felt uncomfortable speaking of OOP as a programming paradigm (it was taught that way to me); rather it always seemed to me that perhaps OOD is a manner of abstraction that may apply to more than one programming paradigm.

    The three main programming paradigms would obviously be "imperative", "logical" and "functional". Am I correct in believing that all three paradigms could host OOD practices ?

    If that's the case, then we can say that the manner of abstraction is somewhat orthogonal to the operational semantics of the language:

    • O'Haskell is an object-oriented abstraction library for Haskell.
    • CLOS is an all-encompassing object system for Lisp.
    • LogTalk and OL(P) are examples of object-oriented abstraction libraries for Prolog.

    Languages usually aspire to one paradigm (exceptions include languages like OCaml which implement both "imperative" and "functional" semantics).

    Within languages, programmers often find ways to express other paradigms within the paradigm of the host language:

    Anyone have any thoughts on this?

    -David

      The lazy answer is that these are all Turing complete programming languages, and can thus (skipping a few implicational steps) emulate each other. So yes, you are correct that given any Turing complete programming language, we can do object-oriented programming in it. Since all implementations of programming languages run on a computer, ultimately what you are doing is functional/imperative/logical/object-oriented programming in machine language.

      However, it's a separate thing to ask if the syntax and semantics of a programming language makes one paradigm easier or harder than the other. I find programming languages such as Scheme much easier to work with exactly due to minimalistic core features and closures: if I want objects, I'll just wrap the methods in a closure. Doing the reverse in, say Java, that is, using classes and objects to emulate closures entails creating a new class definition for each closure you use, then instantiating objects from them.

      Both are possible approaches, and as has probably been discussed in the monastery many times (sorry, I can't search right now), closures and classes/objects are just about equivalent. Now, many "functional" programming languages support objects (since it's really easy to do with closures) and many "object-oriented" programming languages support closures. Arguing which one is better is a source of much heat but usually little light.

      As for me, I'm prone to pick a programming language that has closures rather than one that only has objects, because I tend to use closures more.

      --
      print "Just Another Perl Adept\n";

      I think you have a point. Logical programming describes what the solution looks like; functional, a set of transformations from initial conditions to the solution; imperative, a sequence of steps from here to there. OO describes... what? How a bunch of things interact in a system that, if you're lucky, gets you where you want? It's a useful way of breaking down problems in the imperative paradigm, but not really a new mode of thought.