return to opentea.com
----------------------------------------------------------------------
OpenTea Technology
Computer Programming that is Simple and Solid
Copyright (c) 1997-2006 D La Pierre Ballard
OpenTea.com
13-AUG-2006

The OpenTea technology is a set of principles for both programming
language design and for programming itself so that both the language
and the programming is simple and solid.

In today's world, we need computer software that actually works.
----------------------------------------------------------------------
Please feel free to quote or copy from this webpage.
Also, feel free to link to this webpage.
----------------------------------------------------------------------
This webpage was created using the software program fixran.tea which
was written in the Teapro programming language and which runs on the
Teapro interpreter program, teapro.exe. The programming language
Teapro uses the OpenTea technology for programming that is
simple and solid.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 001: The Beginning of the OpenTea Technology
Updated 2005/11/11, 2005/09/18, 2005/09/11, 2004/05/27
**********************************************************************
----------------------------------------------------------------------
When I began programming on PCs, I realized that the programming
language tools were not at all suitable for my use. What I needed
was a programming language and an interpreter for it which met the
following specifications.

1. Single file executable interpreter not needing installation.
2. Good file processing, calculations and terminal I/O.
3. Free interpreter program that can be copied freely to any PC.
4. Interpreter small enough to fit with programs on one diskette.
5. Programs must be single file text files.
6. The language must be simple and solid.
7. The documentation must be complete and correct.
----------------------------------------------------------------------
On 14-DEC-1997 I began developing the programming language Teapro
to utilize what I had learned from trying several other
programming languages for PCs. Teapro was built using the OpenTea
technology which I developed while trying to use several other
languages on PCs. OpenTea is pronounced like the two words, open
and tea.

I wrote the first Teapro interpreter in Borland Delphi 2.0. That first
interpreter was named teapro9.exe.

Later, I realized that the only language acceptable for the
interpreter to be written in was C90. C90 is the most portable and
least proprietary of the compiled programming languages. C90 is the
1990 standardization of the programming language C. Most computers
have compilers available that will compile C90 programs.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 002: Making the OpenTea Technology Simple and Solid
Updated 2005/11/08, 2005/09/18, 2005/09/11, 2004/05/27
**********************************************************************
----------------------------------------------------------------------
While writing the Teapro programming language interpreter,
teapro.exe, there arose a number of situations which gave me the
opportunity to further enhance the OpenTea Technology and to give
Teapro even greater simplicity and solidity, than I had at first
envisioned. Here are some additions to the OpenTea Technology.

Per OpenTea, both string and numeric expressions are evaluated
strictly left to right.

Per OpenTea, file reads and writes open the file just before the
read or write and then close the file immediately afterward.

Per OpenTea, there are only subroutines and no functions.

Per OpenTea, there are two variable types: strings and decimal
numbers. Decimal numbers are floating point decimal numbers with
fifteen digits of accuracy. These numbers are commonly called doubles.

Per OpenTea, conditional if and while statements do only one
compare.

Per OpenTea, programs are strictly structured.

Per OpenTea, variable names should convey that they are variables
and convey which of the two types of variables they are. They should
also tell whether they are global or local variables.

Per OpenTea, subroutine names should convey that they are subroutine
names.

Per OpenTea, there should be no doubt whether a variable is to
be used as a string or number in a string expression, a numeric
expression, or a compare.

Per OpenTea, the speed of the program can be fairly slow even by
interpreted program standards.

Per OpenTea, the language that the interpreter is written in should
be non-proprietary and not limited to one operating system.

Further elucidation of these OpenTea principles is in the chapters
following.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 003: Per OpenTea: Left to Right Expression Evaluation
Updated 2005/11/11, 2005/09/11, 2004/04/23
**********************************************************************
----------------------------------------------------------------------
In most programming languages expressions are written as they
are in algebra. The computer has to straighten the algebra out
to know what math operations must be done with what variables or
constants and in what order those operations must take place.

There are three problems with this: first, the computer has to do
some mighty fancy parsing; second, the computer may not do the
operations in exactly the order the person intends; third, if a term
goes to zero and is used as a divisor there is big trouble which
should have been checked out beforehand.

When I was writing the Teapro interpreter it dawned on me that the
problem of expressions can be easily solved by doing the arithmetic in
a strictly left to right fashion. While this is completely differenct
from what programmers are accustom to, it is needed for a language
that is simple and solid.

In both methods, the algebraic and the left to right, a divisor
which is the result of an expression must be done on a previous
line so that it can be checked to make sure that it is not zero.
This is required with left to right because only the left side
variable of an arithmetic operation can be the result of the
expression on that program line. Since, for solidity, it is also
required with algebraic expressions, there is nothing lost for
using the left to right method.

Furthermore, it is much simpler to write a left to right interpreter.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 004: Per OpenTea: Files are Open Only During a Read or Write
Updated 2005/11/11, 2005/11/08, 2005/09/11, 2004/04/20
**********************************************************************
----------------------------------------------------------------------
Using the OpenTea technology, files are opened by the read and write
statements and then are immediately closed after the read or write.
While this is slower, it provides a level of simplicity and solidity
that other languages lack. If the computer crashes, with a Teapro
program running, there is most likely no files open. This is much
simpler because there is no need for a fileopen or fileclose statement
in the language.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 005: Per OpenTea: There are commands but no functions.
Updated 2005/09/11, 2004/05/27
**********************************************************************
----------------------------------------------------------------------
The advantage of functions is that they return a value. This can
easily be done by commands that return a value using a global
variable. When more than one value is needed from a function, a
global variable must be used for each additional variable anyway.
When functions are used in expressions, as in non OpenTea languages,
there is a variety of potential problems with scope that may arise.
Subroutines cannot be used in expressions, and so avoid this
problem.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 006: Some Additional Qualities for the OpenTea Technology
Updated 2005/11/11, 2005/09/11, 2004/04/20
**********************************************************************
----------------------------------------------------------------------
Here are a few additional qualities which were added to the OpenTea
technology, but which many languages have.

Per OpenTea, the strings need to be variable length.

Per OpenTea, variable length strings must have a known limit of size.

Per OpenTea, there needs to be a command to test strings to see if
they can be converted to numbers.

Per OpenTea, there need to be commands to convert strings to numbers
and to convert numbers to strings.

Per OpenTea, there are no commands that run other programs or that
control the computer in ways other than file processing, calculations,
and screen I/O. Operating system commands cannot be run.
----------------------------------------------------------------------
**********************************************************************
CHAP: 007: Additional Thoughts on the Teapro Interpreter and OpenTea
Updated 2005/11/11, 2005/09/11, 2004/04/25
**********************************************************************
----------------------------------------------------------------------
I wrote the Teapro interpreter using Borland's Delphi 2.01. This
programming language for Windows is based upon Pascal. Delphi
has good string handling capabilities with the memory management
of them taken care of by the language. This helped tremendously.
Generally, Delphi is a fantastic language to use when
programming for Windows.

However, there arose a very serious problem when I looked at
compiling the Teapro interpreter with Delphi 5.0. The compiled
program produced by Delphi 5.0 was over 200k larger than the one
compiled with Delphi 2.01, and there was no added functionality.

It became obvious that using a compiler that was both proprietary
and had a GUI provided just too many problems. Teapro was
rewritten in C90 which can be compiled as a console application on
Windows and Linux equally well. The not needed GUI was thus
avoided entirely with the tremendous overhead it entailed.
Incidentally, the Teapro interpreter source code, teapro.c, will
compile and run just fine on several other operating systems equally.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 008: Purpose of the OpenTea Technology
Updated 2005/11/11, 2005/11/08, 2005/09/11, 2004/05/27
**********************************************************************
----------------------------------------------------------------------
A good friend of mine has told me several times that the OpenTea
technology will never be accepted by other programmers and that the
language Teapro will never be adopted by other programmers. In most
ways, my friend is probably correct in his statements.

However, the real purpose of OpenTea and Teapro is to show the
world that simple and solid programming can be achieved to a
greater extent than is now being done. This greater simplicity and
solidity can be achieved by merely adopting the OpenTea principles
of programming.

More and more people are realizing that both the programming
language and the programming both must be simple and solid.

In programming what is needed is a language that is non-proprietary
and which can be readily moved to other operating systems. Teapro
written in C90 very well suits this purpose.

The C90 source code for Teapro is available for free from the website
teapro.com. Also, on that website numerours programs written in
Teapro are available.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 009: C90 and OpenTea
Updated 2005/09/11, 2005/02/27
**********************************************************************
----------------------------------------------------------------------
C90 is the 1990 standardization of the programming language C.
The programming language C90 is very likely the most widely
accepted language on any computer and operating system and will
most likely run more similarly from computer to computer and
operating system to operating system than any other compiled
language.
----------------------------------------------------------------------
**********************************************************************
CHAPTER: 010: Aphorisms on Computer Programming as an Art
Updated 2005/11/11, 2005/10/19, 2005/09/11, 2005/01/04
**********************************************************************
----------------------------------------------------------------------
The are several very good books on effective programming in a
business type environment. The emphasis in these books is on
getting adequate programming done by a team of programmers
within a schedule. We are all aware of the problems in writing
programs under such conditions.

Computer programming can be done not only as a science but
also as an art. A programmer who is not only a scientist but
also an artist may very well produce truly great programs.
Here are some aphorisms on the subject.
----------------------------------------------------------------------
Take the time to make an improvement in the comments in a program
if you see that the improvement will make the program clearer.
----------------------------------------------------------------------
In olden times, programs had to be as lean as possible because the
computers were so slow. Today, we need programs that are crystal clear
regarding what is being done and how.
----------------------------------------------------------------------
A computer program is almost a living thing in that it will need
further improvement in a short time.
----------------------------------------------------------------------
Most likely, your program will outlast you. If you write it really
well you will last longer, too.
----------------------------------------------------------------------
Take the time now to make the small improvements to the program.
----------------------------------------------------------------------
If the algorithm is not absolutely clear, it may need better comments,
better named variables, better organization in its layout, or all of
these things. It might need a better algorithm.
----------------------------------------------------------------------
If you are in a hurry, your program probably will be too. Both you
and your program will handle tiny details too quickly.
----------------------------------------------------------------------
Stradivarius probably took time to handle the small details well.
----------------------------------------------------------------------
If programming is not a joy you will not do much of it and you will
not do it well.
----------------------------------------------------------------------
When you do not have to ask if a program is good enough, rather, you
know that it is the best; that is when you have become a true
programmer.
----------------------------------------------------------------------
Good enough is not good enough.
----------------------------------------------------------------------
End of Webpage, Program: www.teapro.com/fixran.tea, 13-AUG-2006 18:21:17