Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
visuallua

visuallua

Ratings: (0)|Views: 9 |Likes:
Published by Mikhail Miguel

More info:

Published by: Mikhail Miguel on Feb 12, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

02/12/2012

pdf

text

original

 
Tche - a visual Environment for the Lua language
André Filipe Lessa CarregalRoberto Ierusalimschy
Departamento de InformáticaPUC-RioRua Marquês de São Vicente, 25522453-900 Rio de Janeiro, RJ, Brasilcarregal, roberto@icad.puc-rio.br
Abstract
: The Tche (Tiny Canvas-Hosted Environment) system is a visual environment that sup-ports the direct manipulation of visual objects written in the Lua language. Tche was designed to besimple, portable and flexible, being also highly user customizable. Tche uses a workspace where thevisual objects can be manipulated, modified and browsed. The system allows the use of text Luacommands, offering real-time interactions not available in conventional systems. We introduce othervisual environments such as Visual Basic, ACE, Smalltalk, Oberon, SELF and Tcl/Tk, and brieflydiscuss the solutions and characteristics of each system in the direct manipulation of visual objects,ease of use and portability.
Keywords
: Visual Programming, User Interface, Abstract Data Views, Active Objects, Visual Ob- jects.
1. Introduction
The advent of new programming styles usuallybrings up new software development tools. The needto combine prototyping and rapid application devel-opment, makes necessary the use of specific tools, toachieve flexibility and ease of use. These tools nor-mally use the concept of direct manipulation of ob- jects. Those can be considered
visual objects
due tothe existence of a graphical representation corre-sponding to each object.Software tools with such characteristics are calledvisual development environments. Some of thesetools allow visual objects to have their attributes andbehavior modified in run time (dynamic modifica-tion). This feature enables the investigation of newpossibilities and combinations, stimulating an ex-ploratory programming style.This work describes the Tche (Tiny Canvas-HostedEnvironment) system. Tche is a visual developmentenvironment that supports the direct manipulation of visual objects described in Lua. Lua [FIC94] is aprogramming language with structured languagecharacteristics and object orientation, based in aportable interpreted environment. Lua can be used asa configuration language, using its data descriptioncapabilities, as much as a programming languageembedded in a development system.Tche is simple to use and requires few machine re-sources and a little learning time. Nevertheless, thesystem is also flexible enough to allow a high degreeof user configuration. The system also offers easyportability, minimizing the utilization costs in het-erogeneous environments.In the next section we introduce some related visualenvironments. Then we describe the Lua program-ming language and the Tche System. Following this,we conclude with some suggestions for future works.
2. Related work
This section introduces other visual environmentssuch as Visual Basic, ACE, Smalltalk, Oberon,SELF and Tcl/Tk, and briefly discuss the solutionsand characteristics of each system in the direct ma-nipulation of visual objects, ease of use and portabil-ity.The Visual
 
Basic system[MS92] offers a visual de-velopment and programming environment allowingsimple prototyping and complete program creationusing a Basic language variation. The program inter-face creation is done with direct manipulation of in-terface elements. Each element has a set of proper-
 
ties and a programmed behavior. The system can usethe built-in elements and/or C created elements. Thelast ones allow different functionalities and featuresto be added to the system.Visual Basic offers no run time object direct manipu-lation, unless the developer explicitly implementsthis feature in Basic code. Although Visual Basicbuilds stand-alone executable application, those arenot portable running only in the Microsoft Windowsplataform.The ACE (
 Application
 
Construction
 
 Environment 
)system [JNZM93] uses the composition of high-levelsemantic components to develop applications. TheACE system uses a high-level component manipula-tion language based on the spreadsheet formuladefinition. The language is used to configure andmodify the application components. In traditionalsystems the programmer uses low-level abstractionresources to specify what the application does andhow it interacts with the user. In opposition to this, aspreadsheet offers functionalities and interface ele-ments that are configured by the user to develop anapplication.Smalltalk [Gold84a] consists in an object-orientedprogramming language and a group of integratedtools that manipulates the various components of theSmalltalk system. The system display is divided inrectangular frames containing text and/or pictures.Frames can be moved, resized, collapsed or removed.Smalltalk uses the concept of 
image
to store and re-cover its configuration. The user can at any timesave the system image so the modifications becomepart of the system. Smalltalk offers tools such as texteditors, class browsers and an interactive debugger.The class browser allows the visualization andmodification of the system methods and attributedefinitions. New classes and methods can also beadded as needed.Oberon [Wirt92] is derived from Modula-2 and wascreated to develop operating systems. Oberon differsfrom Modula-2 mainly by offering type extensionsupport, essential to the system expansion. TheOberon environment offers advanced resources forthe editing and formatting of text and pictures. Thesystem is extremely economic under the perspectiveof resource utilization. The display management isbased in frames, positioned by the system usingspecific space-saving algorithms. The system usesframe tiling instead of the more common overlap-ping method. The system is available for many plat-forms and porting Oberon programs is very easy, in-volving only recompilation.SELF [AB93] is an object oriented language, devel-oped to facilitate the exploratory programming. Thelanguage includes dynamic typing and garbage col-lection. SELF does not use the concept of classes orvariables, adopting instead the prototyping of ob- jects. The object attributes (
slots
) are accessed send-ing messages to
self 
.The SELF environment has a high-level abstractionof the system objects, allowing the direct manipula-tion of object properties. The environment uses so-phisticated interface methods, including cartoonanimation techniques. That sophistication, however,makes SELF a resource-demanding system. Anothernegative points are the lack of portability and thedeep dependence to the SUN platform.Tcl (
tool
 
command 
 
language
) [Oust94] is a scriptlanguage developed for application control and ex-tension. Tcl uses a C library interpreter that can beembedded in the application. The use of the samelanguage across a set of applications allows the ex-change of scripts by the applications. This communi-cation mechanism is more powerful and flexible thanstatic libraries solutions like Microsoft OLE andSUN ToolTalk.The Tk [Oust94] toolkit is a Tcl extension that of-fers X11 user interface building commands. Tk al-lows the creation of interfaces using Tcl scripts in-stead of C code. The toolkit uses X11 to implement awidget set based on the Motif look and feel. Eachwidget belongs to a class that specifies the appear-ance and behavior of the widget. The behavior isdetermined by a Tcl script binded to the widget.
3. The Lua language
Lua [FIC94] is a dynamic typed extension languagewith traditional structured and object-oriented char-acteristics. Lua is implemented as a C library anddoes not have the concept of a main program, beingused always within a host program. Lua reflexivitymechanisms allow the creation of new code chunksand the association of this code to the system, facili-tating the implementation of persistent objects.Before executing a piece of code, Lua compiles itscommands and functions and then executes thecommands sequentially. Functions are values in Luaand can be stored in variables, used as parametersand returned from other functions. The
table
typeimplements associative arrays that can be indexed by
 
any value, being used not only as conventional ar-rays but also as lists, symbol tables, records, etc.The table constructor mechanism allows the imple-mentation of very sophisticated data structures, pro-moting the use of Lua as a powerful configurationlanguage. The table constructors can create emptytables or tables with initialized values. Constructorscan call a Lua function, a feature that can be used tomany purposes, such as defining default values forthe created table.Lua has a powerful semantic extension mechanismcalled
 fallbacks
. This mehanism allows a program-mer to define functions to be called when Lua doesnot know how to handle an error situation. A com-mon use for fallbacks is the implementation of aninheritance mechanism. More details about the lan-guage and its API, including code examples and theintegration of Lua and C can be found in the lan-guage reference manual [IFC95].
4. The Tche System
The Tche (Tiny Canvas-Hosted Environment) sys-tem [Carr95] is a visual environment that supportsthe direct manipulation of visual objects written inthe Lua language. Tche was designed to be simple,portable and flexible, being also highly user custom-izable. Tche uses a workspace where the visual ob- jects can be manipulated, modified and browsed. Thesystem allows the use of text Lua commands, offer-ing real-time interactions not available in conven-tional systems.The acronym choice intends to convey the philoso-phy of an economic system easily portable to mostgraphic platforms. Tche uses some concepts of thesystems presented before, including some ideas notpresent in these systems.Being an event-driven environment, Tche does nothave a main program. Instead, the system consists of different objects that interacts with themselves andwith the user. Like some similar systems, Tche canuse timers to generate events in regular time inter-vals. The Tche event handling architecture permitsthe creation of new event types and the association of these to the system. As an example of this mecha-nism, events can be added to the system using RPC(Remote Procedure Calls), allowing the remote sys-tem manipulation.As Smalltalk, Tche uses a system image concept tostore the visual objects state. However, Smalltalk uses a complete system state recording. Instead of this, the Tche system image consists of a Lua textfile describing the system objects. Using a configu-ration file like this allows the transport of Tche ap-plications within different platforms, helping the in-terface and prototype development.Tche can be used in three levels: in the top level,application users operate the system through its in-terface; in a middle level, Lua developers modify thesystem using Lua code; and in the lower level, Cprogrammers add new capabilities, such as events, tothe system.From the application user perspective, the Tche en-vironment is composed by a command window andone or more canvas, where visual objects are placed.The command window allows the typing of any Luacommand to be executed. The user can also activatebrowsers to navigate and modify the visual objectsattributes (Figure 1). The browsers let the user editsimple attributes and activate new browsers to accesstable type fields. Simple attributes (numbers andstrings) can be modified right into the browser,while table and function attributes are just high-lighted indications.Tche uses some SELF concepts to show visual ob- jects. Objects are solid and move like filled blocks,instead of border frames. The appearance of newobjects in the screen, including menus, uses anima-tion techniques to simulate the
breeding
of the ob- ject. The simple techniques used show that, theseemingly little efforts in the interface interactionand visualization, make a real difference in the sys-tem user feedback.Unlike most of the other systems, Tche does notforce an object to be positioned in front of the oth-ers while moving. A moving object keeps its relativeposition, passing over objects that are in lower posi-tions and under superior ones. To enhance themovement illusion the system uses a double buffer-ing technique like the Tk toolkit [Oust94]. Noticethat this moving metaphor needs fast bit map opera-tions (BitBlt) to run smoothly.To a Lua developer the Tche system offers a hierar-chy of objects defined as Lua tables. Each object hasattributes that can be simple values, tables or func-tions. The use of functions as table attributes can beinterpreted as an association of methods to objects.The system hierarchy offers objects corresponding towindows, lists, timers and the visual object manipu-lation subsystem.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->