Saturday, November 1, 2025

Main Code >> Singleton >> Interface(s)

This is the Delphi 13 development pattern I am using nowadays:
Call in Main code >> To a Singleton (Primoz G. style page 53) >> To an Interface. This setup keeps my main code very clean and crisp as the call is only ONE line (4 lines if you count definition and begin...end). This case handles 4 different actions identified by the Tag#.
To me the main code is uncoupled and it has no idea what the Interface does (Nick H. must be pleased with that, I am).
The below example results in only ONE call to the procedure that does the work "PU.StampSimple(.....). I am very pleased with the DRY result.

Primož GabrijelčičHands-On Design Patterns with Delphi - Hands-On Design Patterns with Delphi: Build applications using idiomatic, extensible, and concurrent design patterns in Delphi: Gabrijelčič, Primož: 9781789343243: Programming Languages: Amazon Canada

Nick Hodges: Dependency Injection in Delphi - Dependency Injection in Delphi: Hodges, Nick: 9781941266229: Books - Amazon.caDependency Injection in Delphi: Hodges, Nick: 9781941266229: Books - Amazon.ca

 




No comments:

ClientDatasets (Memory tables)

  Blistering fast data loading and processing with TClientDataSet (using Delphi 13, 64 bit, September 2025 release), all records loaded and ...