January 93 - As Easy As A, B, OOPC?
As Easy As A, B, OOPC?
Mark D. Gerl
The intent of this article is to provide you with an introduction to Electron Mining's
OOPC, the newest player in the object-oriented software development game. I'll tell
you what you get with OOPC, what you can expect OOPC to do for you, and what kind of
service you can expect from Electron Mining, based on my personal experiences.
Finally, I will give some insight into what OOPC is best suited for and even add some of
my own opinions.
This article will not tell you how OOPC does its magic, otherwise it would just be a
plagiarization of the OOPC manual. In addition, I will not waste any trees comparing
(in whole) MacApp or the THINK Class Library (TCL) to OOPC because that would be
like comparing apples to oranges (comparisons of this sort are based on individual
requirements and needs). Readers will have to make their own overall comparisons.
For the record, OOPC version 1.1.6 is being considered at the time of this writing.
introduction
What is OOPC?
OOPC (pronounced "oop-see") stands for "Object Oriented Programming in C". Rather
than being an extension to the C language, OOPC is more like a sophisticated use of ANSI
C. Through clever use of macros and function calls, OOPC provides C programmers
with a highly flexible, fully dynamic, object-oriented development system. Being
modeled somewhat after the Common Lisp Object System (CLOS), OOPC's
object-oriented features support list is very aggressive and reads more like a wish
list. Along with the expected features, OOPC also supports the following
object-oriented capabilities:
• Multiple inheritance
• Class variables
• Function overloading
• Dynamic object binding
• Dynamic class definitions
• Dynamic inheritance (objects can change their inheritance at run time)
Being ANSI C bound does limit OOPC's OOP completeness. For example, OOPC does not
provide support for operator overloading, default method parameters, or
protected/private method and data access.
It is clear that OOPC has no roots in MacApp or TCL, except where the Macintosh
Toolbox was modeled. Instead, OOPC provides its own class architecture. In any case,
Electron Mining doesn't appear to be in any immediate danger of lunging legal
personnel from Apple looking for their next victim.
Just Say No (to the Toolbox)
Designed to be platform independent, OOPC provides a complete abstraction of the
Macintosh Toolbox. This means that you will not be making calls directly to ROM
routines unless you're extending OOPC's functionality. For example, OOPC provides its
own calls for memory management, drawing environment (including offscreen),
events, printing, and file I/O (including resources). Whereas OOPC internally uses
styled TextEdit in its current version, it does not call the Memory, Dialog or List
Managers. All this means OOPC is uniquely prepared to go cross platform. Electron
Mining admits it is working on a Microsoft Windows version at this time.
Substance
Being no slouch for content, OOPC contains about 60K lines of code, around 90 classes,
and too many system functions and methods to count. In addition, source code is
included for a floating window WDEF, a popup menu CDEF (thus eliminating the need
for the buggy System 7 CDEF), and the OOPC Browser INIT (referred to in this article
as the run-time object inspector for the THINK C Debugger). Electron Mining also
provides OOPC Tip Sheets (in THINK C text file format) which are designed to augment
the user manual. Accompanying all this electronic data is a 420 page indexed manual
that is purely for user reference.
Demo Draw
OOPC ships with a fairly complete sample application, called "Demo Draw". A built
Demo Draw application (287K in size) is roughly 2355 lines of application code, not
including the actual draw classes. These tear-off tools, colors, and colors palettes,
tool and draw object actor classes, etc. are themselves reusable (and nicely separated
from the Demo Draw application code) and thus can be considered generally available
and part of OOPC. To help quantify the functionality gained from the number of code
lines, OOPC's Demo Draw application supports the following features:
• Six draw tools including a polygon tool, a text tool, and the arrow
selection tool;
• Draggable, resizable, colored, patterned, filled objects including their
border lines;
• Custom pen sizes;
• New, Open, Save, Save As, Revert, Page Setup, and Print commands;
• Undo / Redo and clipboard support (but no Show Clipboard command);
• Page boundaries, offscreen image buffering (memory permitted), and 2D
scrolling; and
• Multiple open documents, automatic window tiling, and smart window
zooming.
For the sake of doing comparisons, MacApp 3.0.1's C++ samples range in size from
Skeleton at 1036 lines of code to DemoDialogs at 3416 lines to Calc at a hefty 9172
lines of application code.
Development Requirements
The advantage of being ANSI C based is that OOPC developers can use either Symantec's
THINK C 5.0.x programming system or Apple's MPW 3.2. Developing for OOPC
therefore requires minimal development resources (standard THINK C or MPW
partition sizes). This may make OOPC the only object-oriented development
environment other than TCL to run on a System 7 configured Macintosh with only 4MB
of RAM. Scary thought.
Out of the box, OOPC is better suited for THINK C development than for MPW C. It ships
with all the OOPC source code in THINK C file formats and the code resources as well as
the Demo Draw and starter applications have THINK C projects. Electron Mining
claims that OOPC code is fully MPW C compatible, but unfortunately, there is no MPW
make file. MPW C users will need to create their own make files until one is provided
(Electron Mining is working on one at this time).
the sum of the parts
Dynamic Everything
Everything in OOPC is determined and bound at run time. This makes OOPC applications
open slightly slower than normal applications, but the internals are more flexible