PROGRAMMING PARADIGMS

Serius Pet Tricks

Michael Swaine

The late physicist and Nobel laureate Richard Feynman once trained his dog to retrieve socks by indirection. The dog would spot a sock on the floor and zip off, circling around the house, entering the back door, grabbing the sock, and retracing its steps to emerge a minute later from the front, sock in mouth, all the while exhibiting supreme confidence that it was behaving in a perfectly rational manner. Feynman had convinced the dog that this was the only reasonable way to retrieve socks.

That, according to his biographer James Gleick, was Richard Feynman. He would teach old physicists the new trick of thinking of particles traveling backward in time, and the very perverseness of the idea would appeal to him. His sense of humor was legendary: While working under the highest security on the atomic bomb at Los Alamos, he used to crack colleagues' safes for laughs.

I've tried, with less perverseness and less luck, to teach my dog Molly a few tricks. Molly is not dumb. She's certainly smarter than, say, Michael Abrash's dog. (She's bigger than Jeff Duntemann's dogs, too, being more or less a Labrador, and since I found her abandoned in the company parking lot, I sometimes call her the DDJ Lab.)

I've had some success in teaching Molly commands like "sit" and "stay," and I've taught her the difference between "mailbox" and "walk." Anytime I step out the door, she assumes we're going for a walk and runs on ahead. The question for her is: Are we going up the trail into the woods (her favorite), or down the driveway to the mailbox (no big deal)? She listens attentively for what I'm going to say and then takes off running in one direction or the other. Sometimes for a stretch of weeks she will seem to understand perfectly. Then she'll seemingly forget and run up the hill every time, no matter what I say. My theory is, she's trying to teach me which way to go.

After all, she taught herself what car keys are for. With no help from me, she figured out that every time I step out the door and take my keys out of my pocket, I am going to get in the car and drive off without her. Now, as soon as she sees the keys, she sits back down and watches mournfully. I sometimes wonder just how smart she is.

The Dog Star

"Serius" was the name of the superintelligent dog in Olaf Stapledon's classic science fiction-novel of the same name. "Serius" is also the name of the software product that the UPS driver tossed out of the truck onto my driveway a while ago. (His delivery technique owes a lot to his attitude toward large dogs, and I've had no luck at all in training him.) This is version 3.0 of Serius, and the product has learned some new tricks since its last release.

Serius is an object-oriented development system that can be used profitably by casual and experienced programmers, from people who don't want to write code at all to those who debug C code in their sleep.

Earlier in its life, Serius attracted some pats on the head from programmers and pundits. Charles Seiter in MacWorld called it one of the few new programming schemes to take seriously. Of course, in that publication he was talking to a Macintosh audience, and not an exclusively technical one. But J.D. Hildebrand, writing about Serius in Computer Language, said that he was extremely impressed by it and implied that it was reason enough to buy a Macintosh.

Serius seems to be particularly popular with people who: 1. are developing multimedia products and; 2. while not necessarily put off by programming, want to spend the bulk of their efforts on content development. At a gathering of multimedia developers last year, I kept hearing the name Serius, and a session panelist confirmed that most of the serious multimedia developers he knew were in fact Serius developers. That was when I began to get interested.

Serius is for both Macintosh and Windows. The Mac version plays by Mac rules and supports Mac-model interapplication communication and publish and subscribe.

It really consists of two products, which can be purchased separately: Serius Workshop and Serius Developer Pro. Serius Workshop is a user-developer system, while Serius Developer Pro requires real programming experience; it's a tool for serious developers.

I wish the folks at Serius Corp. hadn't used such generic names. The capitalization helps here, but I would hate to have to give a talk about these products to Serius programmers or to serious programmers.

Whether you're a potential Serius programmer or a serious programmer, Serius Workshop is where you start. (See what I mean?)

Serius Workshop

Serius Workshop is a visual programming system that produces stand-alone applications.

All visual programming systems look at least a little like flowcharts: boxes and lines. Labeled boxes and awkwardly labeled lines. Too often, flowcharts hide everything interesting or difficult about a program in a box labeled "process." Flowchart-like diagrams are good for representing flow, but they need some help when it comes to representing functionality. And when a visual, flowchart-like model is used to create programs rather than just to represent their structure and flow, this can be an even bigger problem.

Flowcharts were developed to represent procedural programs. Like a lot of visual programming systems, Serius claims to be an object-oriented system. Does that make a difference? Object-oriented programming systems at least make it clear where to put the functionality. The boxes are objects, and objects have behaviors associated with them. Unfortunately, most visually oriented programming systems fall short of being real object-oriented programming systems. There may be a Catch-22 at work: The ideal paradigm for visually oriented systems is OOPS; the ideal user of visually oriented systems is a novice; the ideal paradigm for a novice is something other than OOPS. It's a theory, anyway.

The authors of Serius did not accept that theory. Serius Workshop is a pretty serious application-development system with an object-oriented flavor, accessible to people who do not think of themselves as serious developers. Not complete novices, perhaps, but people like multimedia content developers who need to program, but don't think of programming as what they do.

Among the object-oriented features are plug-and-play reusability and object persistence. What's chiefly missing is inheritance.

Serius Workshop is also missing the ability to create your own objects, but Serius Developer Pro supplies that. Serius Corp. itself supplies a lot of ready-made objects. Workshop comes with objects such as menu bars, menus, menu items, windows, buttons, radio-button groups, other controls, lists, date and time objects, text and number objects, pictures, and cursors. Program control is handled via loop and subroutine objects, user interaction via notification objects, and file operations via file objects. Two kinds of peripheral devices, printers and scanners, have objects, and there is a painter object, which is really the guts of a full paint program. Serius also sells packages of objects for serial communications, database development, interapplication communication, multimedia development, and Serius XCMD, which lets you incorporate HyperCard external commands and functions (original or new XCMD format) into Serius applications. Windows versions are forthcoming for all but XCMDS.

Short Subjects

Serius Workshop uses a project-and-subproject model. A project is just an application under development. Subprojects, which the Serius authors--in a less than serious moment--decided they would shorten to "subjects," are reusable. A typical reusable subject would be a standard menu-bar subject, containing objects for a menu bar and the File and Edit menus that are standard in most Macintosh applications.

To build a subject, you work in two windows. In one, you just deposit icons for the objects you want to use, clicking on each icon to edit it. Each object has its own custom editor for setting its characteristics. What you are creating are instances of objects, so of course you can have several instances of the menu object, each with its own characteristics. In the other window, you deposit icons for functions specific to the objects you've chosen, and string them together in a way that looks suspiciously like procedural programming. Underneath, Serius is creating objects and messages, but what you build in the window are short function chains. This is probably clearer to the casual user than a more visible object-oriented approach.

You also wire the function icons to the object icons in the other window, for example, drawing a line from the icon for the Quit menu item in the objects window to the icon for the Quit function in the functions window. The screen can get messy fast, with lines connecting chains of functions, lines connecting functions to objects, and labels on the lines and above the function icons. (A line from a menu-item object to the function triggered when it is selected would have the label "selected." The labels on function icons are for parameters.)

I know: The lines and boxes sound messy, the confounding of paradigms sounds confusing, and you are wondering about performance. But I find that for small subjects, the model is easy to grasp, feels pretty natural, and doesn't generate a lot of visual spaghetti. And for small, simple projects, it generates pretty efficient, compiled, stand-alone applications. I admit I haven't written anything that would really test it, like a distributed database system.

ObjecTalk

For those who absolutely have to work in a textual paradigm, the designers have provided ObjecTalk, a scripting language. Anything you can do by wiring up icons on the screen, you can also accomplish via ObjecTalk code. An ObjecTalk utterance consists of a function name and probably some parameters; for example: Open window My-Paint.

That's pretty simple, but there a couple of noteworthy points about this language.

First, it is not an alternative to the entire visual programming paradigm of Serius Workshop, but only for functions. You can define functions either via icons or via ObjecTalk, and that's all. In practice, you choose whether you want to work in ObjecTalk or ObjecSketch (the icon mode) for each subject. You can switch back and forth at any time; the two map one-to-one. Each open subject can have its own mode, so you may see textual programming in one window and wired icons in another.

Second, there's the fuzz. If you hate and scorn scripting languages like HyperTalk for their overhead dedicated to user-friendly Anglicization, then you'll really be annoyed by ObjecTalk. ObjecTalk, its designers trumpet with only slight exaggeration, has no syntax. Just get the idea down somehow or other, and the fuzzy-logic parser will figure out what you mean.

Well.

It's easy to be sarcastic, but the idea has merit. It is appropriate for its target user, it raises technical problems worth being raised, and the ObjecTalk implementation is actually pretty good. It's not by any stretch of the imagination syntaxless--I can't imagine what a syntaxless language would be. It's also not finished, a fact that the Serius authors frankly acknowledge. They expect to continue exploring the possibilities of fuzzy parsing in future revisions. But the current example is interesting. For example, all the following can be equivalent:

  Open MyPaint   Open MyPaint window   Show MyPaint   Open the window named MyPaint   Display
MyPaint   Display My_Paint   Open MyPint   Aperis fenestram Mypaint

Most of the variations above are built-in equivalences, like "show" = "display" = "open" or optional words like "the" and "named" and "window" (optional if leaving it out is not irremediably ambiguous), but there are some other things afoot as well. You can create your own language-element names, including translating ObjecTalk into a foreign language. (Serius is in the process of developing foreign-language versions, though apparently Latin is not a high priority.) And misspelling is tolerated--that's the real fuzzy-logic aspect. The programmer has two settable parameters--the Match Threshold and the Ambiguity Threshold--for controlling the degree of ambiguity accepted and for resolving it.

My guess is that most serious programmers would enjoy the challenges of developing such an interface or at least studying how Serius Corp. has approached it, while most Serius programmers would actually enjoy using it.

But only serious programmers would get anything out of Serius Developer Pro.

Serius Developer Pro

Serius Developer Pro is a separate product that allows you to create your own Serius objects and functions. Your objects and functions have exactly the same status as objects and functions developed by Serius, and can be sold to Serius users license-free.

Serius Workshop doesn't emit any code. It just spits out finished, compiled, stand-alone applications, using supplied objects. Serius Developer Pro produces objects and functions for Serius Workshop. It isn't a compiler; you have to write the code for these objects and functions using a C or Pascal compiler, then import the code into Serius Developer Pro.

When you work with Serius Workshop, you only have to think about objects and functions. When you work with Serius Developer Pro, you deal with object types, functions, methods, and events. You can use Serius Developer Pro to construct any of these four kinds of things.

The Serius Developer Pro manual is as important as the program itself, since it tells you how to write the code that Serius Developer Pro turns into an object type, function, method, or event.

The program walks you through the remaining steps in creating these things. For example, to create a new object type, you have to specify a type ID, supply any needed resources used by objects of this type, define data structures for any data stored by objects of this type, supply code used in the creation and assignment of objects of this type, and provide a user dialog for editing objects of this type--that is, for allowing the user to set object properties. Serius Developer Pro guides you through the process of packaging these things into an object type that Serius Workshop can use.

It doesn't sound like Serius Developer Pro does a whole lot, since it doesn't produce code or finished applications, and since I say the manual is as important as the program. But it does something very important: It imposes a single, strict approach to object development. Your objects will look and act like they were developed by Serius, and users will have no more trouble using them than Mac users have using their second or third Mac application. By exerting this level of control, Serius comes closer to the promise of reusable components than object-oriented programming usually does.

This, I think, makes Serius worth a look even if you don't find the product itself interesting. While you may not program on the Mac or Serius may not meet your needs, it does provide an interesting example of an approach to reusable components that actually works.

For More Information

For More Information

Serius Corp.
6400 Commerce Park
488 East 6400 South, Suite 100
Salt Lake City, UT 84107-7590
801-261-7900

Serius Workshop, $395.00
Serius Developer Pro, $1495.00
Serius Communications Object
Library, $145.00
Serius Multimedia Object
Library, $195.00
Serius Interapp Object Library,
$95.00


Copyright © 1993, Dr. Dobb's Journal