Advantages (so far)

Until now you just wrote code to define and create objects. It is time, however, to lean back and consider some important points related to reliability and productivity.


A first point to note is that the contribution objects created at runtime are all immutable. This means that once an object is created, its attributes cannot be set to different values. Hence, if an object is created and stored in constant c as follows:

const contribution c = fa_contribution.create ( &
   identifier = 123 &
   first_name = "Albert" &
   last_name = "Newton" &
   random_number = 5 &
   date_time = fa_local_date_time.create ( "2011-08-27 16:16:30"~ ) )

then instructions such as the following one are refused by the compiler:

c.first_name = "foo"

This is a direct consequence of the following important immutability rule integrated in Obix:

By default all objects are immutable.

This rule increases the reliability of software because immutable objects are simple and less error-prone. They are thread-safe and can be freely shared in parallel processing applications. They are also less vulnerable to malicious attacks and there are no state transitions to manage.

For further information please consult Chapter 7, Object immutability in the language manual or search the internet for articles about the importance of immutable objects.


Another important and effective Fail fast! rule integrated in Obix is:

Void objects are not allowed by default.

Void values (also called null values in other languages) are one of the most frequent reasons for bugs in applications. Therefore void values are not allowed by default in Obix. Any violation is detected by the compiler or else immediately at run-time.

Hence, assigning void to any attribute of a contribution object is refused by the compiler. Example:

const contribution c = fa_contribution.create ( &
   identifier = void &
   ...

For further explanations please consult Chapter 6, Void values in the language manual.

[Note]Note
It is interesting to note that most programming languages support opposite rules: Objects are mutable by default and void values are allowed by default.

Other concepts for increased reliability you have encountered so far are:


Finally it is interesting to note (for Java programmers) that: