[net.micro.mac] What are Object Pascal and MacApp?

dtt@unirot.UUCP (David Temkin) (08/05/86)

[sorry if this message is preceeded or followed by an old message of
mine; the posting software here has problems and sometimes does that]

Eric Ivancich @ University of Utah CS Dept. writes:

> I just received an announcement from TML Systems for their (his) v2.0
> upgrade.  The enhancements Mr. Leonard lists include:
>     o Object Pascal as defined by Apple Computer (what exactly is this?)

Object Pascal is an extension of Pascal jointly designed by Niklaus Wirth
(the original designer of Pascal and Modula 2) and prgrammers at Apple.
The new language supports a new type, the "object", which is like a
record except that it may contain procedures and functions, as well
as data (integers, str255s, arrays, records) and other objects. Each
object is defined to have a "parent" object -- that is, another
object whose procedures and functions (collectively known as
"methods") are considered to be "inherited" by the object. There is
then a hierarchy of objects, where each object is described by its
differences from those "above" it. Objects can redefine inherited
variables and methods as well as define new ones.

MacApp is a library of objects meant to be used from Object Pascal
when writing a Macintosh application. It eases the implementation of
the Macintosh User Interface by providing the "generic" features of a
Mac application and letting you build on these. For example, DAs,
window updating, printing, and event processing can be handled in
your application with no coding needed. You build on top of this
base, defining new objects for the application-specific code.
You can also redefine provided routines to alter the standard
objects' behavior.

If this is all very confusing to you, you're not alone.  I don't
quite understand all of it, and what I do understand isn't exactly
clear in my mind.  I just started reading a book called "Object
Oriented Programming for the Macintosh" (Hayden Books) which
concentrates on Object Pascal and MacApp.  From what I've read, it
seems that this stuff is really useful, and the author claims that
this will be the way to go for Mac development, cutting development
and debugging time substantially.  It seems that Object Pascal will
be the standard Pascal in Apple's Macintosh development system (it's
fully upward compatible with Lisa Pascal as presented in Inside Mac).
The problem with using MacApp/Object Pascal is that involves working
out a new strategy for problem solving on the computer. The old
way of looking at a project (as a hierarchy of routines) differs
radically from the programming model required by object-oriented programming.

Hopefully, someone who is beta-testing this stuff can post a message
regarding its usefulness so we can all get past the hype and
buzzwords surrounding object-oriented programming.

lsr@apple.UUCP (Larry Rosenstein) (08/07/86)

If people are interested in finding out about Object Pascal & MacApp, I would
suggest that they first look at the August BYTE Magazine, which has several
articles on object-oriented programming in general, and MacApp in particular.

There is also the book "Object-Oriented Programming for the Macintosh" by
Kurt Schmucker.  This goes into more detail about the concepts behind
object-oriented programming, Object Pascal, and MacApp.  It also talks a bit
about other object-oriented languages on the Macintosh.

Here is a brief description of Object Pascal and MacApp.

Both Object Pascal and MacApp are descended from work we did for the Lisa
O/S.  Object Pascal is based on Clascal and MacApp on the Lisa Toolkit.
(Niklaus Wirth did consult for us on the design of Object Pascal.)  MacApp
and Object Pascal are relatively independent of one another.  Object Pascal
can be used without MacApp, and MacApp could have been written in any
object-oriented language.

MacApp is nothing more than a library of code.  It is not just a set of
procedures and functions (as is the Toolbox or the Pascal Extender product).
Taken by itself, it forms a complete Macintosh application that has multiple,
resizable windows, can print, save, revert, etc.  In that sense it is similar
to SKEL.

Unlike SKEL, you do not modify the MacApp source code to customize it for
your needs.  (Although MacApp comes with full source code.)  Instead you use
object-oriented programming.  For example, the contents of a window is drawn
by calling the Draw method of a particular View object.  The generic MacApp
View object has an empty Draw method, but you can make a subtype of View and
override its Draw method.  When MacApp needs to refresh the window (or print
the document) it will call upon your specific Draw method to do so.

MacApp implements the basic control structure of your program (which is the
same in every application and tedious to write), and calls your specific
methods as needed.  MacApp does a lot of things for you automatically, such
as:
	window resizing, moving, and zooming
	scrolling (manual and automatic)
	printing	
	safely saving documents (i.e., saving to a copy where possible)
	error handing and reporting
	displaying the watch cursor
	handling desk accessories
MacApp also includes about 75K of debugging tools.

People have been using MacApp for over a year and a half now, both inside and
outside of Apple.  (Some MacApp users are on the net, so perhaps they will
give their own comments about it.)  We know of 3 projects that have reached
"beta-test" stage: a boat navigation program (described by Larry Tesler in
BYTE), a system for teaching introductory programming (MacGnome from CMU),
and a program to manage recording studios.  (There are other people using
MacApp intensively, but we haven't seen demos of what they are doing.)

There is some space overhead in using MacApp compared to writing your program
in a conventional way.  This is due to the fact that MacApp is designed to be
very flexible and includes a lot of features.  The space overhead for methods
is only 1-5K for method tables.  Method calls take the same space as regular
procedure calls.

The performance overhead for using MacApp is also very small.  First, you are
not required to write the low-level parts of your application using objects.
Object Pascal is compiled into native code.  You can use assembler if you
choose.  (We also have assembler macros for doing object-oriented
programming.)

Second, we have implemented a method call optimizer that automagically
changes certain method calls into regular procedures calls that have no
performance overhead.  In MacApp, we estimate that 60-75% of the method calls
are optimized in this way.  (The optimizer also reduces the space for method
tables by about 5%.)

Right now, you need MPW in order to use MacApp, because you need to have
Object Pascal.  Once TML comes out with its version of Object Pascal, it
should be easy to port MacApp to that system.  (We are working with Tom
Leonard on this.)  We are also working on porting MacApp to a subset of C++,
but this will not be done for MacApp or MPW 1.0.  We are encouraging language
developers to add object-oriented extensions to their languages and port
MacApp to their environments.

If you have any additional questions, let me know.  Kurt Schmucker is giving a
talk about MacApp at the MacWorld Expo in Boston (Saturday, I think).  In
addition, many of the people who worked on MacApp will be there, as well as
some MacApp users.

-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET