Computing Pages

by Francesc Hervada-Sala


Sample: Program Parameters

Let us consider an example of text-oriented programming.

Every program has constants or parameters that control its behavior. The programmer has many choices, among others: a) hard-code them as literals, b) define code constants, c) put them in a configuration file that is read at run time, d) define them as command line arguments, e) put them in a database and retrieve them at run time.

With today's means the programmer must make a commitment. The way she or he will refer to those values in code is tied with its implementation. The decision must take place at the beginning and to change it later on is time-consuming — if still possible at all.

The text-oriented approach is different. The programmer defines a symbol say parameter and instantiates it for each of the needed parameters. The whole code refers to those symbols by name. At the beginning of the development the values are perhaps hard-coded constants, one defines parameter to be of type constant and assigns each of them a value. Later on one changes the definition of parameter that gets a configuration file value. Note that here just one symbol was changed, the rest of the code remains unaltered. The compiler translates each read access to the parameters according to the current definition of symbol, and after a change the generated code looks very different in many places, but the source code changed only at one place. Note that there is no run time penalty at all, support for the generality of the parameter symbol is pure compile time support, and the programmer can determine the implementation details if desired with unlimited precision for a single case.

Apart from that, a text-oriented environment gives the programmer multiple ways of interacting with the parameter values. Today, when developing, one must put the parameters according to its implementation: either at a particular file, or at a particular database table, or at some source code files. The values can only be seen and updated at this place. In a text-oriented IDE the parameter values can be shown and updated independently of its implementation. When you are browsing some code functions that use some parameters, you can overlay the parameter values and change them at place. You can also get the code with parameter values expressed as literals, not showing the parameter names but their actual values instead, thus getting very readable code, and let the editor overlay some parameter attributes for single parameters on demand. You can also get a table with all parameters related to a particular functionality or a program. The text engine saves them only once, but your access is multiple. Note that this is implementation independent. You can get a single parameter list containing all of them: source code constants, configuration file values, database record values, etc. And you can switch the implementation of a single parameter at every time if you want to.

Print Contact

Sample: Program Parameters

Text-Oriented Software (Book)

Text-Oriented Software

Preface

Text

Text Structure

Comparing Text to Other Structures

Text Query

Languages

Text-Orientation

Imagine

Text-Oriented IDE

Text-Oriented Programming Languages

Files and Text

Programs and Text

Text-Oriented Compiling

Case Studies

Sample: Program Parameters

Unix: A Text-Aware Environment

Universaltext Interpreter

Background

What is Text?

What is Text-Orientation?

Just Once: A Programming Ideal

Why is Computing Important?