Namespaces in Delphi

Posted by Kirby Turner on October 25, 2006

Recently there have been some good postings about using namespaces in Delphi such as the ones here, here, and here. I like how namespaces are implemented in Delphi but I have been slow to adopt them in my Delphi code (especially Win32 code). The problem I have is that the BDS Project Manager has no collapsible view, or grouping for namespaces. Instead, Project Manager lists the unit names. My namespaces tend to be wordy which means I cannot easily see the unit name without making the Project Manager window very wide.

It will be great if the next release of BDS provides some sort of grouping of namespaces within the Project Manager. For example, each segment in the namespace could be represented as a folder that can expand and collapse. And the contents of the folder would be the final unit name or additional namespaces contained within. In other words, the Project Manager would look something like this when the following units are included:

Units:

WhitePeakSoftware.Data.DataProvider.pas
WhitePeakSoftware.Data.Providers.SqlProvider.pas
WhitePeakSoftware.Data.Providers.SqliteProvider.pas
WhitePeakSoftware.Net.MailClient.pas

Project Manager:
<pre>
ProjectGroup
- MyProgram.exe
+ References
- WhitePeakSoftware
- Data
- Providers
- SqlProvider.pas
- SqliteProvider.pas
- DataProvider.pas
- Net
- MailClient.pas
</pre>

There is already a feature request in the QC that asks for namespace grouping. Please vote for this feature if you are using namespaces in Delphi and you would like to see some type of namespace grouping.


Posted in programming. Tagged in delphi.


Related Articles