Board index » kylix » Unit Naming convensions

Unit Naming convensions


2005-05-09 09:36:21 PM
kylix2
Hi,
How do you name your units?
I do the following.
I always use a 'U' prefix in front of the unit name (almost like 'T' for
a classname)
If the unit is a form unit i.e. has a xfm then I call the unit
'U' + <formname>.pas e.g. UfrmMain.pas
If the unit is not a form unit then I use a project/company abr. prefix
after the 'U' prefix. as in 'U' + 'proj/company' + <unitname>.pas e.g.
UabcTypes.pas
A different convension I can think of is to loose the 'U' and always use
the proj/company prefix in Caps e.g. ABCDETypes.pas, ABCDEfrmMain.pas, etc.
Also, for a case sensitive OS like Linux, it is perhaps a good idea to
use only lower case letters?
Any other better suggestions? I am willing to addapt :)
siegs
 
 

Re:Unit Naming convensions

On 2005-05-09, SiegfriedN < XXXX@XXXXX.COM >wrote:
Quote
How do you name your units?
Just give them sound names. Sometimes if a bunch of unit belongs together
(e.g. a subsystem) they get a common prefix.
Quote
Also, for a case sensitive OS like Linux, it is perhaps a good idea to
use only lower case letters?
And I always use lowercase letters. This makes copying with wildcards under
*nix a lot easier.
Quote
Any other better suggestions? I am willing to addapt :)
Don't bother, not much to gain with such details.
 

Re:Unit Naming convensions

I always use these notations:
For conventional proceures and functions ???Lib.pas
For classes, components, and other types. ???Typ.pas
For variable and constants ???Var.pas
For forms and frames ???Frm.pas (form names will be F???)
??? means main purpose of unit.
Hür AKDÜLGER
"SiegfriedN" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,

How do you name your units?

I do the following.

I always use a 'U' prefix in front of the unit name (almost like 'T' for a
classname)

If the unit is a form unit i.e. has a xfm then I call the unit
'U' + <formname>.pas e.g. UfrmMain.pas

If the unit is not a form unit then I use a project/company abr. prefix
after the 'U' prefix. as in 'U' + 'proj/company' + <unitname>.pas e.g.
UabcTypes.pas

--

A different convension I can think of is to loose the 'U' and always use
the proj/company prefix in Caps e.g. ABCDETypes.pas, ABCDEfrmMain.pas,
etc.

Also, for a case sensitive OS like Linux, it is perhaps a good idea to use
only lower case letters?

Any other better suggestions? I am willing to addapt :)

siegs
 

{smallsort}

Re:Unit Naming convensions

Marco van de Voort wrote:
Quote

Don't bother, not much to gain with such details.
To me it starts to matter when you have a variety of applications. I
guess a different directory sorts it out, but for example having 3rd
party component libs each lib unit needs to have a unique name.
Another thing, when you have a client and a app server in the system the
unit names could differenciate between the client and the server as well.
I have units with 'base' classes, utils - common to all apps which I
prefix with 'PEX' in this case.
I just wanted to know if there was a standard people use - i.e. I do not
necessarily want to enforce my way of doing things when there was not a
proper naming system before..
Siegs
 

Re:Unit Naming convensions

On 2005-05-10, SiegfriedN < XXXX@XXXXX.COM >wrote:
Quote
Marco van de Voort wrote:
>
>Don't bother, not much to gain with such details.

To me it starts to matter when you have a variety of applications. I
guess a different directory sorts it out, but for example having 3rd
party component libs each lib unit needs to have a unique name.
Sure. But IMHO a best effort is the best solution, and resolve the few
problems by hand. Complicated systems have the disadvantage that everybody
has its own little system, and you end up with a bunch of different systems.
Quote
I just wanted to know if there was a standard people use - i.e. I do not
necessarily want to enforce my way of doing things when there was not a
proper naming system before..
Nope. I think if you want this you really want namespaces for units. (I don't,
since that opens up a whole different can of worms)
 

Re:Unit Naming convensions

f* - prefix for forms. d* - for data modules. u* - for function and
interface libraries. c* - for class declarations.
An examples:
fPersonSelect.pas contain form that is able to select person from the list
of persons.
dUsers.pas contain data module which most likely manipulate with table of
users.
uFileUtils.pas useful utilites for handling of files.
cPerson.pas declares a class named TPerson.
"SiegfriedN" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,

How do you name your units?

I do the following.

I always use a 'U' prefix in front of the unit name (almost like 'T' for a
classname)

If the unit is a form unit i.e. has a xfm then I call the unit
'U' + <formname>.pas e.g. UfrmMain.pas

If the unit is not a form unit then I use a project/company abr. prefix
after the 'U' prefix. as in 'U' + 'proj/company' + <unitname>.pas e.g.
UabcTypes.pas

--

A different convension I can think of is to loose the 'U' and always use
the proj/company prefix in Caps e.g. ABCDETypes.pas, ABCDEfrmMain.pas,
etc.

Also, for a case sensitive OS like Linux, it is perhaps a good idea to use
only lower case letters?

Any other better suggestions? I am willing to addapt :)

siegs