Quote Originally Posted by dj_sharp View Post
Now consider another situation:
Programmer has a unit named Geometry. The game engine includes a unit named PGD_Geomerty. There most likely will be no unit name conflict ever.
Even if both units contain equally named type, like TVector, then the programmer will be able to refer both of them like:
Geomerty.TVector and PGD_Geometry.TVector. Such type name conflict is even more unlikely to occur if you consider that some units use Geometry, other units depend on PGD_Geometry, but it is likely that there are no units which depend both on Geomerty and PGD_Geometry unit.

That is why I suggest using prefix for unit names, but not for type names
Now you consider this situation:
As you suggest you have two units. One is named Geometry and another is named PGD_Geometry. Both of them contain equaly named type TVector.
In unit geometry TVector is defined like so:
Code:
type
  TVector = record
    X1: Integer;
    X2: Integer;
    Y1: Integer;
    Y2: Integer;
  end;
In unit PGD_Geometry TVector is defined like so:
Code:
type
  T2DPoint = recod
    X: Integer;
    Y: Integer;
  end;

  TVector = record
    P1: T2DPoint;
    P2: T2DPoint;
  end;
Now you don't have any unit which would use both Geometry and PGD_Geometry at the same time so you don't have any problems with naming conflicts.
But you are using these TVector-s in two different units. One uses Geometry and other uses PGD_Geometry.
Now tell me this when you are writing codein any of these units how do you know which TVector type definition are you using. Yes you are using only one and compiler will always know which one. But how will you know which one are you using in that particular unit.
Sure you could add unit name before type so you use Graphics.TVector or PGD_Graphics.TVector so it would become perfectly clear which definition are you actually using. But that is almost the same as if you are using type prefixes in the first place.

So you see general advice is to use prefixes for both unit names and type/class names.
Prefixes for unit names can be longer like PGD_Comunity_Engine_Graphics.
But prefixes for type/class names sould be short ones. Preferable prefix size for types/classes is 3 characters or less where 5 chareacters long prefixes are considered the largest allowed.