Language Reference
by Helmut Emmelmann, PhD
and Keith Oustalet
|
|
General Design Considerations
|
heitml has the following design goals:
- heitml is a monolithic language,
providing a seemless integration between itself
and HTML. The fact that part of the application runs on the
server and part on the client's Web Browser is transparent to the User
and of no concern.
- heitml is an integrated Document Description Language,
Template Generation Language, Scripting Language and Full-featured Programming language.
- heitml was created especially for Database Applications, but due to its modular, re-usable approach to Web Page design and maintenance, it should prove beneficial to anyone working in the field of Web Publishing.
- heitml applications are portable among Operating Systems,
Browsers, (SQL) Database Systems, and Webservers.
- heitml is designed to be a secure language, freeing Web Administrators from many of the usual concerns they encounter when various applications and scripting languages interact with one another.
|
Because heitml is a monolithic language, Users are shielded from extraneous technical details normally encountered when working with Scripting Languages. All functions related to an application are called using the same Syntax and Parameter passing mechanism, regardless of whether it is a Browser-, Server-, Programming Language, or User-defined function.
Document Description and Template Languages are easy and straight forward for simple applications. However, there usually comes a point when an application grows so complex that a Programming Language provides a better solution. heitml is designed to integrate these types of languages, and not just glue them together as we have seen in previous approaches to Web Publishing.
| heitml as a Monolithic Language
|
heitml was designed as an extension of HTML. The idea is to deliver a single integrated tool which enables Users to get their Applications up and running quickly and with minimum effort..
Currently, most Web Application Developers use a development model which involves Scripting Languages to produce HTML, which is then sent to the Browser for interpretation.
heitml offers a new approach, illustrated by the following example:
<if 0 <amount >
Please send us the amount of $ <? amount>.
<br>
<else>
We will send you
<font color="red"> $<? -amount> </font>.
<br>
</if>
|
We assume the value amount was obtained from a database.
If amount is positive, the above code fragment prints "Please send us the amount of...", and if it is negative "We will send you ..." appears on the User's screen. (In the latter case amount should be displayed in red.)
Previously, (using a hypothetical Scripting Language) the same process would look something like this:
if 0<amount;
echo "Please send us the amount of ";
echo amount;
echo "<br> \\n";
else
echo "We will send you;
echo <font color=\"red\"> $";
echo -amount;
echo "</font><br>\\n";
/if
|
Although both approaches use a control statement in the form of if - else - endif, there are a number of artifacts of the Scripting Language which serve only to add complexity to what really should be a quite simple task.
First, the Scripting Language requires a special command (in this case the echo statement) to send output to the Browser. Also, text has to be enclosed in quotation marks in order to distinguish it from variables (in this case amount).
Because the Scripting Language requires quotation marks to handle text, it runs into difficulties when passing values to HTML Tags that also require them. Hence, yet another artifact is introduced, namely the backslash or escape character "\" as seen in the <FONT> Tag above.
However the biggest drawback is that the <FONT> Tag is called
in a completely different syntax (inside the echo) than the if.
This constantly reminds a programmer of the fact that he is
actually writing a program that is generating some other program (in this case, an HTML page)
which is then interpreted and displayed. The programmer must forever distinguish between Scripting Lanugage and HTML functionality.
This unneccessay complexity is always present during development, distracting the User from the real problem and so slowing down the
development process and increasing the error rate.
heitml avoids all of these problems by offering a syntactically similar environment to HTML. Note that in the heitml example text and variables can be handled on the same line. The <? > Tag asks the question "What is?" and passes information to HTML in text format, exactly as required. The Tag also begins and ends with less-than / greater-than symbols, giving it the familiar appearance of an HTML Tag. Finally, the HTML <br> Tag signals the end of a line, bringing things to a logical conclusion.
Besides Scripting Languages, Template Tools are used for Web-applications.
Template Tools avoid writing the echo statements of the Scripting
Language, but most of them still use a very different syntax
for their commands than HTML uses,
and these differences create difficulties that often leads to confusion in the mind of the programmer.
With the design of heitml there is no principle difference between the <if> Tag and the <font> Tag. Both are functions of the heitml
"Programming Language". You don't have to know what runs on the Browser and what happens on the Server.
All heitml Tags are used in the same manner as HTML Tags, with the same syntax, parameter passing convention etc.
Furthermore, heitml allows you to define your own Tags in the HTML style,
which means you can extened HTML in your own manner, to suit your own
purposes, and not have to worry about compatibility with any current or future
HTML standards.
Consider what a typical Template Generator requires of you:
- Put !--% (or some other special syntax) in front of every non-HTML Tag
Try doing that and see if you can avoid thinking of which Tag is processed by
the Browser and which by the Server. By their very nature, such a Template
Language constantly throws their differences in your face, forcing you to keep track of where you are - i.e. which environment you're working in at the time.
It's like typing a letter while having to insert !--% in front of every noun, and at the same time avoid thinking of whether a word is a noun or not. It's really quite impossible.
And here's a situation we've encountered more times than we care to remember:
|
heitml as an integrated Template and Programming Language
|
Template or Macro languages usually work well in simple cases, but as soon as an application gets complicated you run into problems. This often happens simply because Template Languages are not powerful
enough, or they do not take advantage of well-known Programming Language concepts. Unfortunately, even when they do embrace high-level Language features, all too often we wind up using cumbersome Syntactical constructs that make Source Code listings difficult to read.
We often see Template Languages and Programming Languages used in concert with one another. This approach is at least workable, since you can solve all your application problems with it. But it has the drawback that you have to use two languages instead of one, which doubles your learning effort. (In some cases it can be successfully argued that problems related to the interface of these languages actually quadruples the total complexity associated with getting an application up and running.)
The solutions heitml provides to address these problems are many.
First, heitml is a full featured, professional Programming Language. Everything you expect to find in a modern-day Programming Language is contained within heitml: Procedures, Functions, Local
Variables, Recursion, Parameter Passing, etc.
heitml is, however, a Template Language and a Programming Language at the same time, and the following examples show how the heitml Syntax manages to bring these two diverse models into harmony with each other:
First, we look at a code fragment:
|
<if a==5> Hello World </if>
|
Are we looking at an if Tag followed by some text and an end-if Tag? This is certainly a traditional HTML-centric view, as can be seen by an illustration following the same format, but with different Tags:
|
<font size=5> Hello World </font>
|
While HTML has trained us to look at things this way, the following code fragment shows that we could just as easily view things from a different perspective:
if a==5
> Hello World <
/if
|
We now see that the if statement contains the text Hello World wrapped in > ... < brackets. In other words, we could think of heitml as a Programming Language that contains a > Text < construct, the function of which is to display text.
For example:
i=1;
while i<10;
> The square of < ?i > is < ?i*i > <br> <
let i=i+1;
/while;
|
The > Text < construct appears three times in the above example. Everything else is what we would normally view as high-level Language contructs such as control statements and expression evaluation routines.
While newcomers to the heitml Language may feel more comfortable staying with the traditional HTML Tag-oriented view of things, we feel certain that as time goes on, the heitml Programming Language view will become dominant. It will likely be a gradual, almost invisible process, but as one begins to develop applications with thoughts in mind such as, "What if User A has an old Browser and User B has the latest, supporting FRAMES, JavaScripts, etc.? How can I design a single Template to handle both cases?"
Another thought might be, "How can I tailor my Applications to respond to Users with different interests?"
As time goes on, you'll find yourself thinking more and more in terms of if THIS then I'll do THAT, and while This condition remains true, I'll present This specific view of a database. After awhile, you'll realize that you've made the transition from a Tag-oriented to a process oriented mindset, and you'll wonder how you ever got along without it.
User-defined Tags in heitml work just like Procedure Calls of a Programming Language, and that's where the true power lies in developing next-generation Web Applications.
|
heitml as a Database Language
|
heitml contains special features to integrate with SQL, so writing database programs becomes a straight-forward process.
Additionally, heitml has a built in tuple data type, which is very convenient when programming database applications. It can be used like a struct in C. It can directly be passed to the database, and it can even be used anonymously without knowing the individual field names.
The tuple data type is dynamic. That means fields can dynamically be added. Tuples can be compared and assigned as a whole, in which case pointer semantics apply as in modern Object Oriented Languages.
|
heitml is Designed to be Safe and Portable
|
heitml Pages can be ported to many different kinds of systems. This means that applications are independent of the underlying Operating System, the Web Server, and the Database System.
heitml is designed to be safe - i.e. heitml programs can not produce
core dumps and they can access only certain system resources. The latter
feature makes it possible to upload heitml Pages to an Internet Provider's Website without the usual security risks associated with programs that contain CGI scripts.
Actually, this has been achieved by leaving out features, rather than including them. heitml pages do not have access to files, they can not access operating system functions, and they can not access special (non-standard) features of a particular Database System. Interfaces to system components have their own definition in heitml. They
are not realized by making available the functional interfaces of specific
components.
It should be noted, however, that Web Server Administrators can link User written C libraries to heitml, and adaptations can be made to the database interface. Although system specific needs can be met in this manner, portability comes to an end here, as well as when a non-standard SQL implementation is used.
This page was dynamically generated by
heitml
© 1996-1997 H.E.I. All Rights Reserved
|