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

Richard A. O'Keefe ok@REDACTED
Fri Mar 8 00:39:42 CET 2013

I'd just like to say "Happy the programmer whose worst problem is
choosing between a 'case' or a function!"

Testing is wonderful.

Functions are things you can easily _reach_ with tests.

Inspection is even more wonderful than testing,
even if it is just boring old 'trying to read someone else's code'.

Throw in profiling and tracing for good measure.

I don't go as far as Garrett Smith.  Maybe I should.
But I agree with him 100% that you should write whatever is

Who judges what's clearest?  Whoever has to maintain the code.

If Helmuth von Moltke is in an afterlife that permits him to
entertain such thoughts, he probably wishes he had said
"no plan survives contact with the enemy", but he said
"no operation extends with any certainty beyond the first
encounter with the main body of the enemy", which is not so
pithy, but offers extra insight.

All code has to be considered highly tentative until it has
seen some serious testing/use.  You _will_ change it.  The aim
is to get it to that point quickly and change it easily.

More information about the erlang-questions mailing list