in reply to Code for elegance, code for clarity

And as I read these posts, I see above "Code for elegance, code for clarity".

To me, elegant code works correctly, and works efficiently. This is something that I've had to work hard at with my recent project. Taking code that works, and making it code that works faster is how I found my 'elegant' code. But now, I'm leaving it alone since there is little more that can be done without making some of the code unreadable. Someone else may have to look at this down the line, it shouldn't be impossible (just very difficult).

  • Comment on Re: Code for elegance, code for clarity

Replies are listed 'Best First'.
Re: Code for elegance, code for clarity
by dd-b (Pilgrim) on Jan 13, 2004 at 03:30 UTC

    I think "elegant" is often a term for code that's clear to good enough programmers, and often rather unclear to less good programmers. However, really elegant code is good code to study to improve your own abilities.

    Then again, my degree is in mathematics, where "elegance" is very often not the clearest way to express things.

      On the mathematics line, some physicist... (I forget the name Kinku? First name was Michael I believe), had an interview/show on TechTV about his perceptions of finding a Grand Unified Theory.

      He said routinely rejected theories and equations because they were too complex, every time saying God's universe would be governed by beautiful (&simple*) equations. Though I think String Theory is off in unprovable never-never-land, there was a lot that I learned from that statement.

      * = By simple, I mean short an elegant, without a lot of fudge constants and operators, I'm not saving the Creator would be afraid of a flux integral or something like it :)

        There seems to be a strong human prejudice for simple explanations of reality. It has a history of working pretty well; which I find startling.

        Then again, I suspect Planck's constant, for example, is just a fudge factor.