Arbitrary abbreviations in phobos considered ridiculous

foobar foo at bar.com
Wed Mar 7 11:37:00 PST 2012


On Tuesday, 6 March 2012 at 18:22:03 UTC, deadalnix wrote:
> 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.

I fully agree. More over, Java's verbosity problem often comes 
from redundant repetitions in the language itself such as:
MyWonderfulClass instance = new MyWonderfulClass(); // class name 
repeated

The Java/C# naming conventions themselves are wonderfully 
consistent and easy to remember/type (especially in an IDE like 
Eclipse that knows to match "MWC" to the "MyWonderfulClass").
I honestly believe that people who use horrible C/Unix like 
conventions should not be allowed to touch a keyboard.

At my previous work I had the "pleasure" to use legacy code in C 
and Fortran. One time I needed to figure out how to do something 
and was pointed to an ancient function who's name was an 
undecipherable 5 letter abbreviation,  probably written by 
someone who retired long ago. luckily it had comments, *but* the 
comments themselves were also fucking abbreviated! This is truly 
the most evil way to torture future junior programmers who will 
be unfortunate enough to inherit your code.

So no, abbreviations are *NOT* acceptable. Haven't we suffered 
enough?


More information about the Digitalmars-d mailing list