Refactoring is part of every task
Think of refactoring as the equivalent of washing your hands after using the restroom. It’s just something you always do as a matter of common decency.
Think of refactoring as the equivalent of washing your hands after using the restroom. It’s just something you always do as a matter of common decency.
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…
I like using the Indy components when working with all sorts of internet things, but unfortunately documentation is scarce at best. So I spend hours on hours trying to find some hint as how to do things. Just lately I needed to get SSL working with my REST server for a specific service I…
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,…
Quite a few years ago I landed a Delphi assignment to, among other things, develop a media injector application for a Swedish television broadcaster. It would be part of a much larger system, and its responsibility was to move different clips of mp4 files from one place to another according to a time schedule…
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…
Writing code is much like writing a book. There is the intrigue, the story, the chapters and paragraphs. It’s all there. But there’s often one thing lacking in code that no self-respecting author of a book would ever do without; Readability. An author that want people to read his books has to – on…
When Steve Jobs and his team finished work on the Macintosh, they fetched a piece of paper and had everyone on the team sign it. So hard had they worked on the new computer, and so proud of the finished product were they that Steve wanted a statement to show it. So he made…
Somewhen around 1998 or so some guy at Borland decided that developers are a stupid bunch of people and need the absolutely obvious clarified, so he or she decided to add comments to the unit template to explain where the private and the public declarations should go. unit ContentFrameUnit; interface uses System.SysUtils, System.Types, System.UITypes,…
I use GUIDs a lot. In the case of primary keys, always. But I’ve often asked myself what value to use for an empty GUID. A googling reveals the answer: In the Types unit, there’s a GUID_NULL constant. Who’d know that? Well, now you do.