009 RR What Makes Beautiful Code

    0
    1815

    Ruby-Chan Why Beautiful Code?

    • You know your code is written correctly by looking at it.
    • Knots metaphor – If it’s shaped right, you know it’ll hold.
    • The shape in your mind matches the shape on the page

    Evaluating code:

    • Eric Hodel – Audio evaluator of code
    • rubygems-sing
    • Reveals the intention to someone

    Practices:

    • 80 character limit
    • 1 statement per line
    • Comments are code smells
    • Red-green-refactor
    • Engage more senses-use more parts of the brain
    • Short functions/methods
    • Morph the language into the language of the problem domain (DSL’s)

    See Also

    Dave’s post on Dishonest code