Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ziggy (25)

  (email not shown publicly)
AOL IM: ziggyatpanix (Add Buddy, Send Message)

Journal of ziggy (25)

Thursday January 20, 2005
11:34 AM

What's wrong with OOP

[ #22806 ]
I saw this critique of object oriented programming via Lambda the Ultimate[1] today. The critique starts out good, with this opening:

Some shops claim OOP success, but many I've spoken with are still "working on it." Still trying to get OOP right after ten years? Something strange is going on here.

From here, the author, Richard Mansfield, walks down a well-worn path of overgeneralization, over-eager extrapolation, and frustration with poorly designed/engineered tools. Read between the lines, and this isn't a critique of OOP, but a critique of objects as expressed in Windows and C++. For example:

OOP actually originated to assist in a highly specialized kind of programming: modeling such natural phenomena as weather patterns. But it got its major boost during the paradigm shift from DOS to Windows. With DOS, programs were linear. The user was guided through a series of steps, one after the other. With the advent of the Windows GUI, users were presented with a set of components on a desktop (text boxes, buttons, menus, and so on). The user got to decide how often and in which order to activate the components. This desktop metaphor is easiest to manage if programmers embed programming and data such as size and position in each separate object, ready to respond to the user.

Clearly, there is more to OOP than weather simulations. I still run in fear whenever I think about how Windows apps work under the hood. (Cocoa, based on ObjC, is much easier to comprehend.) Throwing out OOP because C++ isn't exactly an OO programming language, or because Windows is a pile of crap is just a specious argument.

That's sad, because there really is a good position to defend here. Not all programming is suited for OOP. Sometimes, a procedural solution is best -- like shell scripts, quick one-page Perl hacks, or whatnot. Sometimes, a good object oriented interface really is the simplest, easiest and best way to describe or implement an interface (witness DBI and IO::All for just two examples). Sometimes a more functional approach is best (sort, map and grep).

It all comes down to this: there's more than one way to do it. As tchrist used to say, if you haven't studied the four main styles of programming (procedural, object-oriented, functional and logic), your education is incomplete. (paraphrased from memory)


[1] If my wife is reading this, I'm talking about the geeky lambda, not the GLBT community support group.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.