TweetFollow Us on Twitter

March 92 - Introduction to PenPoint

Introduction to PenPoint

John Brugge

There's a new operating system in town, and it aims to change the way people think about computers as much as the Macintosh has.

When GO Corporation's PenPoint was announced last year, it received as much attention from the business community as it did from the software community. The mouse was being joined, if not challenged, by the pen as the device for the masses. Those who remembered the introduction of the Macintosh proclaimed a new revolution was about to begin.

Undoubtedly it has. With a handful of players, including Microsoft, jockeying for position as king of the pen-based world, pen-based computing is not being regarded as a fad, but rather as the next logical step in the evolution of computers-making them more personal, more familiar, and less visible.

For the programming community, pen-based applications present a fascinating new frontier to explore, and no environment is as interesting to explore that frontier within as PenPoint. For application designers, it provides a whole new set of ground rules to define "application." For programmers new to the object-oriented world, it provides a learning arena where you have to be object-oriented. For MacApp programmers, it provides some lessons on what the future of software development may hold.

Feet on the ground

While the entire field of pen-based computing is fascinating to many for reasons ranging from the sociological to the metaphysical, I'll try to stay closer to earth in this article. Even there, the most that I can hope to do in these few pages is introduce you to some ideas that will make you question ideas that seemed basic, and perhaps make you curious to explore more on your own.

A number of good articles in the trade publications have covered the idea of pen-based computing and the major players involved. See Byte, Feb. '91, MacUser, Feb. '92, or MacUser, Mar. '91 for starters. For those interested in learning more about the full scope of PenPoint, I recommend the book "The Power of PenPoint" by Robert Carr, the architect of PenPoint, and Dan Shafer (Addison-Wesley, ISBN 0-201-57763-1). It covers the high points of the operating system and the important classes involved in far fewer pages than the voluminous technical documentation that comes with the software developer's kit.

I will not be talking about Microsoft Windows for Pen Computing. Windows for Pens will no doubt be an economic force in the market, but Microsoft is a follower in this field, and the vision of mobile, pen-based computing will be lead by companies like GO.

With that said, I will set some minimal PenPoint background.

PenPoint Application Characteristics

While parallels can be drawn between PenPoint and other windowing interfaces, it's best to approach the concept of "application" with a clear mind. GO chose the notebook as its metaphor for the user's workspace, giving the user a much different set of expectations when interacting with the machine. Key to the metaphor of the notebook interface is the user's feeling that they are working with a collection of documents, and not with files and applications. In a notebook, to work on a document, you simply turn to its page and begin working with it. When you turn to a different page and then later turn back, the document is just as you left it. When you want to add another page, you insert one from the set of stationery (different styles of documents) that is available.

So the task of the application developer is to create a style of stationery-a business form, a piece of writing paper, a spreadsheet of cells, or perhaps a piece of drawing paper. Each piece of stationery that you insert in the notebook is a separate page-and indeed, is a separate instance of that application. As a consequence there are no "New", "Open" or "Save As" options on the menus-to look at another document (file), the user simply turns to its page in the notebook, or creates it from the set of stationery (applications) installed. Also gone are the user's ideas of explicitly "starting an application" or "quitting an application." These are unnecessary with a metaphor that says that everything is there whenever you want it-just turn the page!

While certain business forms in your notebook could be fairly complex, developers are encouraged to create small applications. PenPoint was designed to be scalable, meaning it should be as usable on small, hand-held machines as on large desktop or wallboard devices. This places a premium on memory and makes modular applications more attractive. PenPoint supports this notion implicitly by its object-oriented nature, which facilitates communication between applications. It supports it explicitly by making it a standard feature of documents that other documents may be "embedded," live, within them, creating compound documents. A graph in a text document need not be pasted or linked from another application-it can be an actual instance of a running program within the text document. Again, with the metaphor of documents in a notebook, this capability fits right in.

Objects in the Operating System

Maintaining this metaphor is partly the responsibility of the application writer, but it's mostly the responsibility of PenPoint. As the trade magazines have told you, PenPoint is a 90's kind of operating system: it has 32-bit addressing, a flat memory model, and preemptive multitasking. It supports people on the move with detachable networking (meaning you can connect and disconnect from a network whenever you want), the ability to embed applications within one another without limitation, a gestural control language (commands given with the pen, such as drawing an "X" over a word to delete it), and handwriting recognition (a fascinating technology in itself, but currently limited to printed characters, not script).

It's also object-oriented. While MacApp provides an object-oriented interface to the more traditional Mac OS, with PenPoint you can never "get underneath" the class system. The only exception is for the task and memory management services of the PenPoint kernel, offered via a procedural interface. In all other cases, if you want a service, you send a message.

Figuring out where to send the message, though, can be challenging. PenPoint has over 200 classes and thousands of messages. Taking proper advantage of its capabilities could easily overwhelm both user and developer. The knight in shining armor for both groups is the Application Framework-it provides consistency for the user and a head start for the developer.

penpoint's Application Framework

Apple was one of the first to discover the value of an object-oriented framework for easing the task of application development and ensuring consistency in applications. At the same time, they were tied to the Toolbox, a more conventional library of routines designed without objects in mind.

GO, on the other hand, had the luxury of designing their low-level routines at the same time they were defining the characteristics of PenPoint applications. By starting out this way, they have made it a requirement-not a suggestion-that all applications follow the protocols of the Application Framework. While this still leaves plenty of latitude for individual applications to flaunt their uniqueness, it ensures a level of consistency for the users as high or higher than what the Macintosh has achieved.

PenPoint's Application Framework does not have as broad a scope as MacApp. It is the collection of classes and messages that defines the protocol of a PenPoint application. Classes for elements like the user interface and file system are outside its scope and are part of PenPoint proper. MacApp, by this definition, falls somewhere between PenPoint and its Application Framework-it deals with issues besides application life cycle, but it isn't an entire operating system.

Like MacApp, the Application Framework provides relief to the developer presented with the daunting task of developing a well-behaved pen-based application; it is also a generic PenPoint application that gets you off the ground and running with a number of behaviors that come for free: on-line help, gesture recognition, standard application menus, printing support, document embedding support, and search and replace, to name a few. But just as it's not trivial to write a Macintosh application using MacApp, it's not trivial to create a PenPoint application within the Application Framework.

Important classes

Knowing where to start is as important to understanding class libraries as procedural libraries. PenPoint has a small number of classes that are essential to understand. The descriptions here should at least point you in the right direction when you start digging deeper.

Every object in the system descends from the clsObject [1] class and from a clsClass metaclass. Every class in the system is represented by a clsClass object that holds class variables and method definitions. The richness of PenPoint objects is reflected in the fact that clsObject defines over 50 messages. Fortunately for the rest of us, most are handled by clsObject.

Applications are classes, and every application is a subclass of clsApp. The messages for clsApp define how a running instance of the application (a document) behaves at the different points of its life cycle (explained below). Although documents are different things in the MacApp world, clsApp could be said to combine the responsibilities that TApplication and TDocument carry in MacApp. Since there can be any number of instances of an application class around at any time, there is also a metaclass, clsAppMgr, to handle the global issues. An instance of clsAppMgr represents an installed application and holds information common to all instances of the application (such as the application name, its icon, and its default size).

The user interface toolkit and windowing classes make up the largest subsystem of PenPoint. All the standard widgets are implemented (buttons, menus, scrolling windows, etc.), but in a different class hierarchy than MacApp. For instance, everything in the user interface toolkit descends from the window class, clsWin, which descends directly from clsObject. So your application window is typically a recursive structure of parent windows enclosing child windows. You arrange them on the screen at runtime by telling each parent window to lay itself out, with PenPoint handling the recursion for you.

Application life cycle

The life of a PenPoint application is quite different from that of an application in a traditional operating system. For one, there may be many instances of your application running at any one time (remember, each document is an application instance). Since the notebook metaphor also says that you can turn to any document in the notebook at any time, each document (application instance) must be running at all times, at some level of readiness. In the world of the Mac desktop, there is typically only one instance of each application running at any time, and the set of system-described states that it might be in is more limited. A MacApp application must respond to system messages to open itself (HandleFinderRequest), redraw itself (HandleUpdateEvent), and move between the foreground and the background (HandleActivateEvent). A PenPoint application must respond to these events as well, but must also live in some intermediate states.

The first state is instance creation, when a user creates a new instance of your application, such as by copying a piece of its stationery to the Notebook Contents. Your application class should create an instance of your application and let PenPoint know about it. From this point on, the application instance, and not the class, will receive most of the messages.

When the user turns to that instance's page in the notebook, PenPoint tells it to activate itself and open itself. Activation refers to creating a process in the operating system and either initializing the document data or restoring it from the file system. Opening refers to drawing the interface on the page. Note that a document can be active but not open; for instance, when doing background processing.

When the user turns away from the application's page to another page in the notebook, PenPoint tells it to close itself and then terminate itself. Closing usually involves saving any essential information about the document's state so that it can be reconstructed when the user turns back to that page, and then destroying the user-interface. Termination destroys the application process that was created at activation time. When the user turns back to that page, the application framework creates a new application instance with the stored information.

When the user deletes the document, usually by drawing an "X" over its name in the Notebook Contents page, PenPoint destroys that instance of the application. But the application class continues to exist, so that it can create other documents.

OOP in C

While PenPoint is fully object-oriented, it's not written in an object-oriented programming language. Instead, GO rolled their own object-oriented system in ANSI C when they realized that existing languages wouldn't easily support everything they wanted to do. PenPoint provides multiple inheritance, asynchronous message passing, inter-task message passing, and versioning support, features absent from or difficult to use in a language like C++.

The PenPoint object system is defined by the subsystem called the Class Manager. The Class Manager consists of the clsObject and clsClass definitions and the functions that implement message passing. You send a message by calling ObjectCall(), ObjectSend(), or ObjectPost(). ObjectCall() is for messages to other objects in your task, and is used most often. ObjectSend() and ObjectPost() are for messages to objects outside your task, sent either synchronously or asynchronously.

PenPoint keeps track of classes, objects, and messages by 32-bit unique identifiers, also known as UIDs. GO administers these to ensure uniqueness of the classes and objects that make up your application. You assign them in your code through #defines and macros.

While the language choice means that C programmers don't need to learn a new language syntax, they do need to learn a new set of programming conventions. Code written in PenPoint style is distinct from, and usually more verbose than, ordinary C or C++ code. But what isn't? Here's a MacApp class definition in C++ that describes class TFoo, a descendent of class TBar:

//---- Foo.h ----
typedef struct aStruct {
    int aField;
    int anotherField;
};

class TFoo : public TBar {
    private:
        short fSomeData;
    public:
        void SomeMethod(aStruct *anArg);
};

The equivalent PenPoint class definition might look like:

//---- Foo.h ----
// clsFoo is a subclass of clsBar
// (the actual inheritance is defined in the implementation
// file, and isn't set until a call to clsClass at runtime)

// The MakeWKN macro builds a well-known (global) UID
#define clsFoo      MakeWKN(2143, 1, wknGlobal)

// Objects themselves are all of type OBJECT
typedef OBJECT FOO, FAR *P_FOO;

// -- Message descriptions for clsFoo --
// (the methods they invoke are defined in a separate file)
/*****************************************************
 msgSomeMessage: takes a P_ASTRUCT, returns STATUS
*/
// (MakeMsg creates a unique ID similar to what MakeWKN 
// creates for classes)
#define msgSomeMessage  MakeMsg(clsFoo, 1) 

typedef struct ASTRUCT {
// PenPoint code avoids types like int or char which are
// compiler-specific, and instead makes sizes more
// visible, such as "U16" for "unsigned 16-bit". 
    U16 aField;
    U16 anotherField;
} ASTRUCT, FAR *P_ASTRUCT; 

For object-oriented purists, one of the attractions of PenPoint's classes is that they clearly separate the idea of message and method. The interface available to a class' clients is the set of messages it accepts; the methods that implement them are hidden in the class' implementation code. Also hidden from view are any private data members of the class.

Since both operating system and applications are object-oriented, the large majority of one's source code is message passing. As mentioned above, the syntax of message passing is that of a function call. All messages accept a 32-bit argument, which can either be a single value, or a pointer to a larger structure. For example, the following C++ messaging line:

   Foo         *foo;
    aStruct     anArg;
    foo->SomeMethod(&anArg);

would look like this in PenPoint:

  FOO         *foo;
    ASTRUCT     anArg;
    STATUS      s;
    if ((s = ObjectCall(msgSomeMessage, foo, &anArg)) 
                    != stsOK)
        return s;

Note that ObjectCall() always returns a status value. While you should always check the status of a message send, PenPoint provides macros that handle standard situations. For example, the above line would usually be written as:

ObjCallRet(msgSomeMessage, foo, &anArg, s);

Development Tools-or lack THEREof

With the rich development environments available on the Macintosh today, it's only the grizzled veterans who remember doing development on the Lisa using MacsBug. I'm guessing that few would want to return to those days. Perhaps the early PenPoint developers will have the same fortunes in the future, but today it's mostly the realm of Real Programmers.

Application development for PenPoint is done on a DOS-based machine with a VGA monitor, using an ANSI C compiler and the editor of your choice. You can run your application in a simulated PenPoint environment on the PC, using a mouse or a Wacom pen and tablet to simulate the real pen. While you can download your application to the pen-based machine at any time, the turnaround time is much faster when running the environment on the PC. A symbolic debugger from GO is provided with the SDK, and a second (monochrome) monitor is suggested to allow you to view debugging information while your application runs. The debugger knows about PenPoint objects, but it is based upon Microsoft's CodeView command-line debugger. The difficulty of mastering it leads most application developers to liberally sprinkle "printfs" throughout their code.

The landscape is not nearly as bleak as it was in 1984 for the Macintosh, since there is already an application builder for forms applications from Slate Corporation, a third-party developer of pen-based applications. The tool, called PenApps, is itself a pen-based application, and lets you use the pen to layout your form right on the pen-based computer. Given the experience people now have with development tools for graphical environments, it shouldn't take as long for these to appear for PenPoint.

A point about hardware...

One minor point remains to allow PenPoint to display its true spirit of a new computing age, and that is equally compelling hardware on which to run it. So far, manufacturers such as NCR, GRiD, and Samsung have paraded out wares that are being grudgingly accepted by customers, but this seems to be one area where software is ahead of the hardware: all of the machines suffer from short battery life, poor screen readability, or are overweight. It may be a couple of years before pen-based hardware is as well suited for its use as desktops and laptops have become.

Onward

This article won't let you start building your killer pen-based application tomorrow, but it should give you an inkling of what is involved. A background in MacApp gives you a head start in understanding the mechanics of what GO's PenPoint is all about, as well as an appreciation for the power of a completely object-oriented operating system. PenPoint introduces a whole new idea of "application," though, which offers exciting challenges to those who are beginning to think that all the interesting applications for the Mac have already been written. Coupled with the pen as a new input mechanism, and a platform that is meant to be used on the go, the applications that could change the way we work with computers are just waiting to be written.
 
AAPL
$100.61
Apple Inc.
+0.04
MSFT
$45.15
Microsoft Corpora
+0.20
GOOG
$581.84
Google Inc.
-2.66

MacTech Search:
Community Search:

Software Updates via MacUpdate

MacFamilyTree 7.2.4 - Create and explore...
MacFamilyTree gives genealogy a facelift: it's modern, interactive, incredibly fast, and easy to use. We're convinced that generations of chroniclers would have loved to trade in their genealogy... Read more
Videobox 4.1.1 - Download Flash video th...
Videobox allows you to quickly and easily download Flash video from most all of the popular video sites on the internet. Videobox will convert the video into a native Quicktime format so it's ready... Read more
Web Snapper 3.3.5 - Capture entire Web p...
Web Snapper lets you capture Web pages exactly as they appear in your browser. You can send them to a file as images or vector-based, multi-page PDFs. It captures the whole Web page - eliminating... Read more
Picasa 3.9.138 - Organize, edit, and sha...
Picasa and Picasa Web Albums allows you to organize, edit, and upload your photos to the Web from your computer in quick, simple steps. Arrange your photos into folders and albums and erase their... Read more
Tidy Up 3.0.15.0 - Find duplicate files...
Tidy Up is a complete duplicate finder and disk-tidiness utility. With Tidy Up you can search for duplicate files and packages by the owner application, content, type, creator, extension, time... Read more
Parallels Desktop 10.0 - Run Windows app...
Parallels Desktop is simply the world's bestselling, top-rated, and most trusted solution for running Windows applications on your Mac. With Parallels Desktop for Mac, you can seamlessly run both... Read more
Apple Final Cut Pro X 10.1.3 - Professio...
Apple Final Cut Pro X is a professional video editing solution.Completely redesigned from the ground up, Final Cut Pro adds extraordinary speed, quality, and flexibility to every part of the post-... Read more
Apple Compressor 4.1.3 - Adds power and...
Compressor adds power and flexibility to Final Cut Pro X export. Customize output settings, work faster with distributed encoding, and tap into a comprehensive set of delivery features. Powerful... Read more
Chromium 36.0.1985.143 - Fast and stable...
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. FreeSMUG-Free OpenSource Mac User Group build is... Read more
Macgo Blu-ray Player 2.10.6.1691 - Blu-r...
Macgo Mac Blu-ray Player can bring you the most unforgettable Blu-ray experience on your Mac. Overview Macgo Mac Blu-ray Player can satisfy just about every need you could possibly have in a Blu-ray... Read more

Latest Forum Discussions

See All

Spacetime Studios’ Greg Mueller Tells Al...
| Read more »
Outcast Odyssey – An Interview with the...
At this year’s San Diego Comic-Con, fans got the chance to meet and mingle with several of the artists behind Magic Pixel Games and Namco Bandai’s upcoming card battler, Outcast Odyssey. Considering many of these artists have worked on comics in the... | Read more »
BoxPop Review
BoxPop Review By Jennifer Allen on August 21st, 2014 Our Rating: :: UNTAXING PUZZLESUniversal App - Designed for iPhone and iPad Move from tile to tile to clear the board in this slightly too simple and easy puzzle game.   | Read more »
Breakdown Buddy Review
Breakdown Buddy Review By Jennifer Allen on August 21st, 2014 Our Rating: :: FLAWED CONCEPTiPhone App - Designed for the iPhone, compatible with the iPad There’s a good idea here, but Breakdown Buddy isn’t as useful as it tries to... | Read more »
jamstik, the Guitar You Can Take Everywh...
jamstik, the Guitar You Can Take Everywhere, is Now Available for Purchase Posted by Jessica Fisher on August 21st, 2014 [ permalink ] Zivix has announced that their guitar-in-your-pocket, | Read more »
Star Walk 2 - Guide to the Sky Day and N...
Star Walk 2 - Guide to the Sky Day and Night 1.0.0 Device: iOS Universal Category: Education Price: $2.99, Version: 1.0.0 (iTunes) Description: The next generation of the best-selling Star Walk, winner of Apple Design Award, used by... | Read more »
Forks Over Knives Review
Forks Over Knives Review By Jennifer Allen on August 21st, 2014 Our Rating: :: TASTY AND HEALTHYUniversal App - Designed for iPhone and iPad Want some tasty new recipe ideas but want to keep it healthy? Forks Over Knives is the... | Read more »
Invaders! From Outer Space (Games)
Invaders! From Outer Space 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: | Read more »
Dementia: Book of the Dead (Games)
Dementia: Book of the Dead 1.00 Device: iOS Universal Category: Games Price: $2.99, Version: 1.00 (iTunes) Description: EXCLUSIVE CONTENT ONLY ON THE APP STORE. Medieval England. Times of knights, witches and hunters. What other... | Read more »
Wan Nyan Slash (Games)
Wan Nyan Slash 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Wan Nyan Slash is an infinite adorable demon slaying slashing action game! Play as the wandering samurai Wan and Nyan as they... | Read more »

Price Scanner via MacPrices.net

21-inch iMacs on sale for up to $150 off MSRP
B&H Photo has 21″ iMacs on sale for up to $150 off MSRP including free shipping plus NY sales tax only. B&H will also include a free copy of Parallels Desktop software: - 21″ 2.7GHz iMac: $... Read more
27-inch 3.2GHz iMac on sale for $1698, save $...
Abt has the 27″ 3.2GHz iMac on sale for $1698 including free shipping. Their price is $101 off MSRP. Read more
Mac Backup Guru 2.0 Drive Backup/Cloneing Uti...
Mac Backup Guru developer MacDaddy has released Mac Backup Guru 2.0, offering new and enhanced advanced features, such as bootable backups, synchronised volumes and folders, and a Snapshot mode that... Read more
Operate GE’s New Free-Standing KItchen Range...
Think you accidentally left the oven on? Switch it off while on the go. The new free-standing Profile™ Series gas and electric ranges are GE’s second cooking appliances, following their wall oven, to... Read more
Parallels Announces Parallels Desktop 10 for...
The no. 1-selling software for running Windows applications on a Mac becomes an even easier choice for millions of consumers and IT professionals worldwide with the launch of the most powerful... Read more
Apple now offering certified refurbished 2014...
 The Apple Store is now offering Apple Certified Refurbished 2014 MacBook Airs for up to $180 off the cost of new models. An Apple one-year warranty is included with each MacBook, and shipping is... Read more
Best Buy’s College Student Deals: $100 off Ma...
Take an additional $100 off all MacBooks and iMacs, $50 off iPad Airs and iPad minis, at Best Buy Online with their College Students Deals Savings, valid through September 6th. Anyone with a valid .... Read more
MacBook Airs on sale for $100 off MSRP, free...
B&H Photo has three 2014 MacBook Airs on sale for $100 off MSRP. Shipping is free, and B&H charges NY sales tax only. They also include free copies of Parallels Desktop and LoJack for Laptops... Read more
Razer Taipan Mouse For Gamers And Non-Gamers...
If you’re a serious gamer on either Mac or Windows PCs, a serious gaming mouse is a necessity for first-tier performance. However, even if like me you’re not much of a gamer, there’s still a strong... Read more
15-inch 2.2GHz MacBook Pro on sale for $1899,...
Adorama has the new 15″ 2.2GHz Retina MacBook Pro on sale for $1899 including free shipping plus NY & NJ sales tax only. Their price is $100 off MSRP, and it’s the lowest price available for this... Read more

Jobs Board

Position Opening at *Apple* - Apple (United...
**Job Summary** As more and more people discover Apple , they visit our stores seeking ways to incorporate our products into their lives. It's your job, as a Store Read more
Position Opening at *Apple* - Apple (United...
…Summary** As a Specialist, you help create the energy and excitement around Apple products, providing the right solutions and getting products into customers' hands. You Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Solutions Consultant (ASC)- Retail S...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.