There is a kind of mania for object-oriented programming at the moment, but some of the smartest programmers [blocked] I know are some of the least excited about it.
My own feeling is that object-oriented programming is a useful technique in some cases, but it isn't something that has to pervade every program you write.
You should be able to define new types, but you shouldn't have to express every program as the definition of new types.
I think there are five reasons people like object-oriented programming, and three and a half of them are bad:
There's a mania for object-oriented programming, yet some of the smartest programmers [blocked] I know are least excited. It needn't pervade every program.
There are five reasons people like it, and three and a half of them are bad:
There's a mania for object-oriented programming, but some of the smartest programmers I know are least excited about it. It's useful in some cases, but shouldn't pervade every program. Five reasons people like it — three and a half of them bad.
Object-oriented programming is exciting if you have a statically-typed language without lexical closures or macros.
To some degree, it offers a way around these limitations. (See Greenspun's Tenth Rule [blocked].)
Object-oriented programming is popular in big companies, because it suits the way they write software.
At big companies, software tends to be written by large (and frequently changing) teams of mediocre programmers.
Object-oriented programming imposes a discipline on these programmers that prevents any one of them from doing too much damage.
The price is that the resulting code is bloated with protocols and full of duplication.
This is not too high a price for big companies, because their software is probably going to be bloated and full of duplication anyway.
Object-oriented programming generates a lot of what looks like work.
Back in the days of fanfold, there was a type of programmer who would only put five or ten lines of code on a page, preceded by twenty lines of elaborately formatted comments.
Object-oriented programming is like crack for these people: it lets you incorporate all this scaffolding right into your source code.
Something that a Lisp hacker might handle by pushing a symbol onto a list becomes a whole file of classes and methods.
So it is a good tool if you want to convince yourself, or someone else, that you are doing a lot of work.
One: it's exciting if your statically-typed language lacks closures or macros, routing around those limits. (See Greenspun's Tenth Rule [blocked].)
Two: big companies like it, because their software is written by large teams of mediocre programmers, and OO keeps any one from doing too much damage — at the price of bloat their code would have had anyway.
Three: it generates a lot of what looks like work. OO is like crack for the programmer who buries his code under elaborate comments — good for convincing yourself, or someone else, that you're doing a lot of work.
OO is exciting if your statically-typed language lacks closures or macros — a way around the limits. It's popular at big companies because it disciplines mediocre programmers, at the price of bloat. And it generates a lot of what looks like work.
If a language is itself an object-oriented program, it can be extended by users.
Well, maybe.
Or maybe you can do even better by offering the sub-concepts of object-oriented programming a la carte.
Overloading, for example, is not intrinsically tied to classes.
We'll see.
Object-oriented abstractions map neatly onto the domains of certain specific kinds of programs, like simulations and CAD systems.
Four: if a language is itself an OO program, users can extend it — maybe; or maybe better to offer its sub-concepts a la carte, since overloading isn't intrinsically tied to classes.
Five, the legitimate one: OO abstractions map neatly onto certain domains, like simulations and CAD systems.
Four: if a language is itself an OO program, users can extend it — maybe; or maybe better to offer its sub-concepts a la carte, since overloading isn't tied to classes. Five, the legitimate one: OO maps neatly onto simulations and CAD.
I personally have never needed object-oriented abstractions.
Common Lisp has an enormously powerful object system and I've never used it once.
I've done a lot of things (e.g. making hash tables full of closures) that would have required object-oriented techniques to do in wimpier languages, but I have never had to use CLOS.
Maybe I'm just stupid, or have worked on some limited subset of applications.
There is a danger in designing a language based on one's own experience of programming.
But it seems more dangerous to put stuff in that you've never needed because it's thought to be a good idea.
Rees Re: OO [blocked]
I've personally never needed object-oriented abstractions. Common Lisp's object system is powerful, yet I've never used it once or touched CLOS, even where wimpier languages would need it.
Maybe I'm just stupid. There's a danger in designing a language from your own experience — but more dangerous to put in stuff you've never needed because it's thought to be a good idea.
I've never needed OO abstractions — Common Lisp's powerful object system I've never used once. Maybe I'm just stupid; there's a danger in designing a language from your own experience. But more dangerous to put in stuff you've never needed.