Don’t put your publics where your privates should go

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, System.Classes, System.Variants, 
  FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls;

type
  TContentFrame = class(TFrame)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

end.

Granted, the discussion of clean coding wasn’t as well known then as it is now, but ever since the first time I created a unit in Delphi some 20 odd years ago, I have wondered how the thinking went for that guy that day.

-‘Hmm, what if the developer thinks he can put his publics where his privates should go? And worse still, what if he puts his privates where his publics are?’

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.