This is a review of Joy 1. It was published in the German language magazine NEXTTOYOU in January 1998. The German original is accessible at http://www.nexttoyou.de/artikel/1998/1/Joy.htmld/. We present the translation here. AAA+ Software, located in Vienna, Austria, offers an interesting software development tool for OPENSTEP/Rhapsody developers: Joy. We had the opportunity to enjoy it. InstallationThe installation was problem-free. After downloading and extracting the proper package--OPENSTEP/Mach, Rhapsody, and Yellow Box for Windows are supported--we ended up with an installer package which required root permission. After installation, everything was placed in /LocalLibrary/Joy. Besides comprehensive and clear documentation, available in both .rtfd and .html files, and several examples, you will find the core component of Joy--an InterfaceBuilder palette. Double-clicking on it loads it into InterfaceBuilder. After this you are ready to go! TickleThe Joy palette contains a single new InterfaceBuilder object, a Tcl-Interpreter. The new menu item, New Joy Application, provided by the Joy palette, makes it easy to create a new Joy application. By default, a new window object is created which can be connected with the Joy interpreter and assigned to a variable in the interpreter. Next, we selected InterfaceBuilder's test mode, opened the Joy command window and began experimenting. Reproducing the examples from the tutorial is easy. Windows can be miniaturized, reopened and given a new title. Great! Objective-Tcl?For the Objective-C developer the Tcl-like syntax might look a bit unfamiliar. Well-known elements like square brackets are part of the language, but have new semantics. Additionally, the colon of method-identifiers must be followed up by a space, in contrast to Objective-C. The error message you get when forget the space is not very helpful. The powerful line-oriented editor, which handles multi-line commands easily, makes up for this shortage. Experienced users, however, may be annoyed by the unusual behavior of the Return key: instead of the command being executed, a linebreak is inserted unless the cursor is at the end of the command. Fortunately, one learns, and also the editor is capable of Emacs key-bindings. [See comment 1 and comment 2.] Explore or explode?Those new to OPENSTEP/Rhapsody development can easily experiment with FoundationKit and AppKit classes using Joy. They can immediately get the results of method calls. No more compiling, linking, relaunching, crashing, error checking. But Joy Explorer offers even more! The dimple of the explorer window can be dragged down to reveal a browser and several controls. This allows you to inspect virtually everything that's going on inside a running application. Classes, objects, variables, methods, even protocols! Those who remember the AppInspector from the old NEXTSTEP days will be pleased--but Explorer is even better! The objects displayed in the browser can be manipulated directly by entering commands in the command window. Double clicking on an object in the browser makes an expression corresponding to the object appear in the command panel, and the same is true with method names.
Joining a Joy interpreter to an application's nib file makes that application accessible. Therefore it takes almost no effort to control any application with a script, or remotely. DeveloperExperimenting with running applications only makes sense to a degree; however, experimenting with an object's API, inspecting and testing the internal state of an application, on-the fly debugging: these make a lot of sense. Destructive individuals could perhaps make InterfaceBuilder crash; however excellent exception handling protects it to a large extent. Calling non-existent method selectors results in an alert panel. Accepting the alert panel lets you continue without any further problems. Using Tcl for a few simple commands, however, is far short of its real capabilities. Developing serious applications is Joy's main purpose. Each Joy interpreter can have its own script which is run on its startup. In this script one can create new classes, existing and new classes can be extended by new methods, and last but not least all other Tcl commands can be executed. Looking at the list of instructions makes me wonder about the range of things you can do with the Objective-C runtime!
Unfortunately, developing applications with Joy has a few disadvantages, which can be seen as differences between the runtime behavior of InterfaceBuilder and Joy. InterfaceBuilder has to know the outlets (instance variables) and actions (methods) in order to create the connection between objects. These can be entered in InterfaceBuilder by hand--afterwards the connections can be created. So far so good. Using InterfaceBuilder's test mode makes it create the objects of the .nib file, and afterwards run the Tcl script. However, the classes declared in InterfaceBuilder's class window have not been created at this point. Joy solves this problem by not using a controller object; the user-interface objects are taught directly to respond to the user. This procedure is not congruent with traditional Objective-C development process; hence, it might be difficult to map a Joy application to pure Objective-C.... But who ever wants to do that? [See comment 3.] New dimensions in object-orientationJoy enables you not only to perform commands at runtime on traditional Objective-C applications. Joy's capabilities go far beyond this and fully integrate the flexibility of the runtime environment. You can, for example, teach new methods--called skills--to a single instance. The class will not be changed by the teaching of a skill to an instance, however; a kind of pseudo-subclass is created which contains the new methods. The keyword super invokes methods of the direct superclass (the same as Objective-C), the keyword former gives access to class/instance methods that have been overridden, and objc makes the runtime ignore skills written in Tcl. These commands make scripts very flexible. With these powerful features in mind, it came as no great surprise to me that you could delete--unteach--methods, and overwrite existing ones at runtime. Self-containedJoy Developer lets you create standalone applications out of the applications developed in InterfaceBuilder. You simply select the corresponding menu item. The resulting programs look like applications, can be launched by a double-click, and are compact in terms of storage space. Just the itkTcl and joyRuntime frameworks must be installed (which take up only 3.6 MBytes of hard disk space). Integration with Objective-COf course, existing projects can be extended by Joy. Examples how to call Joy skills from within Objective-C and call of C-functions from within Joy are included in the Joy package. BenchmarkI wanted to complete the review by testing the performance of Tcl with respect to Objective-C. I created an empty method, and a for loop which called it, in both languages. While Joy took 40 microseconds to execute the loop, Objective-C took only 0.4. In comparison, calling a C function, instead of a method, took only 0.12 microseconds to execute the loop (Benchmarks were carried out on a Toshiba Tecra Notebook with a Pentium MMX 150 CPU). Now don't tell me Objective-C is slow! [See comment 4.] GoodiesIn addition to the application inspector, the Joy package contains a few other useful goodies. You can inspect the Objective-C runtime graphically, either by using the graphical application inspector, or textually, via the Joy command window. You can even use glob-style patterns to filter the results! The integrated online help is comprehensive and hierarchically structured. The help command presents you with any topic concerning Tcl and Joy. Unfortunately, the information the help command provides is textual only (accessible via the keyboard); this cries out for a GUI interface. [See comment 5.] ConclusionWorking with Joy was a pleasure, but there remain a few points of criticism. For performance nothing more needs to be said, as it is sufficient for all user interactions. But, I would prefer using a compiled language for handling large amounts of data and complex structures. The help system could be prettier and the development of applications which use new Joy classes could be smoother. Besides these points, Joy is highly recommended to OPENSTEP and Rhapsody developers. Joy is like an afterburner for the already legendary capabilities of OPENSTEP to rapidly prototype. Our recommendation, is, therefore: Try it out!
1. Objective-C syntaxThe next version of the software, Joy 2.0, solves most of the language-related issues. (Current version is 2.1) It provides, in addition to Tcl, a scripting language based on JavaScript. As JavaScript has a more advanced parser, more choice has been available in creating new syntax, and making sure it has the semantics users expect. Joy syntax is now essentially a superset of both JavaScript and Objective-C. You can source Objective-C header files as Joy source code, and you can write source that will be interpreted by Joy and compiled by the Objective-C compiler. There is in addition preprocessor directives which are understood by both, to allow certain sections to be read by the interpreter and certain sections to be read by the compiler. This means that, for example, spaces are no longer necessary to demark the selector and arguments, as was the case in version 1 of Joy that was reviewed; and the square brackets have the meaning they have in Objective-C--invoking a method on an object. JavaScript is seen as the future direction Joy will take. 2. Any key can be remappedAny key can easily be remapped; if the user desires the return key to perform a different action, that's no problem. 3. The Joy Interpreter is the controller objectWhen the menu item "new Joy application" is chosen, a nib file is created that contains a single Joy interpreter. This interpreter acts as a generic controller object. Hence, Joy does not go against the traditional Objective-C development process; but in fact directly supports it. 4. Performance--not a relevant factorWe agree with the author in the conclusion "For performance nothing more needs to be said, as it is sufficient for all user interactions". It is true that Tcl is an order of magnitude slower than compiled code for things such as tight loops, but 95% of typical applications are not performance-critical anyway (menu actions etc.), so after creating a prototype with Joy you can go ahead and move the 5% to Objective-C (with Joy 2.0 and later you don't even have to modify the source code), and you have still saved yourself a tremendous amount of work. 5. Help files are now HTMLJoy version 1.08 is shipped with online-help in .html-format, and communicates with the web browser when help is requested in the command window.
|