|
TouchDevelop is an interactive development environment and a visual programming language being developed at Microsoft Research. TouchDevelop is used to develop application programs for mobile devices, including smartphones and tablet computers. It can also be used on any computer which has a suitable web browser. In addition to its use as a tool for creating application programs, TouchDevelop has been used to teach programming and mobile device technology at schools, colleges and universities. Development environment TouchDevelop runs entirely in-browser and provides an interactive environment for developing, testing and running programs. The programs are coded in the TouchDevelop scripting language which is described below. A new program is entered onto the device via a syntax-directed editor which has been designed for use with the small touch-sensitive screen that is normally found on a smartphone. A user can also choose to download existing scripts, published on the TouchDevelop website by other users, and edit these scripts. The editor displays choices of actions (such as language elements to insert or code refactoring changes) which change according to context. A single tap, or mouse click, on a dynamically labeled key performs the action. The development environment includes a facility for testing and debugging the program's user interface which avoids the need to restart the program from the beginning after each change. There is a debugger for analyzing and tracing program execution, as well as separate facility for running unit tests on components of the program. When a script is complete, the user has the option of publishing it on the TouchDevelop website and, additionally, of making the script accessible to others through keyword search. Scripts may also be submitted to the application store for possible sale to others. The environment can be installed on a variety of platforms which include Apple iOS devices (iPhone and iPad), Android devices (phones and tablets), Windows devices (phones and tablets) and computers where a suitable web browser has been installed. Appropriate browsers include recent versions of Internet Explorer, Firefox and Safari. The primary requirement is that the browser must support Javascript and HTML5. A script developed on one platform can be installed on a different platform provided that it too possesses an appropriate browser, and the script uses only the capabilities which are accessible on that platform. Scripting language The scripting language is designed to be terse in style, since code may need to be viewed on small screens. Symbols are used instead of keywords in many places to achieve that brevity. The language is imperative in nature, although some of the language syntax is similar to that used in object-oriented languages. The basic datatypes are numbers, strings and booleans. Compound datatypes include lists, arrays and other datatypes supported by the API library. The control flow constructs include if-then-else statements, for loops, while loops and function calls. (In TouchDevelop, a function is called an action.) The language is both strongly typed and statically typed. Local variables are not explicitly declared, their types are instead inferred from their first use which must be an assignment statement that initializes the variable. The type system has value types where storage is allocated on the stack, and reference types where storage is allocated on the heap. The heap is garbage collected. Scripts have a single thread of execution. Events, such as shaking the device or tapping the screen, can be associated with events in the script (provided that the device has the appropriate capabilities). An event will interrupt a running script to execute an associated action. However, an event action cannot interrupt another event but will be held until the action for that event has completed execution. The TouchDevelop scripting language introduces a feature called "cloud types". A global variable with a cloud type has, or will have, its value synchronized with storage provided in the cloud. This feature enables scripts to interact safely and reliably with scripts running simultaneously on other devices. API The TouchDevelop API is a library which provides resources and extra datatypes, each with an appropriate set of associated actions. A partial list of the capabilities provided by the API is as follows. * Graphics and screen drawing functions * Touch input * A physics engine (which is especially useful when programming interactive graphical games) * User interface layout and controls * Access to sensors provided by the device (such as accelerometer, GPS location, and compass) * Read access to data stored on the device (such as music, photographs, and contact information) * Cloud storage * Sending messages via Short Message Service or an instant messaging service * Interaction with social media such as Facebook
|
|
|