Categories
Product Review

Oxygene – Review

Recently, Embarcadero has released their new Delphi XE5, which has iOS support (and will have Android by the end of they year) as part of a Mobile Pack.

I have used Delphi since the first beta (and earlier, I used Turbo Pascal), and given how tablets and smartphones are more and more surpassing the numbers of PCs, I am naturally interested in my options.

But one other option for Object Pascal fans is Oxygene – a RemObjects product that was sold for a few years as Delphi Prism.

Language

So, what are Oxygene's advantages vs Delphi? To start up, the language has a bunch of really, really cool features – such as:

– Future Types – you assign a variable, and the value is calculated in a separate thread – it only blocks execution if you need it before the calculation is done.

– Parallel Loops – for parallel i:Integer :=0 to 10 do will complete the work of the loop in multiple threads, automatically.

– Asynchronous statements

– Class contracts – for those that are not familiar, contracts add pre and post conditions (as well as invariants) to a method, so that you can guarantee that all input and output went as predicted.

– Colon operator – calls member if not nil – object:a:b just returns nil if any of them are nil. This saves a lot of conditionals testing for nil at each step.

– declaring variables (and assigning!) as they are used – very useful for smaller variable scopes, which really help readability.

Oxygene also comes with a converter for Delphi, C# and Java code. It is not perfect, but it is quite helpful, and depending on the code it might work right away with no changes required.

Components and Platforms

Oxygene already has support for native compilation to .Net (Windows as well as Mac and Linux via mono), Java (including Android) and Cocoa (iOS and Mac OS X). Note that support is fully native, not through a library as Delphi uses Firemonkey. The advantage of that is that every control is fully native, and you can use any library or component.

However, that has the disadvantage that you will be doing a new UI for each platform you target. And you will need to learn how to program to each of those, as they are quite different.

Oxygene has a clear advantage as far as components go – most (if not all) .Net components will work seamlessly. If you use Delphi and Firemonkey, your choices are extremely limited (although TMS Software has released a few nice ones).

And I am afraid that Firemonkey components might never show up – specially for developers that went through Kylix (such as Developer Express, who took a huge loss developing for it and only getting tiny amount of sales as a result) and Delphi.net – products that only lasted a few years.

Speaking of TMS Software, they have released Firemonkey components that have native Mac and iOS control sets. Of course, at this point, you are back to developing several different UIs.

Price

As far as price goes, here in Brazil Oxygene has a clear advantage. The product with support to all platforms is available for US$700 (ask sales for your Delphi cross-grade price, specially if you have a Prism license!).

Embarcadero Brazil only provides prices through quotes (and I can't see the US prices through their sites).

The quotes I have received for the Pro version with the Mobile Pack comes to US$2380 (or US$1650 for the Pro upgrade plus Mobile Pack). Ouch!

IDE

Oxygene comes with Visual Studio Shell. I only used it briefly on my Oxygene trial, but I have always heard great things about it. In my minimal testing, it loads up pretty fast (around 15s). I have tried a few of the included samples, and they all compile in a few seconds. Intellisense is much, much faster than what I usually get on Delphi.

It takes quite a while to install, but probably less than Delphi XE3 did (I didn't measure it). Needed a few system restarts, so it couldn't just be left unattended.

Refactoring support on Oxygene currently has only a Rename refactoring. Delphi has plenty of refactorings available, plus extra from third-parties such as Castalia or ModelMaker Code Explorer. I have used both of these and they are pretty good – the built-in Delphi refactoring often fails for me.

Mobile – Android and iOS

After installing the Android SDK, it is very easy to compile Android apps in Oxygene. You just do a build normally and the APK and JAR files are created in a matter of seconds. You can copy the APK to your Android device and use it right way, or run it in the emulator – which works well but is really, really slow. It is usable for simple programs, though.

I didn't test the iOS part – it requires a Mac. I imagine a service like MacInCloud would work, too.

Documentation

Oxygene documentation is weak. They have a wiki, but it is clearly a work in progress. Of course, except for the specific language stuff you should be able to use .Net (or Android/Cocoa) books, of which there are plenty. I have only seen Bob Swart‘s books for the latest Delphi versions (they are good, though).

Conclusion?

Frankly, so far I have no idea which one to choose.

Oxygene already supports native Cocoa/Android, as well as Linux/Mac via mono. They have a clear advantage on components for Windows. Documentation seems weak. They are also bound to get new tech from Microsoft simply by being .Net – which also helps on framework documention (Microsoft Documentation, as well as .Net books).

BTW, Hydrogene is a related product to Oxygene. It isn't public yet (however, I asked sales, and they told me what it is) but the idea is very good and I imagine it will be big.

[box type=”info” style=”rounded”]Update (31/Mar/2014): It is now public, and Hydrogene has a new name: RemObjects C#. It is a C# compiler just like Oxygene that compiles natively to iOS/Mac/Android and .Net. And you can mix and match (for example, if you already have Pascal code in Oxygene, or if you have experienced C# programmers) modules in both C# and Oxygene.[/box]

Delphi's advantage for me (and I imagine, for many interested in Oxygene) is that I am already well familiar with it, having used it for many years. I have tons of components as well as several programs released using it. Not having to learn about Cocoa or Android to develop for them is also a major plus. No talk of Linux support so far, though.

I'll update this review as I learn more.

Update (07/Oct/2013): I have been reading on the wiki and there are a ton of other language features. Here are some I particularly liked:

-extended constructors: create new objects and assign to fields at once – with p := new Point(param1, param1, x := 10, y := 20) do.

– Case with strings and case with types

– if and case expressions – inline, like ternary syntax but with case support too:

MessageBox.Show( (if SingleUser then
‘Are you sure you want to remove this user?'
else
‘Are you sure you want to remove these users?'),
MessageBoxButtons.YesNo)

and

result := ‘text: ‘ + case aValue of
0: ‘none';
1: ‘one';
2: ‘two';
3..5 : ‘several';
else
‘many';
end;

– Duck Typing/Soft Interfaces – basically allow you to use any class that has the same methods as the interface as if it was the interface (without having it implement the interface formally). Can also work even if not all methods in the interface are implemented, but then it is not type-safe at compile type.