The Obix programming language: more reliable code in less time
Posted On November 5, 2012 by Sneha Philipose filed under
Obix is a new, open-source, object-oriented programming language specifically designed to write more reliable code in less time. This article tells you what you can do with Obix and why Obix helps to write more reliable code.
"Why still another programming language?" you might ask. Before answering this justified question, let us first briefly describe the main characteristics of Obix.
- a high-level, object-oriented, statically-typed, compiled, portable programming language
- open-source, licensed under the AGPL version 3
- currently in beta version
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, MacOS, Windows, etc.
You can download a binary distribution for Linux or Windows (free of charge) from www.obix.lu. A tutorial, reference manual, API browser, and links to a bug tracker and the Git source code repository are also available on the website.
There is currently no support for an Integrated Development Environment (IDE) such as Eclipse. All tools for managing projects and compiling, running and testing code are executed from the command line.
More reliable code ...
Do you like bugs in programs? Nobody likes them! They frustrate programmers, users, managers, bosses and other people. The software industry reveals that finding and repairing bugs has cost huge amounts of time and money. Projects have failed because of 'too many bugs' and numerous bugs have created high damages. For concrete examples, just search for something like 'expensive software bug' on the net.
For that reason Obix has been designed from the outset on with a very specific main goal in mind, namely to help writing more reliable code. In practice this means that:
- once your code passes compilation it contains less bugs
- remaining bugs are more quickly detected at runtime
As a result you can expect to reduce development time and costs.
The 'more reliable code' goal is achieved through the following very important Fail fast! Rule which is consistently embedded in the language and the libraries:
Every coding error should be detected as early as possible,
preferably at compile-time, or else as early as possible at run-time.
This rule is important and effective because studies done by prominent companies such as IBM and NASA show that costs generated through software bugs increase exponentially when the bugs are detected late in the software development process. The following figure demonstrates this schematically.
To achieve the goal of early error-detection Obix incorporates a unique combination of over 20 proven and innovative 'Fail fast!' concepts. Some of the most important built-in error preventing concepts are:
- Contract programming (Design by Contract)
- Feature redefinition in child types
- Unit testing
- Generic types without type erasure at runtime
- Objects are immutable by default
- Void (null) values are not allowed by default
Because all Fail fast! concepts are part of the language they work and evolve seamlessly together. They are easy to use and there are no version conflicts or dependencies on thirdparty extensions.
All concepts are fully described in Obix's documentation and numerous examples show why they increase software reliability. To get an overview of the different techniques you can read part II of the Obix tutorial. This part guides you step by step in the development of an example application that creates a random picture based on data provided by people. Here is an example of such a picture, saved in a Scalable Vector Graphics (SVG) file:
Figure 2. Random arcs
... in less time
Besides the number 1 goal (increased software reliability), Obix's web site also explains and gives examples of the two other main goals which are also pursued since decades in the
- increase developer productivity
- simplify the software development process
One example is the tight integration and support of Java software in Obix applications. You can use any existing Java software (.class or .jar files) in an Obix project and data can be easily exchanged between Java and Obix. The following Obix source code snipppet shows an example of a variable declared and initialized in Obix, and then used in Java code:
var string name = "Lisa Simpson" // Obix code java
System.out.println ( "Hello from Obix and Java, " + v_name.java_value() ); // Java code
Executing this code will display:
Hello from Obix and Java, Lisa Simpson
Part I of Obix's tutorial explains Obix's integrated support for easily creating different kinds of applications, ranging from executing a single instruction up to creating a complex web application using Java's servlet and JSP technology. For example, you can create a simple arithmetic calculator 'application' by using Obix's script file facility as follows:
- After installing Obix, create file tests/calculator.osc in Obix's root directory and insert
the following code:
const string input = system.console.ask_string ( "Please enter an arithmetic expression: " )
const any_type output = source_code_executer.evaluate_expression.result ( expression = input )
if output #r void then
system.console.write ( "Result: " & output.to_string )
- Now execute the calculator by entering the following command in Obix's root directory:
on Windows, type
on Linux, type
- When prompted, type any arithmetic expression such as:
( 1 + 2 ) * 3
After pressing <Enter> the result will be displayed:
Obix started as a one-man project. The author is currently looking for people interested to collaborate, in order to improve Obix, create and maintain an open-source community and finally make Obix a mainstream programming language that helps to write reliable production code in less time. You are very welcome to participate. Thank you!
The author appreciates any comments, suggestions or other feedback sent to email@example.com.