Object Master
Volume Number: 10
Issue Number: 12
Column Tag: Tools Of The Trade
Object Master 2.5 Universal
A slightly dazzled review
By Andy Dent, A.D. Software, Ballajura, Western Australia
About the Author
Andy Dent - Andy comes to us from the ranks of the former Software
Frameworks Association (SFA), and has enjoyed using Object Master to help himself
master new big chunks of object oriented code, like PowerPlant. You can reach Andy on
the Internet: dent@iinet.com.au, or on CompuServe: 100033,3241, A.D. Software
I tend to develop a love-hate relationship with ACI products, and Object Master is
no exception. Maybe it’s a French culture clash with my British origin. Object Master
has a few petty flaws that annoyed me to the “up all night to teach this sucker a lesson”
level. Redeeming itself, Object Master is also full of features that elicited ooh’s and
aah’s when I demonstrated it to a friend. I spent 10 minutes with the OM demo on the
CodeWarrior CD and was hooked. I hope I can show you why.
Perspective
Immediate apologies to MPW mavens and MacApp-ites. I’m neither and so I can’t
fully evaluate those features of Object Master. What I’d like to do is show anyone just
how much time Object Master can save you in learning class libraries and developing
within complex frameworks. I haven’t been this excited about an OOP tool since I first
saw the SmallTalk/V object browser. That may be because I’m trying to learn two
different frameworks (zApp and PowerPlant) at the same time, neither of which comes
with an object browser.
Note: in the rest of the article I’ll follow the Object Master convention of using
the words method (C++ member function) and field (C++ data member). This
terminology seems to be also used by most OOF (OO Folks) when discussing
language-independent issues. In the interests of brevity, I’ll also use the abbreviation
OM for Object Master.
Reasons to rush out and buy Object Master
OM is a tool to let you browse and manage both OOP and non-OOP code written in
C, C++, Pascal and Modula-2. OM drives your compilers and linkers directly,
removing the need to use the compiler IDE. It will save you a massive amount of time
managing code in a complex framework, and e specially learning a new framework:
• The SmallTalk-like Browser lets you edit classes and methods in a very
point-and-click environment, focusing on just what you’re changing.
• The tree browser lets you display both methods and fields for any or all classes.
• The tree browser can be truncated to show you just a part of the tree, and you can
turn off the Multiple Inheritance lines (useful for the PowerPlant forest).
• You can have a number of different tree and class browsers visible at once,
showing you portions of the classes in varying detail.
• Subclass definitions can be generated with all the methods automatically
generated for you to fill in, and override.
• C++ users can view classes from the viewpoint of different access methods. (eg:
what fields do you see as a Friend class?)
• The editor provides syntax highlighting, including choice of style and color.
• An MS-Word style of line selection with a “backwards arrow” at the start of the
line lets you avoid tendonitis-inducing triple-clicks.
• Think Reference is fully integrated to lookup definitions.
• MPW 411 files can be generated so you can keep your documentation in parallel
with your source. (For the ignorant, whose ranks I recently departed, 411 files
are indexed text files used for documentation, like an MPW Think Reference.)
• Function calls can be automatically completed, and the case corrected, from your
own declarations, Think Reference or MPW 411 documents.
• SourceServer and Projector are fully supported, plus arbitrary read-locking of
files.
• If you produce .SYM files (MPW and CodeWarrior) you can browse disassembled
code in parallel with your source.
• Remote compilation is supported via ARA, using MPW ToolServer. (I know one
user who swears by this, for working from home.)
• Resources compiled into a project can be browsed and ResEdit launched with
direct selection of the resource.
• You can script in either MPW or AppleScript.
• Macro facilities provide a “fill-in-the-blanks” method for tabbing through
complex declarations and common idioms. If you are heavily into patterns and
idioms, this could be a great time-saver (or help those laboring under corporate
style-guides).
Getting Started and the Project Environment
Where’s the “I’m Stuck!” Documentation?
I’ve seen a couple of people very strongly criticize OM in the MacDev forum on
CompuServe. After running into problems with my initial PowerPlant parsing, I can
understand why. The Reference Manual is generally very good, but it lacks a companion
Getting Started piece. I spent a few painful hours deducing the following simple facts:
• CodeWarrior integration is not complete (who’s at fault?)
• If you get syntax errors at the end of a file, it’s almost certainly some weird
compiler-specific construct earlier in the file and you can probably fix it by
defining a Null or Identity Macro.
• The AppleScript menu at the end of the menu bar isn’t documented because it’s
added by the scripts in the Startup Folder.
• If a Think Pascal tree is flat and you can’t see fields or class definitions, you have
an interface file which is saved as a Think document, not as text.
Project Management
The OM environment is project-based. You can create a project directly from
existing compiler projects, from defaults supplied with OM, from your own
stationery, or from scratch. A project includes settings such as the macro definitions
used to parse C++ files, and style settings for the various editing windows.
I’d like to put in a cheer for one of my favorite prejudices here - ACI has made
good use of Balloon Help to assist in learning the complex menu structure and the
occasional iconic buttons. Balloons are also used to describe the short-cut clicks that
can be used in various scrolling list panes.
As you work in the different Project windows, you will often make use of
secondary menu bars within the windows. This is an optional violation of the Apple
Human Interface Guidelines. There is a Preferences setting to place these menus at the
end of the main menu, but you would need a two-page monitor to see them! I found the
secondary menus usable, although a little slower than a quick mouse to the top of the
screen. In contrast to MS Windows packages I’ve used, the secondary menus are more
comprehensible and hence faster than some vast array of iconic buttons.
Think Pascal Project Support
Creating a project direct from a Think Pascal project is very straightforward,
but it may not work! The manual neglects to inform you that OM doesn’t understand the
Think document format. This is compounded by OM’s failure to warn you that it has not
been able to find the expected text file. OM deduces the class names from the
implementation files, but you need to save a copy of TCL.p as text before you can see a
proper class tree hierarchy, or any class definitions. Assuming your Pascal project
has been built, the resources will be visible in OM, through a Resource Map window.
Think C Project Support
The addition of external support in Symantec C++ for Mac v6 allowed OM to
directly drive the Think compilers in building projects. Loading from a project seems
to work but neglects to load the resource file - you have to add that manually with the
Add Files dialog. I loaded the complete TCL 1.1.3 tree and a sample
Marksman-generated TCL application with no complaints. If you are only using the
Think C+Objects compiler, you can set this preference in OM to speed the parsing
process.
Figure 1. Project Status window
after loading the Marksman TCL project.
The Class Browser
If you’ve used a Smalltalk browser such as SmallTalk/V, or the 4D Insider tool,
then the Browser window is familiar. The three scrolling lists across the top (or down
the left-hand side) list the Classes, Methods of the current Class, and Fields of the
Current class. The editing area contains either a single Method or Class definition.
OM allows you to have a number of Browser windows open at once, showing
different aspects of the class hierarchy and with different settings (such as showing
inherited Methods or Fields). The Browser is the first window in which you’ll
encounter OM’s secondary menu bars.
C++ template classes are shown with a trailing † symbol on the class and method
names. Multiply-inherited classes are shown with a trailing ° symbol on the class
name. Global functions and structures are ga thered into pseudo-classes and prefixed
with a • symbol. (This is how you can use OM to browse a completely non-oop
program.)
Figure 2. Object Browser with Show Inherited Methods
and the parent implementation CObject::Copy selected.
Editing bit-by-bit
One major benefit of using a Class Browser is focusing on the class definition or
method implementation that you are writing. The OM Browser lets you very quickly
navigate to the method or a parent class’s implementation (using the Show Inherited
Methods option). Figure 2 shows how I’ve been able to go directly to the Copy method
implemented by a parent class, looking at CArray’s methods. The “middle” pane that
stretches across the center of the browser is a context feedback. When you click on a
method name it shows the full signature. When you click on a class you see the
inheritance path, including multiple parents (the pane is resizable). Notice the
highlighting around the methods list - the panes of the browser are all
keyboard-navigable, using command-Tab to switch panes.
If you are jumping between several methods, and lack the screen space for
multiple browser windows, you can use a popup menu, on the bottom of the browser
window, to recall any of the last ten methods edited.
Figure 3. New Class Dialog.
Creating Classes with point-and-click
I’ve always hated the messy business of defining classes that are
almost-but-not-entirely-like another class, maybe overriding a couple of parent
methods and adding a field or two. The New Class command in the Browser Filing menu
simplifies this task enormously. You can either define a straight subclass of the
current class, or a “sister” class. For a sister class, the Same as Sister button quickly
marks all the methods you need to override to be just like the sister class. You can then
mark a few more Methods, or un-mark some to leave them to the parent
implementation. The choice of filing is flexible and makes it easy to accumulate a
number of small classes in the one file.
Following Relationships
When you are trying to learn a class framework, as opposed to adding to it, you
can spend an inordinate amount of time yo-yoing up and down the class hierarchy,
wondering who implements a method, who calls it and how many classes further down
the hierarchy override the method.
The Methods menu has an option to display the inherited methods of the current
class. You can also create list windoids of classes that:
• implement the current method (same name, possibly unrelated);
• override the current method;
• call the current method (a text search that includes comments).
Understanding C++ Access Control
In moving from Object Pascal to Think C+Objects to C++, I’ve often been
confused over when and how to use Friend classes (and, to a lesser extent, the other
access control levels). The OM Browser allows you change the methods and fields
displayed to simulate what would be available from a different Access Level. Normally,
when editing, you can see everything (as an Implementor) but you can change this to
restrict the list to those available to a Friend or a Client class (only the public
methods and fields.)
As a short-cut, when you are editing a method (X), you can click on a different
class name and choose the Class Access option See Class from Open Method. OM uses its
knowledge of the relationship between the classes to display only the fields and methods
visible to method X. This can be a great help at those times when you are getting
compiler errors related to class access, but can’t quite understand why.