Blog

Coding Delphi

This blog is about coding Delphi. It’s articles on how to write clean Delphi code, how to handle your legacy code, how to avoid common Delphi tracks and how to do it in a manageable, effective and robust way. Furthermore, there will be tips and tricks how to help your Delphi development team to…

Clean Coding talk

Yesterday I gave a talk on Clean Coding for colleagues at the bank. It’s been a while since I’ve held any kind of talk to anyone, so I was a little bit nervous. That nervousness quickly turned to adrenalin and, I hope, positive energy for the crowd. 40 or so developers and stakeholders. I…

A thing about typecasting

I had a problem with typecasting the other day and had the workings of typecasting explained to me on Facebook. Consider this code: var MyFrame : TAbstractFrame; begin MyFrame := GetSomeFrame() as TAbstractFrame; MyFrame := TAbstractFame( GetSomeFrame() ); end; GetSomeFrame returns a frame of TFrame. So I typecast that result into TAbstractFrame (for whatever…

Frame inheritance

Using frame inheritance, possibly in combination with the frame factory pattern (although that is out of scope for this post) can considerably help you limit dependencies, reduce the number of forms and separate concerns of your application. What’s the difference between forms and frames? Many Delphi programmers use nested forms to structure their applications,…

A comment on comments

Which code is more readable? implementation uses // Delphi units SysUtils, Windows, Classes, // Libraries Lib.Utils, Lib.Settings, Lib.JSON, MainFormU, // Main form unit Settings; // Settings unit procedure TForm.OnButton1Click( ASender: TObject ); var Humpty: THumptyDumpty; begin // Set up a humpty dumpty class and execute it, passing it the personal id, name and what…