Quantcast
Channel: Cape Cod Gunny - Michael Riley
Viewing all articles
Browse latest Browse all 141

Delphi Tip of the Day - What is the "A" prefix I see used on parameters?

$
0
0
Today's Delphi Tip of the Day is all about consistent naming conventions. Consistency in the Delphi and Object Pascal language makes it easier to read and comprehend the code.

I have often wondered why the "A" prefix is used on Delphi parameters. Instead of just accepting it as some esoteric thing as I have done for the past twenty years, I googled around and found an answer. Have a look at the following code snippet:
constructor TPerson.Create(AFirstName, ALastName: string);
begin
FirstName := AFirstName;
LastName := ALastName;
end;
The "A" in "AFirstName" and "ALastName" denotes an Argument as in the above constructor code example.

Typical naming conventions that are used are:
A := Argument
F := Field
T := Type
E := Exception
I := Interface
L := Local Variable
G := Global Variable
The key is to be consistent in all your code. If we as a Delphi community are consistent then it makes it much easier to communicate with each other.

#delphi#tipoftheday#capecodgunny

Enjoy,
Gunny Mike
https://zilchworks.com


Viewing all articles
Browse latest Browse all 141

Trending Articles