As the title suggests, what are some examples of programs that are often described as elegant, lean, and so on? I keep hearing the term, but I don't know how it looks. Help?
That's a good question, and nowadays, it feels indeed quite hard to find such programs, when applications with multi-decamegabyte-sized sources abound.<p>Furthermore, in general, in practice things get very bad when you have to add input validation, error handling and other special cases.<p>See <a href="http://www.gigamonkeys.com/code-reading/" rel="nofollow">http://www.gigamonkeys.com/code-reading/</a><p>I guess recent examples of lean and elegant programs could be found in the works of Alan Kay and his team:<p><a href="http://www.tele-task.de/archive/video/flash/14029/" rel="nofollow">http://www.tele-task.de/archive/video/flash/14029/</a><p>or<p><a href="https://www.youtube.com/watch?v=gZmcmdsoAXU" rel="nofollow">https://www.youtube.com/watch?v=gZmcmdsoAXU</a>
<a href="https://www.youtube.com/watch?v=-UOmItPa4iA" rel="nofollow">https://www.youtube.com/watch?v=-UOmItPa4iA</a>
<a href="https://www.youtube.com/watch?v=QlPavndhYxQ" rel="nofollow">https://www.youtube.com/watch?v=QlPavndhYxQ</a>
<a href="https://www.youtube.com/watch?v=y9xLi0iJg1g" rel="nofollow">https://www.youtube.com/watch?v=y9xLi0iJg1g</a><p>In general, where you have more abstraction, you will find more elegance and leaner code.<p>As a microscopic example, check <a href="https://news.ycombinator.com/item?id=9211609" rel="nofollow">https://news.ycombinator.com/item?id=9211609</a><p><pre><code> def hamming(a,b)
return sum(x!=y for x,y in map(None,a,b))
</code></pre>
is elegant and lean.<p>Other implementations involving lower level details, such as computing the length of the vectors and indexing individual slots explicitely, and taking ten times more lines of codes, are clearly not more elegant and definitely not leaner.<p>Factored over a whole application, this kind of differences grow to an unmanageable hundrend megabytes source monster that is unmanageable by anybody, or a lean and elegant hundred kilobytes source that you can read and start to understand in a week end. Much more maintainable.
Many examples here. Also search for "tiny ..." or "minimal ..." with more search terms to narrow down the category<p><a href="http://kmkeen.com/tiny-code/index.html" rel="nofollow">http://kmkeen.com/tiny-code/index.html</a>