What are some examples of elegant, lean programs? 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? |
What are some examples of elegant, lean programs? 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? |
Furthermore, in general, in practice things get very bad when you have to add input validation, error handling and other special cases.
See http://www.gigamonkeys.com/code-reading/
I guess recent examples of lean and elegant programs could be found in the works of Alan Kay and his team:
http://www.tele-task.de/archive/video/flash/14029/
or
https://www.youtube.com/watch?v=gZmcmdsoAXU https://www.youtube.com/watch?v=-UOmItPa4iA https://www.youtube.com/watch?v=QlPavndhYxQ https://www.youtube.com/watch?v=y9xLi0iJg1g
In general, where you have more abstraction, you will find more elegance and leaner code.
As a microscopic example, check https://news.ycombinator.com/item?id=9211609
def hamming(a,b)
return sum(x!=y for x,y in map(None,a,b))
is elegant and lean.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.
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.