This opinion is still controversial amongst Java programmers.

This opinion is still controversial amongst Java programmers.

Object Oriented Programming is mostly a one trick pony and that trick is called polymorphism.

3 thoughts on “This opinion is still controversial amongst Java programmers.

  1. people.csail.mit.edu – RE: What’s so cool about Scheme?

    The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said “Master, I have heard that objects are a very good thing – is this true?” Qc Na looked pityingly at his student and replied, “Foolish pupil – objects are merely a poor man’s closures.”

    Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire “Lambda: The Ultimate…” series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.

    On his next walk with Qc Na, Anton attempted to impress his master by saying “Master, I have diligently studied the matter, and now understand that objects are truly a poor man’s closures.” Qc Na responded by hitting Anton with his stick, saying “When will you learn? Closures are a poor man’s object.” At that moment, Anton became enlightened.

    Like

  2. When I was a kid I taught myself C++ because I wanted to program my own game. The only other language I knew at the time was BASIC.

    I remember building up elaborate class hierarchies, but I never had a class on OOP before, so what I actually did was basically write each class of my program as a single miniature imparative program with a state and a few state-transition functions. Then I would use the C++ multiple inheritence feature to combine these primitive classes into larger classes.

    So I didn’t write classes of objects, I wrote classes of imparative programs. Each imparative program maintained it’s own state which was basically a Vector containing many entries of a struct. For example, if I wanted two enemies, I’d ask the “enemies” class to create two enemies, and it would store these enemies into a vector and return a reference to each of these vectors. The “weapons” class had a table of weapons,the “level” class had a table of levels.

    So, to “reuse” my code, rather than create a private variable and instantiate that variable in the constructor, I would just inherit the whole class, which would inherit the private variables and the public constructor and public methods, and then it was a part of my program.

    Then I’d have a “main” class which inhereted a few of the other super-classes (game state and configuration file loading), each of which were a multiply-inherited amalgamation of several other more primitive classes. So the end result was a “main” class that basically contained the super-state of the all classes in the entire program along with the union of all public methods.

    It wasn’t until college when I tried sharing my code with friends that people told me that not only I was doing it completely wrong, but I was crazy and how did I ever think to do things this way, and my code was just incredibly useless. But before then my method of code reuse made total sense to me.

    Also, I love that Joe Armstrong quote!

    “The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.”

    He once told an amusing anecdote at the start of his presentation at Strange Loop about being unable to find a local Grunt. The presentation was called “The Mess We’re in,” in which he gently rants about how software is too complicated nowadays, but also makes some insightful observations as he rants.

    youtube.com – “The Mess We’re In” by Joe Armstrong

    Like

Leave a comment