Advantages of LC as high level language--examples
ambassador at fourthworld.com
Tue Nov 30 12:08:25 EST 2010
Devin Asay wrote:
> In trying to explain to students how high level languages such
> as LiveCode can make development faster, I would like to give
> concrete examples of how single-line LC commands actually
> execute dozens of C++ commands in the engine. For example,
> a simple one-liner like:
> show field "demo" with visual effect dissolve
> Must have lots of lines of compiled C code behind it. Does
> anyone have any concrete examples? I may end up directing this
> to the mother ship, but thought I'd try here first.
That leverage is of course powerful: you can write a single line of
code that executes many hundreds or even thousands of lower-level
instructions in a language like C.
But that doesn't tell the whole story, and with modern frameworks like
Cocoa you get a lot of leverage there too.
Being a lazy person by nature, I would let others make my argument for
me - these three articles do a pretty good job:
Scripting: Higher Level Programming for the 21st Century
In Praise of Scripting: Real Programming Pragmatism
Rise of the Scripting Language
The first one is especially good IMO, since although it focuses on the
benefit's of the author's Tcl most of the points he makes apply equally
well to Rev. The value of typelessness for programmer productivity
cannot be overstated.
For all of the reasons presented in those articles, scripting has been
enjoying quite a renaissance in recent years. Once limited to
domain-specific languages and considered suitable only for "script
kiddies", many modern very-high-level languages (VHLLs) are
Turning-complete and surprisingly efficient with their dynamic typing
and garbage collection. Most of the web economy is driven by VHLLs, and
a growing number of desktop apps are too. When Adobe delivered
Lightroom, with so much of it driven by Lua, I knew scripting had
With LiveCode we have all the benefits common to most modern VHLLs with
a few extras:
- Chunk expressions make short work of one of the most common sets of
tasks in any language, parsing and concatenating text.
- The object model is highly visual and deeply integrated syntactically;
while it can be used to make abstract classes, it's inherently very
physical, with the message path for the most part following the
layering of objects as they appear on screen, making it much easier
to grasp than more complex models replete with abstract classes.
- Associative arrays are the key to many modern name-value-pair
programming systems like CoreData, the NoSQL data stores, and
others, but with getProp and setProp those are uncommonly easy
to implement in LiveCode.
- The out-of-the-box component set is pretty rich, with objects
provided for native-looking controls in addition to both vector and
raster graphics, and multimedia support with players that even goes
so far as to provide built-in support for QTVR nodes. That's a
lot of stuff.
- The bundled externals for handling DBMSs and embedded browsers
provide additional richness that opens up many other application
- With behaviors and the new group properties and messages you can
roll your own custom objects of just about any type you can
imagine. If you've ever written an LDEF you can really appreciate
what the DataGrid provides. :)
In fact, that LDEF may be a good example for your class: Have them use
the APIs provided by the OS to craft a custom list definition using a
form layout, then have them use the DataGrid.
Heck, even if they wrote their own DataGrid-like nested groups, if you
can accept the limitation of 32k vertical pixels for groups it avoids
the complexity Trevor had to address with virtualizing the scrollbar,
and a usable subset that copies a template group into a master for
delivering form-like lists can be made in a few minutes.
Compare and contrast with the many days it would take to write the
modern equivalent of an LDEF in Objective C, and the many more days
debugging to get it to work.
Then write it two more times using the APIs for Windows and Linux. ;)
A simpler example is one of my favorite things about LC, the ability to
deliver the UI over HTTP:
Compare the ease of putting a stack on a server and running it with "go
url..." to writing such a web-savvy dynamic UI in C++.
Or even simpler: Just write a GUI app with native controls that lets
the user open, edit, and save a text file.
Compare the total time needed for writing and debugging in both C and
Then have them write that app again for at least one other platform,
while you just click a checkbox.
Suddenly the benefits of LiveCode become undeniably obvious.... :)
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode