http://www.obix.lu
Do you want to create more reliable code in less time? Obix may be just what you need. However, I’m guessing this probably looks like just another programming language, but it’s actually contained within a philosophy that may be an important evolutionary step in programming methods, called “Fail fast!”
Take note of that term. At first, it may seem bizarre, but on further inspection, the amusing name is actually very logical with a profound approach to programming. I explore this philosophy and its implications following the next section.
To quote some carefully chosen parts of the documentation:
Obix is a high-level, object-oriented, statically-typed, compiled, portable programming language.
The compiler generates Java binary code (.class files). Hence, applications written in Obix can run on any system with a Java Virtual Machine (JVM) installed, such as Linux, Mac OS, Windows and so on.
Obix has been designed from the outset with a very specific main goal in mind, namely to help write more reliable
code. In practice, this means that: 1) once your code passes compilation it contains less bugs and 2) remaining bugs are more quickly detected at runtime.
As a result, you can expect to reduce development time and costs.
Installation Whether it be in
development mode or production mode, Obix is designed around Java, so installing Java on your PC is a prerequisite. If you haven’t done so already, install the Java JDK version 6.0 or later. The documentation notes that it’s not enough random_arcs is a cool tutorial that comes with Obix.
(JRE); you need to have the Java Development Kit (JDK) installed.
If your machine is Debian/Ubuntu-based, the package name is sun-java7-jdk.
If your machine is RPM-based, look for jdk-7u1-linux-x64.rpm or jdk-7u1-linux-i586.rpm. Either version 6 or 7 will do, but version 7 of Java is preferable. Other than that, there is nothing else in the way of dependencies.
To install Obix, grab the latest tarball from the Web site, extract it, and open a terminal in the new folder. From there, you now can check the installation with the following command that displays Obix’s version number in your terminal:
$ ./obix.sh version
Usage As these are early days, Obix isn’t supported by a graphical environment. All tools for managing projects and compiling, running and testing code are executed from the command line, so get a console and text editor ready.
So what was all the “Fail fast!” stuff about? The idea is this: every coding error should be detected as early as possible, preferably at compile time, or else as early as possible at runtime.
To achieve this, Obix has error-preventing concepts, such as:
■ Contract programming (design by contract).
■ Unit testing.
■ Generic types without type erasure at runtime.
■ Objects are immutable by default.
■ Void (null) values are not allowed by default.
Although this may seem like a hassle, Obix designer Christian Neumanns found that a forgiving approach to coding in a language resulted in some horrendous errors in the long run, with some very angry customers. However, start out with a “Fail fast!” approach, and your coding naturally will be tighter and more reliable.
To illustrate one of Obix’s unique features for more reliable code, look at the following example source code:
int server_port = 8080
int age_of_my_elephant = server_port
Can you see the error? Of course you can. Can your compiler see the error?
No, it can’t. Although server_port and age_of_my_elephant obviously are two semantically different values, the compiler can’t see an incompatibility, because both values are of type integer.
Moreover, no runtime error will be
generated, despite the fact that elephants can’t be older than about 100 years.
ever write silly code like this!” This is true (for most programmers). However, look at this code:
int age_of_elephant = utilities.get_initial_value
Now, you can’t tell if the assignment is okay just by looking at the source code.
You would have to verify manually that utilities.get_initial_value actually returns an “age of elephant”
value that can’t be negative and can’t exceed 100. It would be helpful if the compiler could check all this for you automatically, wouldn’t it?
Without digging too deeply into how it works, here is the solution in Obix. You would define a specific type age_of_elephant and declare a
positive maximum value of 100. The source code for this type looks like this:
type age_of_elephant
inherit simple_positive32
attribute value and_check: i_value <= 100~ end end
end
Then, you would declare a variable and assign it a value as follows:
var age_of_elephant age_of_my_elephant = ...
Now, the Obix compiler ensures that
returns an age_of_elephant value (and not a “server port” value). And, it is impossible to assign an invalid value, such as -5 or 8080.
Many applications contain hundreds or thousands of integer variables with semantically different (and, therefore, incompatible) values. Thus, compile- time and runtime checks like the above are very important and effective, because any incompatibilities and illegal values are immediately and automatically reported. The same observation can be made for other data types, such as strings. For example, in Obix, you would define different types with specific
validation rules for customer_name, email_address and ISBN_number.
Unfortunately, that’s about as much as I can cover here. One area I would like to have highlighted is being able to insert Java script into Obix code (see Chapter 3 of the tutorial), but my favorite part is Chapter 4: “How to develop a standard PC application”. Here you will see how Obix already has tools to develop projects, with their own compilation, tools,
directory structures and so on—very cool.
In the end, Obix is built around some fantastic concepts, and I hope that it soon reaches a level of maturity where it’s sitting in all major distro repositories.
You also can help improve Obix by getting involved in the Open Source community or just by sending feedback to the author. Even outside of Obix, I’m
will take root in future programming languages, creating another evolutionary step in programming methods, and
ultimately, more reliable computing.