Free Pascal vs Delphi

Shortly after I started working on Enigma using Free Pascal, a free version of Delphi came available. Embarcadero introduced a community edition of Delphi. You can use this edition if your yearly profit does not exceed $ 5000. For the Engima project that is an easy condition as there will be no profit whatsoever. The community edition is a welcome addition to the paid version that will cost you several thousands of dollars.
It is a nice opportunity but I decided to stick to Free Pascal. Why? I do not believe the official Delphi version has essential advantages compared to Free Pascal. The only advantage I can see is Firemonkey, visual components for Android, that are currently not available in Free Pascal. But as I will focus on a Windows version, for now, this is not an important advantage. Free Pascal, however, does have advantages compared to Delphi, mainly its support for Linux. And more importantly: you can rest assured that Free Pascal will be available for some time and will remain free. There is no guarantee that Embarcadero will continue the community edition forever. I still remember the end days of Borland, when a free version of Delphi was discontinued.
So I will place my bets on Fee Pascal and Lazarus.

Enigma: A new project for astrology software

Enigma is a new software project, aimed at astrological research. I just started it and there is not anything to show yet. But if you are interested you might want to follow my progress.
I have been experimenting with software for astrology for a long time and I used quite some programming languages and techniques in the process. Some of these approaches were reasonably fruitful and some were dead ends. But none of them was sufficiently effective for building the kind of application I wanted to create.
I decided to start from scratch again, this time ignoring new and sexy techniques and focusing on astrological functionality. And I will describe my progress in this blog.
This blog is aimed at other developers of astrology software. It will not be useful for astrologers who do not program. And it will also make no sense to developers that are not versed in astrology. I suppose I will have a pretty small audience…

A new start

I terminated all my previous efforts and started again. This time with Free Pascal. The main reason is the support for RAD; it allows me to build User Interfaces in an effective way. It also runs natively, resulting in speedy performance. I need that because Enigma will support analyzing large amounts of charts.
I will use the following techniques:

  • Free Pascal and the Lazarus IDE for coding.
  • SQLite as the database.
  • Swiss Ephemeris for the majority of the astronomical calculations.
  • FPCUnit for unit testing.
  • JSON for exporting data.
  • GitLab as the code repository.

Back to Pascal

I am returning to Pascal and this was my most important decision.
I used Pascal and similar languages like Delphi and Modula-2 for years but that was a long time ago.
Computer programming became my profession and that meant I had to learn some other languages; the major one being Java. I liked Java very much; I used it for my day job and it only made sense to use the same language for my private projects.
But Enigma is a native application and that is not something Java is very good at. OK, you can use Swing or JavaFX. But Swing looks pretty awkward – you can change that but only with a lot of effort – and Oracle has abandoned its support for JavaFX: it will not be part of the upcoming Java 11 release.

Besides Swing and JavaFX, I also tried a solution with a backend written in Kotlin and booted with KTor, a JavaScript UI (using Vue.js), and Elektron to wrap everything in an application. It works but it creates extremely large executables – 100+ Mb for Hello World – and it also involved a lot of JavaScript related techniques. Vue.js is probably the most straightforward solution to a JavaScript frontend (compared with Angular and React) but it still required a lot of effort and additional tools to get a running environment. The JavaScript world changes extremely fast and you need to change along because there are so many dependencies on browsers and additional tools that also change rapidly. How long will Vue.js last?

What to do?

I needed a pragmatic solution and I had some essential requirements.

  • A language should support Object Orientation.
  • It should support Unit testing.
  • A reasonable number of developers must be using it.
  • It should be affordable as my Enigma is non-commercial.
  • It should support an effective way of building a UI.

These were Must Haves. Additionally, there were some Should Haves: preferably no large runtime solution to ship, the ability to access existing compiled libraries without using a port. And of course, the language should be fun to work with.

Free Pascal and Lazarus to the rescue

Based on my Must Haves, two solutions were available. C#  combined with the free version of Visual Studio and Free Pascal with the Lazarus IDE. I used C# once and I was impressed with the language and with the RAD support in Visual Studio. But C# does not fulfill one of the Should Haves: it required the installation of the .Net runtime environment.
Free Pascal and Lazarus, however, do fulfill all Must Haves and all Should Haves. Object Orientation is optional but fully implemented, Unit testing is available, looking at the Tiobe index it still has a reasonable amount of users – about 1% – and the community is certainly very active. It is very affordable (free) and it has excellent support for building a UI based on RAD. Also, the Should Haves are being covered: no additional runtime, easy access to existing libraries, and it sure is fun to work with this environment.

I decided to switch to Free Pascal and Lazarus.

Open Source

Enigma will be free and open source. I consider this important for research software: make everything controllable.
After a 0.0 version is finished I will push the code to GitLab where you can obtain a copy. This version will not be available for regular download: I will make only the source available.
I expect to need at least a year before I can deliver a first more or less useful version for end users.