|
|
Pieces of SK8
Introduction
SK8 is architected in six integrated levels:
- Object System: prototype based, message passing object
model
- Object Framework: a rich class framework for building
multimedia and tools
- Scripting Language: with complex data types and operations
on collections
- Graphics System: containment/renderer based with flexible
event handling
- Project Builder: direct manipulation user interface
- Projects: a comprehensive application framework
This is a rough sketch of the organization of the architecture. Below
it we will describe each of these components in more detail.
Figure 1. The SK8 Architecture
The Object System and Projects
The Object System is the foundation of SK8. It has been developed through
extensive user testing and development and is one of the most elegant parts
of the system. The important concepts regarding the Object System are:
- Everything in SK8 is an object. A character is a Character
object. An integer is an Integer object. A function or procedure i a Handlder
object. Projects are objects. Text, sounds, scripts, graphics, and QuickTime
movies are objects.
- SK8 is based on a prototype-instance model; any object
can be a template for creating a new object with the same set of properties
and handlers. SK8 supports multiple inheritance; any object can have any
number of parents.
- Every Object has a set of Handlers and Properties.
A Handler is a script that performs behavior on the object and is passed
as a message to the object. A property comprises a stylized pair of handlers,
a "getter" for getting the property's value
and a "setter" for setting its value, and usually
an internal slot holding the property's value. Getters and especially setters
foster a data-centric style of programming in which most of the functionality
is made accessible through the setters and getters of object properties
rather than through ordinary procedures (Handlers). For example, to play
a movie, you set a QuickTimeRenderer's 'state' property to the symbol 'playing'.
While the movie is playing, the getter of its 'timeValue' property returns
the updated value. After the movie has stopped playing, the getter of its
'state' property returns 'stopped'.
- SK8's object system is safe. It implements automatic object
disposal (garbage collection) and has no support for pointer arithmetic.
- The Object System is fully dynamic. An object can
dynamically modify itself in any way. It can add and remove properties.
It can add and remove handlers. It can even completely change who its parents
are, and hence the inheritance structure, dynamically.
Scripting
SK8Script is a fully object-oriented, dynamic programming language that
allows users to compose programs out of objects, handlers, functions, and
variables. The SK8Script programming environment includes trace, debugging,
and versioning capabilities. Users write code in either the SK8Script Handler
Editor or the multi-line SK8Script Message Box.
A few of the powerful features included in the SK8Script language, which
is AppleScript-like, are:
- Object-oriented scripting architecture with multiple inheritance
- Exception handling
- Ability to define macro-like "
on with " handlers,
for example
on with openfile fname in fvar
....
end with
SK8Script has rich syntactic support for Collection objects, whether
they be SK8-supplied or programmer-supplied. Beginning programmers as well
as experienced ones will appreciate the ability express in one line what
would require a multi-line loop in conventional languages. Here are some
examples:
- Path expressions to select item(s) in a collection
item 1 in my actors
- Insertion and deletion operations
insert button1 into my actors
- Selecting items with certain characteristics
every Oval whose fillColor = red
- Aggregate assignemnts
set {x, y} to my coordinates
- More complex aggregate assignments
set the fillColor of every Oval whose fillOolor = red to its frameColor
- Easy manipulation of the object system inheritance hierarchy and the
graphical containment hierarchy using collection syntax, for example
get every Actor whose fillColor = Blue in the ancestors of Button1
set Button1's container to the Stage
Graphics System
The SK8 Graphics System provides developers with a framework for defining
2-1/2 D object-oriented graphics. Actors (SK8 Graphical Objects) are composited
using the containment relation. The Stage, the sum of all your video monitor
space, is the top of the containment hierarchy. An actor is invisible unless
its container is set to the Stage. An actor contained by the Stage can be
thought of as a window. An actor within another actor is simply part of
the contents of that actor's window.
Containment is also used to clip actors and create a logical coordinate
system where the actor's contents "live", allowing for panning
and zooming of the contents. The location of actors can be referred to in
either logical coordinates (with respect to its container actor) or physical
(with respect to the Stage) coordinates.
An extensive set of core Actors is provided including geometrical actors
(polygons, ovals, rectangles, roundRects, lines), and interface actors (pickers,
textLists, radioButtons, checkBoxes, scrollers, simpleText, menubars, menus).
The graphics system uses a renderer-based model for drawing. All actors
are divided into three areas: the frame, the fill and the text areas. Each
of these is drawn by a renderer. Renderers are SK8 objects that know how
to "paint" an arbitrary area or mask. Some of the renderers available
in SK8 include: RGB Colors, translucent colors, gradients, translucent gradients,
image renderers (for picts, patterns, icons and bitmaps), movie and programmatic
renderers. The graphics system also supports visual effects.
The SK8 Imaging System allows SK8 users to use SK8Script to write their
own renderers, actors and even graphics systems.
Application Framework
SK8 provides a framework to facilitate the creation of applications. Apart
from the user interface components provided by the Graphics libraries, the
framework includes the following object-oriented facilities:
- Event system for non-user interface events, such as initialization
and reactivation of the application environment. This system unifies delegation
and inheritance-based programming using SK8Script
- Text and binary file input and output and directory query and control
using collection protocols
- Representation of foreign media and integration of it into the native
SK8 multimedia framework
- Representation, query of and control over the operating environment
at a higher level than the Macintosh Toolbox. This includes access to and
manipulation of device types (e.g., monitors)
- Ports, tags, proxies and other objects that simplify how an application
can be structured and which can be used for developing simulations and
sophisticated user interfaces
- Time, date, and other system services
Project Builder
The SK8 Project Builder is an application framework and direct manipulation
interface that allows users to create SK8 projects. The Project Builder
itself is an example of a project built in SK8 and all of its components
are reusable.
The goals of the Project Builder are:
- Support dynamic and iterative development
- Provide access and control over the whole of SK8
- Facilitate finding and manipulating all SK8 constructs
- Maximize the use of direct manipulation
- Speed up common activities
- Use programmer-accessible components to promote reuse in derivative
tools
To accomplish these goals the Project Builder provides a set of editors,
browsers, and graphical tools which provide a graphical way to facilitate
the construction of derivative tool interfaces. For example, there is a
tool palette which contains common browsing and editing components (e.g.,
fields for entering queries, property sheets, etc.). These components can
be graphically wired together and constrained to suit the user's needs.
These editors are described in great detail at our Project
Builder Editor Page.
|