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
- Inline
if
,case
, andfor
expressions - True namespace support
- Nameless constructors and the
new
operator - No more
procedure
vsfunction
, now it’s onlymethod
- 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.
Conclusion
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.
Of course, they now have RemObjects C# so you don’t need to use Pascal to get the same benefits.
Hi, i would like to know about your last year experience with Oxygene… Im considering using it, im an old school pascal/delphi developer so the idea of an evolutionary pascal language aproach sounds really nice, and the easy integration with the Visual Studio IDE is good…. ANyway any wisdom from experience would be appreciated. 😉
I have nothing but good things to say about Oxygene and also the company RemObjects. I like working in Visual Studio much more than RAD Studio. The language improvements are stellar. Declaring variables inline with code is an improvement that I absolutely love and this improvement alone is enough reason for me to pick Oxygene over Delphi. I believe that Embarcadero/Ideira should license (or whatever they need to do legally) these language improvements to modernize Delphi. Oxygene also gives you better platform integration with Windows, Android, and OS X/iOS/etc since you target their preferred developer platforms. The downside is that some of your code will need to be platform-specific. With well-structured projects, this isn’t much of a problem.
The guys at RemObjects, even though it is a small company, have been very responsive. I’ve found a couple of bugs, reported them on their forums, and they have responded and fixed the bugs very quickly.
Great news! Thanks for your comment. So that inspire me to consider it a little more seriously. Any experience with Oxygene and Android? And what about Databases, delphi make it really simple to develop data related apps. Again… thx for your quick reply 😉
You’re welcome! Sorry this reply was a bit slow. I’ve been away from my computer.
I’ve got limited experience with Oxygene and Android, but it has been good experience. You’ll still want to have Android Studio installed and Oxygene provides a way to edit UI files in Android Studio. That integration works pretty well and it’s only needed if you want to use Android Studio’s GUI editor. Other than that, it’s just a matter of using the Android API exactly as-is, but from the Oxygene language. I’ve found translating Java sample code to Oxygene code is pretty trivial. Also, I believe Oxygene provides a “paste as Oxygene” function to paste Java code and convert it to Oxygene for you, but I haven’t used that feature.
I don’t have much experience with n-tier databases. My projects only ever need SQLite and I just use it directly (from both Oxygene and Delphi). I can’t help you out here much, but I do know that RemObjects has a product for this type of thing called Data Abstract.
Hope this helps!