[erlang-questions] Which choice is better? Function or Case

Gianfranco Alongi gianfranco.alongi@REDACTED
Sun Mar 10 10:35:17 CET 2013


I am (like most others, I imagine) - amused by this email thread that now
drifts far
off from the original question, and now ventures into and through the land
of clean code,
good coding practices and principles.

Seriously, everyone  who has not seen the work of Robert C. Martin (Uncle
Bob), is strongly encouraged
to do so. He is a very strong character who pours a lot of hours into
writing and thinking about communicative
code, and readability.

Why am I writing? I just want to take the time and support the previous
email, which I hope
will be the last, so we can avert a full-blown flame war between the
short-variable-name and comments
people and those who focus on clarity, communication and conveying of
intent.
No matter what smart solutions you think you have for a problem. If it is
unreadable by someone else,
and not maintainable - you have failed. You clearly failed to express
yourself through code.

Another thing that I have noticed is that some "old timers" believe that
they do not need to educate
themselves in the art of clean coding. They only care about making it work,
and stop at that.
It is saddening, as there are a lot of upcoming developers from younger
generations that look up to
them as role models, and so, the unprofessional attitude is passed down
from one generation to the next.

The professional knows that clean code that clearly communicates your
intent - is the king.

Cheers
 G

On Sun, Mar 10, 2013 at 9:27 AM, <ok@REDACTED> wrote:

> I once had to maintain some code written by a highly skilled
> programmer in a language not entirely unlike Erlang.  All the
> variable names were one letter or one letter and one digit.
>
> It had me screaming in frustration.  It took me about a day a
> page to reconstruct meaningful names for the variables.
>
> I'm trying to think of anything nastier for a programmer to
> do to another programmer than to know something the second
> programmer needs to know and deliberately choose to conceal
> it by using ultra-short variable names.  If I have any luck
> I'll let you know.
>
> Seriously, the job of a programmer is to *COMMUNICATE* with
> other programmers.  I wish I could offer a simple rule for
> how long to make variable names.  My colleague who refuses
> to use "i" for a loop index in C++, preferring
> innerLoopIndex, clearly errs on one side.  Someone who uses
> T for timestamp, tree, and table in the same module clearly
> errs on the other.
>
> One rule of thumb I can offer you is this:
> there's an interplay between *type* and *purpose*,
> in that a variable with a complicated type is likely
> to have few plausible purposes in a given scope.
> If it's obvious to a reader what the type of a variable
> is, you can get away with shorter variables.
> For something with a frequently used type, you had
> better be clear about purpose.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130310/00ac2f61/attachment.htm>


More information about the erlang-questions mailing list