Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

Delphi Code Monkey: Programming For Non-Programmers : No Silver Bullets, No Free Lunches.

$
0
0
Programmers tend to be fond of these aphorisms:

  • There Ain't No Such Thing As A Free Lunch (TANSTAAFL) -- Robert Heinlein
  • There Are No Silver Bullets -- Fred Brooks
But leaving aside our cynicism for a while, we also like to imagine local violations of these general-relativity-principles, and one of those areas of perennial optimism is the Programming Language for Non-Programmers.   That was, if you remember far enough back, the impetus for COBOL,  for the Fourth Generation Language (4GL) idea, for tools like PowerBuilder, and Visual Basic, and even, to a certain extent, for Delphi itself.  It resulted in some horrific syntactical nightmares, like AppleScript.

Where Delphi differs from the typical "tools used by people who write code who are not primarily programmers" is that Delphi offers a programming language with elegance, sophistication, and expressive power, that is not broken or hobbled by its syntax.  Not so with just about everything else in that list.   

However, it's time for people to try again, and the newest attempt I've see at "programming for everybody", is called LiveCode, from RunRev.  Go download it now, I'll wait.

What's great about LiveCode? A few things:

  • The core product is free, and is supported by revenues from their tutorial videos (LiveCode Academy) as well as from their sales and support for their premium product.
  • It's cross platform, on Windows, Linux, mobile, and Mac, in fact, it claims to support all the platforms that Delphi still has on the distant future roadmap.
What's not so great about LiveCode?   Well, if you remember back in the good old Borland TurboPascal days, one of the things they did was give you a language introduction in a book, like this:


Inside was a systematic, carefully laid out, and orderly presentation of core concepts, like this:


After a few pages, you begin to grasp a few concepts which you can use over and over again throughout your working life with Pascal.  That's another way of saying that Pascal syntax is orderly, does not try to be english, but is nevertheless readable, and the language is orthogonal to the task it performs.  Now let's look at how coding works in liveCode.  You drop a button and an edit box on a form.  Score for LiveCode is good so far.  You don't need a PhD or a tutorial video to figure out how to use it.  So far, it's as friendly as Visual Basic, C#, and Delphi, and far friendlier than Java.


Double clicking on the Button does not do what it should do. I invoke Visual Basic, Delphi, and C# as three common environments that know what's what. When you double click a button, you should immediately be given the coding context where you will write what happens when the button is pressed.  Instead you have to locate the properties-inspector analog, and find a button that looks like a CD player Play button, and click that and then click Edit Script:


Now we get the code window:


I'm rather proud of myself. It only took me 20 minutes to figure out that the way to set A = B is:

   put"Test2"intoField"Field1"


Let's unpack the concepts here for pedagogical types:

1.  LiveCode owes a debt most of all to 4GLs, AppleScript and HyperCard, and borrows some good ideas from all three.
2.  Put is one of the ways of writing assignments.
3.  The value that is put into something else is the first thing you write. This is backwards to most of us, who learned BASIC,  which has LET A = 5, which has always made perfect sense to me.  Instead we PUT 5 INTO A in this language.  Already, that's too much typing for me.
4. Next let's note that a field has a name "Field1" and that it is a Field, and that unlike a Delphi edit box named Edit1,  we must refer to it always as Field "Field1", not as just Field1.  

I managed to type a few malformed versions of that above line of code that froze the IDE completely, requiring me to Force Quit (end task), like this one:

put "Test" into Field "Field" to "thing"

The above statement passes the grammar-checker in LiveCode, and then goes into the internal works, and does something that wreaks havoc with the internals.  That, my friends, is the steep cliff that all "friendly" languages have lurking at all times.  Designing a grammar is a difficult task, and designing your own language leads to all manner of quirks.   

The lifecycle of these technologies, it seems to me is, well known, and is documented in various places and by various names, most famously as the Hype Cycle:



Am I saying that LiveCode is unimportant? No, far from it. I'm deeply impressed by the author's goal, and I, like them, dream of being able to teach 8 year olds to make video games, or do whatever else they want to do, in a language free of accidental complexity. But I disagree that emulating english with all its ambiguities is the way to do it.  I think that something more like Python is close to ideal for teaching programming. Nevertheless,  Python lacks a true Delphi-style RAD IDE.

There is a very delphi-like free and open source IDE out there that has enough of the basic Delphi IDE features, and enough power in the backing compiler to be most of what I want, but I still think Pascal is not as friendly as it could be, and so I have some hope still for LiveCode.  Since it's open source, I've been wondering if I could hack a bit on their language choices, and try to do things like this:

  • Let users pick items and combine them using menus and toolbars that will result in code templates being generated, for common tasks like variable declarations and assignment, looping, and conditional checks.
  • Let users write in a simple declarative style without line-noise or overhead:
       Field1 = "test"
  • When users type something that is not understood, provide some kind of interactive help that helps them navigate their way out of the mess or confusion they are in.

Anyways, as an inveterate tinkerer, this gets top marks from me just for existing, and for being open source. (The code is all on github.) Check it out.










Viewing all articles
Browse latest Browse all 1725

Trending Articles