Experimenting with Oxygene
Oxygene (pronounced like oxygen) is a programming language by the folks at RemObjects. It is a dialect of ObjectPascal based on Delphi. Normally, I work with C-style languages with all of their brackets, so Oxygene is a bit of a departure for me. I was happy to see that RemObjects “fixed” a lot of the issues that always bothered me with Delphi.
A Modern Pascal?
Oxygene is actively developed by RemObjects, and they seem to have added every modern-language feature to their programming language. If your experiences in Pascal dialects are all from Delphi, you should really give Oxygene a look. Every modern programming idiom can be handled in Oxygene with relative ease.
Here is a list of some of the things that Oxygene updated from its Delphi roots:
- You can declare variables at the point you need them (my favorite update)
- Type inference is supported
- True namespace support
- Nameless constructors and the
- No more
function, now it’s only
- GUIDs are no longer needed in interfaces
- Much more, check it out here
Cross-Platform Done Right?
RemObjects positions Oxygene as the perfect solution for “native” development for multiple platforms. This is a somewhat different take on “native” development than a lot of people have, but it’s perhaps a more accurate definition. The Oxygene compiler targets the standard programming interface run-time for each of the major platforms. It compiles to run directly on the .Net runtime, the JVM/Dalvik VM, or as machine code linked to the Cocoa framework on OS X and iOS. In effect, Oxygene can be thought of as another JVM language, another .Net language, and another Cocoa language all at the same time. It’s cross-platform abstraction at the source code language level.
The closest cross-platform solution to Oxygene is probably Xamarin. Xamarin is a little different, and some of those differences are listed below.
What are the Benefits?
The benefits of using Oxygene are that you end up with an app for each platform that integrates 100%. The user interface will look, feel, and be completly native. With Xamarin, you need the Mono runtime to be distributed with your application. This is not the case with Oxygene.
You can consolidate all of your source code for the three platforms into one single language. Thanks to Sugar, all non-platform-interfacing code can be completely reused between platforms.
Finally, a purchase of Oxygene not only comes with Visual Studio integration, but with a full license of Visual Studio itself! It appears to be on-par with the professional SKU. Even with this, it’s still much cheaper than Xamarin.
What are the Drawbacks?
The first drawback for most people would be an unfamiliarity with Pascal. It’s not exactly as popular as it once was. However, the Oxygene dialect seems easier to come to terms with than Delphi.
The second major drawback is that, because of the need to program to the platform-native APIs, you need to know three different frameworks (.Net, Java/Android, and Cocoa). This comes from Oxygene and RemObject’s core belief that to make native applications, you need to use the proper native API. I agree with this, however, it comes at the cost of less code reuse. The Visual Studio integration of Oxygene is very well done and IntelliSense helps to learn each platform’s API on-the-fly.
I like the idea of cross-platform development done this way. I get to use Visual Studio for all platforms and I am a big fan of consolidating my development tools as much as possible. It’s much cheaper than the Xamarin solution. Also, the product is “more native” than what Xamarin can create with no Mono run-time ever necessary.
For the price of Oxygene ($699), I’m going to give it a shot. Even if I don’t use it for cross-platform development, I can still make native single-platform applications with it. I just need to brush up on my Pascal.