Re: Correct file naming

From: Steve Troxell (steve_troxell_at_hotmail.com)
Date: 05/23/04


Date: Sun, 23 May 2004 16:49:35 -0400

Matthew Marsh wrote:
> I am interested to see how others would save and name the following
> Delphi files-

I prefer postfix notation for files names because in a sorted list, it keeps
files grouped together when they are related by function.

SearchForm; SearchFrame; SearchDialog <-- for the UI code
Search; SearchClass <-- for the non-UI code
SearchTests; SearchClassTests <-- for DUnit tests of the searching code

I have a lot of common code shared by multiple projects. Any one project
might be composed of 30% - 60% code which is reuseable by other projects.
For example, if the search units above were part of a project called FooBar,
I'd have:

fbSearchForm
fbSearch
fbSearchTests

Files which are reusable among multiple projects all have a common prefix;
in my case it's a company name abbreviation:

krConnectDialog
krUtilStrings
krUtilSystem
krErrorDialog
krExpressionBuilder

Again, in sorted lists of filenames, this helps separate the project code
from the shared code...usually I am working more frequently within the
project code. Also, in any given unit it is a visual reinforcement when I am
working in a reusable unit and need to think twice about what kind of code
goes in that unit (nothing project-specific). Finally, in USES clauses it
helps me pick out my units from the Delphi units and, more to the point, the
huge number of third-party units used by the project.

I have exceptions for certain commonly referenced project-level files:

AppMainForm
AppDataModule
AppCommon <-- global project-specific types, consts, variables, functions,
procedures.

This has the advantage of keeping these more-or-less "global" entities at
the top of sorted lists.

> I thought you only used abbreviations ( 'frm' ) for component names
> and not file names.

No rules; do what makes sense to you and helps you.

Steve Troxell



Relevant Pages

  • Re: The Value of Delphi Training
    ... > technology to not have any experience or certification in the subject. ... Those of you who have taught classes in Delphi, how common is it ... > you are teaching a course in D8, for example, how common is it for you to not ...
    (borland.public.delphi.non-technical)
  • Re: Is Ruby On Rails, Delphis lost cousing?
    ... but it has a good deal in common with Delphi and C++, too, and a ... Java, does it? ... Delphi for .NET, I don't think you're talking about C# at all, really. ... I agree that the .NET framework has quite a bit in common with the ...
    (borland.public.delphi.non-technical)
  • Re: Another newbie question
    ... Can someone perhaps provide a link to common variable naming methods in Delphi? ... I think you'll find in many strongly typed languages the use of hungarian has been deprecated for some time now, be that Delphi or VB.NET, etc, etc. ...
    (microsoft.public.vb.general.discussion)
  • Re: Generics for Delphi
    ... might have in this group is limited to whatever is in common with TP <= ... Given that you now know my limitations, ... With respect to Delphi, what are "generics"? ... understandable explanation in a chapter titled 'Generics' from the book ...
    (borland.public.delphi.non-technical)