ContRap
The symbolic tool for software rapid prototyping
Documentation
Basic concepts

The following section is an introduction to the basic ContRap concepts.

ContRap philosophy

ContRap is a symbolic software rapid prototyping system. In other words, ContRap is designed to develop prototypes of complex programs involving symbolic computations in a short time.

The user designs his program by writing a ContRap script or a worksheet. The symbolic component of ContRap is implemented by an interpreted programming language, in which each unknown expression evaluates to itself. In contrast to many other symbolic systems, ContRap is designed and optimized to import and use C/C++ functions, objects, and classes. ContRap is, hence, a symbolic rapid prototyping environment for C/C++ developers.

A typical scenario for ContRap usage is the following:

A researcher develops a highly optimized C/C++ library. At some point he must make a decision, which approach/algorithm to implement. The decision depends on several cost factors like, for example, performance, speed, or implementation time. The researcher knows, that there exist implementations of the alternatives by other software groups, but he does not want to mix up the implementations, until he is really sure about which alternative to use.

The above situation is very common to practical research areas of computer science. ContRap works now as a handy transparent interface between the different libraries. The researcher implements a ContRap interface for the libraries and is then able to compare the performance of the alternative implementations or his own results with other implementations.

For the above scenario to be effective, the rapid prototyping environment must implement two things: a simple interface for combining the functions and objects of libraries and for data interchange, and a simple means of wrapping C/C++ libraries. ContRap is designed to satisfy both of the above requirements.

User- and developer levels

ContRap development is subdivided into two abstract levels: the user- and the developer-level.

The user level is the most abstract ContRap usage level. The user communicates with the libraries in an interpreted language. The language is designed with the goal to be very comfortable and comprehensive for the user. Syntactically, the language is designed to be as close as possible to pseudo-code but to still allow symbolic expressions. Unlike C/C++, pseudo-code simplifies manipulation with data types and writing complex algorithms. The price to pay for the simplicity is the computational speed. ContRap user level programs are relatively slow. Read more about the user level in the corresponding section.

The developer level deals with the integration of C/C++ libraries to be available within the user level. C/C++ functions and classes are usually fast but inflexible due to the inherent compilation processes in a typical coding/debugging cycle. Read more about the developer level in the corresponding section.

Function- and class-wrapping

A natural way to join libraries with different data types and function interfaces is the ''plugin''-pattern. A plugin unifies the interface between the components thus making calls to components uniform in signature.

Plugins make possible to change the implementation of your code at runtime. ContRap plugin library contents are updated on user demand whenever the library has changed. You can continue writing your algorithm with the changed implementation without having to temporarily save the data.

Nearly everything in ContRap is exported from C/C++ using the ''plugin''-pattern. This includes types and functions, which operate on them. Only few data types and functions, which are essential to make meaningful inputs from the user are built-in. Other data-types are provided by the plugin-libraries.

Garbage collection

One of the objectives of ContRap is to provide a comfortable memory management to the user. For that ContRap implements a non-intrusive reference counting garbage collection. Unreferenced objects are deleted by the garbage collector, when the reference counter goes to zero. Internally this is reflected by smart pointers, which are consequently used throughout the ContRap core.

The existence of smart pointers and garbage collection is transparent to the user level mode. Smart pointers require a little amount of care when programming C/C++ wrappers for your libraries in developer mode. Here the usage of reference counters is essential to implement memory-efficient wrappers by reusing the memory. Read more about reference counting and efficiency in the corresponding section.