std.compress

Jacob Carlborg doob at me.com
Mon Jun 10 01:25:23 PDT 2013


On 2013-06-10 09:57, Peter Alexander wrote:

> I object to your use of the name "API". Please use the more
> understandable "Application Programming Interface" in future.
>
> :-)
>
> /joke

Some are abbreviations are commonly know. In the programming world API 
is one of them. FTP and HTTP are other examples. I would say that "di" 
and "si" are not.

> The point is that there is value in terseness. That's what abbreviations
> are for. If you are to refer to Application Programming Interface
> multiple times then it can make text more understandable to abbreviate
> it (as you have). Reducing the size of identifiers allows the reader to
> more clearly see the meaning of the text. The same is true in code.
>
> Compare:
>
> solution = (-firstCoefficient + squareRoot(secondCoefficient *
> secondCoefficient - 4 * firstCoefficient * thirdCoefficient) / (2 *
> firstCoefficient);
>
> to
>
> // a, b, c - coefficients
> // x - solution
> x = (-b + sqrt(b*b - 4*a*c)) / (2 * a);

If that code is in its own function, I would say it's ok. If that piece 
of code is mixed in a function with over 500 lines of code and the 
variables are declared at the top, I would say it's very bad style.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list