Arbitrary abbreviations in phobos considered ridiculous

deadalnix deadalnix at gmail.com
Tue Mar 6 10:24:06 PST 2012


Le 06/03/2012 19:08, H. S. Teoh a écrit :
> On Tue, Mar 06, 2012 at 05:38:09PM +0100, Adam D. Ruppe wrote:
>> One of the stumbling blocks on using std.datetime is how
>> many bizarre abbreviations it has.
>>
>> auto time = Clock.currentTime(); // bzzt, wrong
>>
>> if(time - something>  duration!"hours"(4)) // bzzt, wrong
>>
>> writeln(time.toISOExtendedString()); // bzzt, wrong, but this used
>> to work!
>>
>>
>>
>> Why aren't we using real words here? Real words are easier
>> to remember and easier to type.
> [...]
>
> I have to disagree on this one. One of the reasons I hate Java so much
> is because of its gratuitouslyOverlongFullySpelledOutVariableNames.

Let me stop you just here.

Name come in a context. Hence variable names are in a function, that is 
in a class, that is in a package, that is in another package, ..., that 
is in a project.

If you need a very long name to cite something, it doesn't means that it 
should be abbreviated. It means that it is in the wrong place and you 
need to refactor.

When you come up with such a variable name, the code is telling you 
something. « Hey dude, stop here what you do, refactor and put that 
stuff in a convenient place before continuing ! »

Unfortunately, many dev understands it as « Hey, this name is too long, 
let use an abbreviation ! ». No you have fucked up variable name in a 
fucked software architecture.

This happen a lot in java. But remember, 90% of everything is crap.


More information about the Digitalmars-d mailing list