Oxygene for Delphi Developers
If you're a Delphi user looking to get into Oxygene, either to expand your tool belt or to move to the more modern cross-platform Pascal dialect altogether, then you have come to the right place!
This page collects all the information you need to get started, will let you explore the differences (and similarities) between Delphi and Oxygene, and provides you with a unique look at what makes Oxygene great, from a Delphi user's perspective.
The Language
It is probably safe to assume that one of the reasons you are here is that you love the Object Pascal language.
The good news is that Oxygene is pretty much the same language that you already know and have used for years with Delphi — it is just vastly extended with additional features (such as Future Types or Class Contracts) and small things that make life easier, like the Colon Operator or Double Boolean Comparisons).
It also cleans up a few minor idiosyncrasies and inconsistencies in Delphi's Pascal dialect to make the language (in our opinion) a bit cleaner and more consistent. Some of these idiosyncrasies can be restored by enabling the Delphi Compatibility Settings.
Read more:
- Minor Language Differences compared to Delphi – explores the minor "cleanup" changes to the language. Things you want to be aware of as you start coding, or as you port existing Delphi code over into the future.
- New Language Features compared to Delphi – gives you an overview of the major features Oxygene offers over Delphi's Pascal dialect. This covers all the big new things Oxygene introduced over the years – features you dont need to worry about for now if you are just getting started, but that will come in handy once you become more familiar with them.
Get to know some key concepts that differ in Oxygene:
- Namespaces and References – sometimes they match, sometimes they don't. Learn more about these two related concepts.
- Namespaces Vs. Unit Names – The =
usesclause in Oxygene pulls in whole namespaces, not single units. Find out what that means. - Object Lifecycle Management with GC and ARC – say goodbye to
try/finally/Free.
Finally, the following are a few articles to help get Delphi developers acquainted with the GUI frameworks used by Oxygene:
- Delphi to Oxygene: Windows UI Development with WinForms and WPF
- Delphi to Oxygene: iOS UI Development with UIKit
- Delphi to Oxygene: Mac UI Development with AppKit
- Delphi to Oxygene: Android UI Development
How To Upgrade/Migarte Your Code
Two ways! First, just try importing your project and recompiling. Seriously, that's it! File|Import in Water (or Fire on the Mac) lets you import your project or project group; if you haven't done so already, it will also prompt to import the Delphi packages know as the 'Delphi SDK'.
Second, Oxygene also includes a great tool called Oxidizer that lets you import legacy Delphi code into your Oxygene project, and have it adjusted to the above-mentioned idiosyncrasies automatically. Oxidizer can convert code as you paste it from the clipboard, or import entire units into your project.
- Using Oxidizer to Import Legacy Delphi Code
We strongly encourage you to try and not enable Delphi Language Compatibility for your Oxygene projects, but instead get used to the (few, small, and very sensible) differences. Over time, you will come to appreciate them for making the language cleaner.
The Delphi Language Compatibility option is provided mainly for developers who want to share code between Delphi and Oxygene, but it can also be useful to get started with a large codebase that has many "Delphi-isms".
The IDEs
Oxygene is fully integrated into Visual Studio. However, but we also have two IDEs dedicated to Oxygene and the whole Elements framework:
- Fire, for coding on Mac
- Water, for coding on Windows
These are built from the same codebase and use native UI on both platforms. You can read more about them here.
The Frameworks
When Delphi was first released in 1994 — over twenty (30!) years ago now — it introduced the VCL, a much-needed feature that made Delphi what it was. Back then, programming to the Windows API was painful, as the API was procedural and based on C functions, and using a powerful abstraction layer such as the VCL was much preferable to manually dealing with object handles and writing long case statements to handle window messages.
But in the past 20+ years, the computing landscape has changed, and all of today's platforms come with vast, powerful, and mostly easy to use, consume, and extend frameworks that don't need further abstraction and are in fact hindered by unnecessary abstraction attempts.
-
On Windows, despite what some naysayers like to make you believe, the .NET Framework has become the de facto standard for creating applications, services, and any other kind of application imaginable. With over 10,000 classes and types, the .NET Framework Class Library provides well-designed APIs for just about any need you may have, and third-party libraries, commercial and open source, are there to fill any remaining gaps.
-
Java, too, comes with a vast set of libraries for all imaginable purposes, and on Android, the Java-based APIs provided by the OS in the Android SDK are the default "native" way to develop for the platform (Google in fact discourages the use of the C++-based "NDK" for all but corner cases like the device driver – but the NDK is of course supported by Oxygene, as well).
-
And then there are of course Mac, iOS and their siblings where the extensive, object-oriented Cocoa libraries actually are part of the operating system and its default API. Like the other two platforms above, the Cocoa frameworks provide an unprecedented wealth of well-designed classes and APIs that let you accomplish anything you want on iOS and the Mac.
-
For sharing non-UI business logic code between platforms, our own open source Elements RTL library provides access to commonly used classes and APIs in a cross-platform way with toll-free casting.
The biggest step in adjusting to Oxygene when coming from a Delphi background is the realization that there is no need for a wrapper framework like the VCL to make the OS APIs accessible, because the platforms already come with amazing libraries that, once you get used to them, you will love.
That said, when targeting the native Windows, macOS, and Linux platforms with our Island Compiler Back-End, you have the ability to reference all your existing Delphi packages, giving you optional access to the Delphi RTL, VCL, and all the other APIs that come with Delphi, as well as your own and third party packages. You can read more about that option here.
The Platforms section of this site is dedicated to these libraries, and while most of the actual documentation for them can be found on the platform vendors' sites (the great thing about not having a wrapper framework is that you can use the platform straight from the horses mouth), it will give you an introduction and tips on how and where to get started.