[Lazarus] FPReport file names

Michael Van Canneyt michael at freepascal.org
Wed Sep 13 20:17:02 CEST 2017



On Wed, 13 Sep 2017, Ondrej Pokorny wrote:

>
>>> Of course there can be collisions - if it happens you have to resolve them 
>>> with explicit namespaces.
>> 
>> Making the whole point moot.
>
> You can understand namespaces and subnamespaces as a concept for folder 
> structure within code.
>
> Of course you can have every single file in root D:\ and use endless 
> CamelCase names:
> D:\MyCompanyAccounting201705Report1.xls
> D:\MyCompanyAccounting201705Report2.xls
>
> or you can have a decent folder structure:
> D:\MyCompany\Accounting\2017\05\Report1.xls
> D:\MyCompany\Accounting\2017\05\Report2.xls
>
> It's up to you.
>
> The -NSxyz is then similar to "use path" concept. If you see advantages in 
> using folders you just have to admit there are also advantages when using 
> namespaces.

The equivalent of

uses utils;

dcc32 /NSos /NSweb myprogram

in your example is the same as saying "find me Report1.xls, search in D:\MyCompany\Accounting\2017\05  and D:\MyCompany\Accounting\2016\05"

You will get an ambiguous answer.

Which is the whole problem as I was trying to explain.

That said, I use directory structure only to find files faster and group
them logically.

I would still name files in it uniquely. Using your example:

D:\MyCompany\Accounting\2017\05\MCA-Report-201705-2.xls

I will find the file quickly, and the name will still be unique. 
(within reasonable bounds)

Similarly, every field in a database I create is always uniquely named.
So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table.
Graeme Geldenhuys can testify that I use this practice even in very big databases.

For the same reason: to avoid ambiguity.

Michael.


More information about the Lazarus mailing list