Adam’s Sept 2021 Meeting Summary

Agenda

  • Basic Tooling to Continuous Integration (Part1) – Conrad Vermeulen
  • Excel file handling: Excel and Flexcel: The Good, the bad and…. – Dave Martel
  • Nugget: Unit Initialisation Strategies – Rob Lambden

Adam’s Summary

Good kick off chat about Delphi 11. Mostly positive a few “some basic stuff still doesn’t work” comments, mostly related to IDE code completion. Plenty of chat lead off by Jason about email systems, Lorenz very positive about Google and Gmail and an email management tool with amazing capabilities. Richard Hatherall having issues with M$ installations, updates failing. He also had a serious rant about Electron, a simple dialogue-box app absorbing 15 of the 16 cores of his PC!

Basic Tooling to Continuous Integration (Part1) – Conrad Vermeulen

Conrad uses “TeamCity” a JetBrains product (https://www.jetbrains.com/teamcity), for CI. This has a free version which is very functional, and professional versions are not hellishly expensive. The concept is a tool which monitors a code repository and checks files for updates or monitors via other rules such as dates / times TeamCity undertakes programmatic actions such as building projects, running tests, copying files etc., a whole range of complex build events. The tool is highly developed and can generate detailed build-logs and has many other features.
Essentially TeamCity allows you (if your code is well written enough!) to allow you to forget about the “build-test-deploy” sections of a coding work-stream. Once you have written the code TeamCity takes it, tests it, if it passes builds it, copies it to deployment locations, makes backups etc., freeing developers up from a lot of the work-a-day steps in the development process.
TeamCity is very “webby” with a Browser-based interface that feels a lot like Amazon, Azure and other web-management utility programs. It is very highly featured including many useful hard-to-do features such as the ability to rewrite DProj files to allow easier multi-platform compilation.
Conrad mentioned alternative tools which do similar jobs, including GitHub Actions, Delphinius, BOS (?) but he prefers TeamCity. He builds his project including extensive DUnitX testing, and hosts the resulting project on GitHub which allows multiple developers to feed into a single project.

Excel file handling: Excel and Flexcel: The Good, the bad and…. – Dave Martel

Dave has been generating complex customized charts in Excel for many years using Delphi. His company build complex machines which generate detailed microscopic data about computer chips (among other things) this needs to be represented visually for management and analysis. The customers all use Excel, so for decades this has been the chosen platform for development of these chart reports.
Dave spoke in deep, useful detail about the complexities of automating Excel, particularly with issues relating to the multiple versions of the product which exist and “upgrade hell” where some users install Excel 2025 while others are still using Excel 95.
In the past Dave used Delphi’s built in OLEVariant classes which allow a Delphi App to talk to other applications in windows. These are powerful but difficult to use as the OLEVariant object is not strongly classed, so there is no code-completion and this being a Delphi tool the documentation is very thin on the ground. He has also used the “TExcelWorkbook” component in place of the OLEVariant. This is a class provided in Delphi, within the ExcelXP.pas source file, by using it you get code completion and about 2x faster run-times, but errors can occur, which can be hard to debug.
Dave started by showing how to record macros in Excel and then convert the VB Script they generate into Delphi code to generate Excel files with both OLEVariant and TExcelWorkBook classes. This was a useful insight into the nuts and bolts of how to run through this type of typical work-a-day process effectively.
Dave had tested TMS’s Flexcel code-base in the past, and found that while it was excellent it did not have the customization features he needed for graphs and charts.
Recently Flexcel has been significantly upgraded and he is now very happy with it. His session was a well laid out explanation of what a great tool it is. The only downside seemed to be the usual issue that when you use third party code-libraries you have to get used to their working and coding practices.
A really good tip was the APIMate tool provided by TMS, which converts Excel sheets into Delphi code instructions. Dave gave a really useful extensive demo in which he used APIMate to generate pascal from an Excel sheet and then showed how this could be extended and customized.

Nugget: Unit Initialisation Strategies – Rob Lambden

Initialization & Finalization sections do not exist in C++, Rob’s original coding language. They are generally used to create singletons, class factories and to extend registries at program start up, and to clean up these instances at shut-down.
Initialization & finalization sections of PAS files are not linked to programmatic objects but should be called “in order” depending on the order of initialization of the code they contain. Delphi says initialization should be called recursively so any USED unit will always have its initialization run prior to the calling source. But this is not what happens.
If your code uses initialization extensively this can be a real issue, as global objects created in initialization sections cannot be guaranteed to exist when called by other units.
Rob demos this happening. He clearly shows a module getting initialization call prior to a unit that it uses, real proof that the Delphi compiler does some seriously strange things sometimes.
This was a really useful proof of an issue in Delphi which could give programmers a hellish time debugging, as it is rare to have to deal with bugs at the level of compiler bad-behaviour.
In order to get around this issues Rob has written his own initialization object which he can add to his own programmes. This allows him to achieve the same goal he had wanted to achieve with initialization and finalization sections.
Rob talked about how he has coded this, and showed it in operation, with really useful detailed Delphi pascal code. These felt like useful code-objects to me (although I do not really use initialization and finalization at all). It would be great to request whether he might consider putting them on the group Git Repo.