ACM Queue: Schizoid Classes

Schizoid Classes, Rodney Bates

Smalltalk-80 was an important and enlightening experiment in just how far object-orientation can be taken in a programming language. It is simple, compact, and shows a rare and refreshing integrity of concept. To accomplish its goals, it introduces the idea that the variables of a class can be either class variables or instance variables, and the methods can be either class methods or instance methods. This turns the class into a mixture of two fundamentally different concepts—type and module—with very different semantics. Smalltalk manages to do this relatively cleanly.

Unfortunately, two more recent languages, C++ and Java, have taken this same distinction and turned it into a gratuitous mess.

The author is of the opinion that [t]he best-designed languages give you two abstraction tools—a module and an object type—each of which serves its own purpose reasonably well - I wonder if he is thinking about Smalltalk or about Ada...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Neither

I wonder if he is thinking about Smalltalk or about Ada...

Probably neither. Later on the article he notes:

Special, one-instance forms of classes are, for many programming problems, not as good a conceptual match as modules.

But, given that he works with Modula-3 and Oberon, it's probable that he thought of those.

Ada

The Ada plug was mine... As most LtU-ers know I teach Ada ;-)

Ada's popularity with students?

I wonder: how popular is an Ada programming course with students, taking into account that the language gets so little publicity (outside LtU, that is :-) ?

Low, very low... But then, m

Low, very low...

But then, many realize that they got a lot from taking the course (compared to other related course for example).

re Ada

The way I see it, I teach software design techniques (and related PL features). Ada is just a tool.

A fair percentage of the students realize (*after* the semester ends ;-) that we covered issues like designing good module interfaces, using genericty, careful use of inheritance and subclass polymorphism and design uses of concurrency. All, issues that are going to be relevant whether you program in Ada, C++, Java or C#...

The main thing missing is functional programming techniques (but then, they can come to my EOPL based course for that, if they want to...)

He's talking about Ocaml :-)

As Ocaml has both- and both are used for distinctly different purposes.

My opinion is that the difference between the journeyman Ocaml programmer and the master Ocaml programmer (or possibly between the apprentice and journeyman) is understanding and appreciating modules- something I only recently got.

ML and modules

SML has only modules, no classes. Can't say I miss them that much, especially with a nice defunctorizing compiler like mlton. Even in OCaml I don't use classes, but maybe I'm atypical.

classes vs prototypes

Since I started learning to think with objects and classes I thought that class variable have something really bad.
I mean, especially when you start thinking about the duplication of instance variables in class objects.

It's been a while since prototype based language have been introduced, and I have this feeling that they're more conceptually simple and somewhat 'cleaner' than clas based ones.

I wonder if there is something intrinsically wrong in using prototypes instead of classes, someone has hints about this ?