Wednesday, February 6, 2008

Object Oriented

One the first page of my Web Site on sff.net, there are a couple of moving images, courtesy of Java applets. I yammer at length about the image manipulation part of the project in “Color Cycling with Java.

As noted in the write-up, I undertook the color cycling project because of a long standing love for that particular effect in computer graphic art. It’s a simple trick; it can look spectacular; what’s not to like? Well, there is the part about how web browsers won’t do it without some sort of add-on, hence my Java applets.

What I don’t go into much is the Java part. Having the color cycling applets to point to allows me to claim some familiarity with Java, which is a useful thing for a technical writer these days. So there’s that. Moreover, Java is an Object-Oriented programming language. OOPLs used to be the flavor of the month; now they’re more like boilerplate. You have to claim familiarity in order to even interview for many jobs.

So let’s pause for a heavy sigh. (Sigh). I’ve complained many times about how the use of an ordinary word in a technical context can cause problems when the technical meaning differs significantly from ordinary usage. Jeez, does that apply to “object-oriented.”

Programming “objects” have nigh onto nothing to do with ordinary objects. They are programs! They do not have mass, weight, substance, color, physical dimensions, or persistence. Nor, for that matter, do they have anything to do with object code, the venerable term for a program that has been compiled into machine readable form.

What program “objects” have is “properties” and “methods.” For any old computer geezers such as myself, those translate to “data structures,” and “procedures.” But calling things by previously used names is so old-fashioned.

If that was all there was to it, then one might very well ask why bother, since there were already these perfectly reasonable programming structures called “sub-routines” and “modules.” Well sure, but there were a few new(ish) notions added to the mix: “inheritance” and “instantiation.” The former lets you create new “objects” based on old ones, with some modifications to the “encapsulated” data or the procedures that act on that data. The latter lets you fire off a bunch of similar program parts, each doing its own thing in the “multi-threaded environment” of the modern operating system.

See, this is just like taking your white hat and putting it into your matter duplicator, setting the dials to “blue” and “wings” so you have a new blue hat with wings. Then the blue hat can fly around and make fun of the poor wingless white hat.

That’s why they’re called “objects.” Because objects can do that sort of thing (snark).

Anyway, the idea was to use the object-oriented model to create re-usable program components that can be bolted together with minimal effort to create larger programs. This would have worked if it hadn’t been for those meddling kids and their stupid dog, I mean, if they had managed to get a variable typing system that was both consistent and comprehensible.

Unfortunately, the two major object-oriented languages, C++ and Java, based their variable typing conventions (as well as their syntax) on the C language, and that’s pretty much where the blue hat died and fluttered to the ground. C had so many exceptions and so much arcane weirdness in its variable typing that the whole thing was pretty much doomed from the start. It’s a simple fact that communication among “objects” can cause terrible headaches, because the variables they pass to each other get slippery.

Joke from the 1970s: C is Assembly Language in a clown suit.

Update to the 1990s: And C++ carries an Uzi.

Now realize, very little of this has anything to do with what someone is asking about when they ask you if you are “familiar with object-oriented programming principles.” What that translates to is, “Are you experienced with C++ and Java?”

I will say that the Object-Oriented project/marketing campaign succeeded brilliantly at making a lot more work for programmers. It also set the barriers to entry much higher and it resulted in the situation that programming now absolutely requires computerized programming tools. I wrote my Java applets more-or-less by hand, but I was hacking, just modifying previously written programs and sort of jamming them together. To do a similar project from scratch would have absolutely required a full bore Java programming tool set.

And it all would have been a lot easier to do in Pascal or even Fortran. But web browsers don’t support those, more’s the pity.

6 comments:

HANNAH'S DAD said...

Java would be better described as "sort of object oriented-ish". For the real experience, you're better off with Smalltalk, which takes it seriously.

It also has the added advantages of not being usable for web pages, and of being utterly unwanted in the current job market, so what's not to like?

Right now I'm experiencing the opposite of what you expressed in your post - I've been writing in OO languages for decades, and I'm currently angling for a scientific programming job where they're asking me to use C or FORTRAN. I feel like I've applied for a job as a security guard and they've asked me if I can handle a musket!

Anonymous said...

hannah's dad, you've applied for a security guard job and they've asked you if you can handle a stiletto and a garrote. This is security up close and personal: hands-on, bloody up to the elbow.

I've never been comfortable with the term "object-oriented" for all the reasons listed. Naming is a crucial part of understanding and the OO community got stuck with some pretty non-descriptive and/or indecipherable names. Seems like they spent years just trying to explain their vocabulary. I think they gave up because I haven't read or heard polymorphism in a month of sundays.

HANNAH'S DAD said...

black dog:

I'd never disown C for its role in low level or fast implementations - there are times when getting close to the metal is the right thing to do. My first job ever was programming assembly, so it's not a foreign country to me.

As for OO and wilfull obscurity - yeah, it's there, but there's good stuff as well. I think most good ideas go through the cycle of being
i) invisible
ii) wildly overhyped
iii) turned against
and finally
iv) absorbed into the mainstream

James Killus said...

hannah's dad,

Where are these Fortran programming jobs? Seriously. I'd love to do some Fortran programming again, but I haven't seen a real serious offer in years, except for some financial things where what they're really interested in is prior experience in that specific area.

Of course, the requirement for C along with the Fortran is the real killer. C and Fortran programmers never got along.

The real intent of my argument is that "sort of object-oriented-ish" is pretty much all its ever been. As you note, the number of applications written in Smalltalk is vanishingly small, and I would say that the number of "real" object-oriented applications is of similar size.

HANNAH'S DAD said...

james:

It's a one year contract with the Australian Bureau of Meteorology in Melbourne, doing registration and colour correction on 40,000 old analog satellite photos of tropical cyclones. Sounds very interesting, though I fear I am missing too much essential background knowledge to get it.

It's not really clear what they want language wise either - they mention C, FORTRAN and IDL (That's not the IDL that's part of Corba, but Interactive Data Language for vector processing, which I'd never heard of till yesterday - given your background with air pollution modelling I wouldn't be surprised if you'd used it.) It's a new project, so language choice may be open.

> As you note, the number of applications written in Smalltalk is vanishingly small

Sob :(

James Killus said...

hannah's dad,

I wish I were so cool as to be able to say, "IDL? Oh, sure, I used to code me a bunch of IDL back in the day." But, truth to tell, I'd never heard of it before, either, although I might have if I'd gotten that job with EarthSat back in the 70s. Of course, then my life would probably have been Much Different.