[TUHS] Discuss of style and design of computer programs from a user stand point

Bakul Shah bakul at bitblocks.com
Sun May 7 05:50:49 AEST 2017


On Sun, 07 May 2017 04:43:33 +1000 Dave Horsfall <dave at horsfall.org> wrote:
> 
> > I also made the point that "clever" sucks.  At least most of the time. 
> > All "clever" means is "hard to understand".  The brief joy one gets from 
> > clever code is stomped on by the frustration one gets from having to fix 
> > it.

> Apropos the above, I do confess to writing "clever code" from time to time 
> (PERL is a beautiful language for such sins)...
> 
> Of course, in the olden days it was the APL "one-liners" :-)

On the other hand, you have to grok only one line of code
instead reading pages of Java/C++ with surprises lurking
everywhere :-)

Since you need one line to do the work of many many lines of
c++/Java code, you should expect to spend more time on that
one line!

The same is true with shell one liners as well. We don't
(usually) consider constructs such as the following "clever"
because we expect its reader to have a certain level of code
literacy and context (or an ability to gain such).

tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${1}q



More information about the TUHS mailing list