[TYPO3-50-general] Common namings for variables with path-content

Malte Jansen mail at maltejansen.de
Mon Jan 12 10:21:34 CET 2009


Hi Robert,

Robert Lemke schrieb:
> Hi Malte,
> 
> Am 11.01.2009 um 19:41 schrieb Malte Jansen:
> 
>> If you have a variable-name, sometimes it is unclear what the variable
>> realy contains, because of double meanings.
>>
>> There several names for a "path" aka "folder" aka "directory"
>>
>> directory:
>> An absolute path, which must exists. (PHP: is_dir() === TRUE)
>> e.g. is_dir($someDirectory)
>>
>> path:
>> Might be a relative path or a path which might not yet exist.
>> You have to "manipulate" the variable-content to achieve a
>> directory/absolute path (PHP: is_dir() === TRUE).
>> e.g.
>> is_dir($someDirectory . $somePath)
>> is_dir(realpath($someRelativePath))
>>
>> folder:
>> Normally just used in the windows95-world. Shouldn't be used.
>>
>> It would be nice if you always know what kind of path it is, without
>> looking at the API or the code.
> 
> I suggest the following wording:
> 
>  - "path"
> 
>    Usually an absolute path in special cases relative. A path leads to
>    directories and files and is used as a prefix. It always ends with
>    a trailing slash.
> 
>    Example:
>       "/usr/local/foo/bar/" is the path leading to the file 
> "/usr/local/foo/bar/baz.txt"

so for a fileName with path: "file".

> 
>    To clearify the value, also "absolutePath" or "relativePath" can be 
> used.
Shouldn't it be used for the FLOW3-Constant-Path
> 
>  - "directoryName"
> 
>    Name of a directory, without slashes.
> 
>    Example:
>       "foo", "bar"
> 
>  - "fileName"
> 
>    Name of a file, including extension
> 
>    Example:
>        "myCrazy_weird.file.txt"


> If a directory exists or not doesn't play a role IMO.

You don't have to check the value, if you know it exists.


--

So for the class-part, would suggest:

namespace F3\MyPackage\;
class MyClass {}

=> "className" == MyClass
=> "class" == F3\MyPackage\MyClass  (PHP: __CLASS__)


Cheers,

Malte


More information about the TYPO3-project-5_0-general mailing list