Arbitrary abbreviations in phobos considered ridiculous

James Miller james at aatch.net
Tue Mar 6 14:50:17 PST 2012


On 7 March 2012 10:30, deadalnix <deadalnix at gmail.com> wrote:
> Le 06/03/2012 21:00, Timon Gehr a écrit :
>
>> On 03/06/2012 07:13 PM, Alex Rønne Petersen wrote:
>>>
>>> (Also, seriously, I think you're over-dramatizing the Java variable
>>> naming thing; I rarely see names that are as bad as you claim...)
>>>
>>
>> It is not only about single names, but also about how many times you
>> have to spell them out in short intervals.
>>
>> try{
>> SqlConstraintViolatedExceptionFactoryWrapper
>> sqlConstraintViolatedExceptionFactoryWrapper = new
>> SqlConstraintViolatedExceptionFactoryWrapper(new
>> SqlConstraintViolatedExceptionFactory(...));
>> SqlConstraintViolatedException sqlConstraintViolatedException =
>>
>> sqlConstraintViolatedExceptionFactory.createSqlConstraintViolatedException(...);
>>
>> throw sqlConstraintViolatedException;
>> }catch(SqlConstraintViolatedExceptionFactoryWrapperException e){
>> // ...
>> }catch(SqlConstraintViolatedExceptionFactoryException e){
>> // ...
>> }
>>
>> Deliberately over-dramatized.
>
>
> As I said, names comes in a context. Overly long names tell about the fact
> that the name isn't at the right place and things should be refactored, to
> provide a nice place to that named stuff.
>
> auto helps too.

I agree with whoever was talking about balance. This isn't a
abbreviate vs not abbreviate discussion, its about when to abbreviate
and when not to. Personally, I think Clock.currentTime() is fine,
however Clock.currentTimeWithDST is not. There is also the argument of
line length, less of an issue nowadays, but I try to stick with
reasonable line-lengths, about 100 characters (was 80, but that ended
up being too limiting for most purposes), If I have to use overly
verbose names, then that eats into my "quota" for that line,
especially annoying when I have string arguments that I don't want to
have to split.

"dur" should be "duration" because its silly otherwise. Seconds should
be either "secs" /or/ "seconds", but should be consistent, I'd say
"secs" because it meshes well with the other, sub-second, times
("nsecs", "usecs" etc) and writing out "microseconds" is a bit
verbose, especially when you're probably outputting them as "12 us"
anyway...

--
James Miller


More information about the Digitalmars-d mailing list