in reply to Re: How do you define "elegant"?
in thread How do you define "elegant"?

Well, I guess you've proven my point :)

I was meaning map would be inelegant if you tried to cram all that logic into the the map block (foreach would be a much better way to lay that out). But obviously your way to do it is also elegant.

It's fairly easy to give examples of what is/isn't elegant, but I find it harder to come up with an actual definition.

Replies are listed 'Best First'.
Re^3: How do you define "elegant"?
by holli (Abbot) on Aug 16, 2006 at 12:00 UTC
    Wikipedia says
    ... a computer program or algorithm is elegant if it uses a small amount of intuitive code to great effect.
    Pretty much hits the nail on the head, I think.


    holli, /regexed monk/

      Define "intuitive"! We are exactly where we were. What's intuitive?

      IMHO, beauty, elegance and intuitivity (or whatever's the correct spelling in English) are all in the eye of the beholder. What's perfectly intuitive to me is bound to be counterintuitive or plainly a big meaningless mess to someone else.

        To further complicate things, intuition is not just in the eye of the beholder, it's also context-sensitive.

        For example, someone might normally expect 8 to follow the series 5,6,7, but he'd expect 10 (the octal representation of 8) when reading a VARASM listing.