Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^3: "Cleverness" from HOP

by ikegami (Pope)
on Jun 11, 2009 at 17:32 UTC ( #770710=note: print w/replies, xml ) Need Help??

in reply to Re^2: "Cleverness" from HOP
in thread "Cleverness" from HOP

Simplicity is subjective.

To someone who is equally familiar with A, B, C, D, E, F, ABCD is less simple than EF.

To someone who is more familiar with A, B, C, D than with E, F, ABCD is more simple than EF.

The simplicity of the building blocks is not an indication of the simplicity of the whole.

As concrete example, compare

my @a; for my $b (@b) { push @a, process($b); }
my @a = map process($_), @b;

I consider the latter simpler or at least equally simple, but others consider it more clever since they haven't dealt with map or they aren't used to dealing with map.

Replies are listed 'Best First'.
Re^4: "Cleverness" from HOP
by demerphq (Chancellor) on Jun 14, 2009 at 10:28 UTC

    Im with you on this for sure. All too often programmers with a poor understanding of Perl label idiomatic and efficient, and elegant Perl structures with "cleverness", when in fact what they are really saying "you wrote something im too lazy to understand so it must be bad". And actually the first code is not the same as the second in various subtle ways, starting with the fact that it performs many more opcodes that the one following, and thus is not going to be as fast (perl bugs aside).

    Bad cleverness is writing a cache system for something that doesnt need to be cached, or using some funky algorithm when a plain array would do. Its not about using the language expressively.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://770710]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-01-19 16:58 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (221 votes). Check out past polls.