

What are some examples of elegant, lean programs? - zoskia

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&#x27;t know how it looks. Help?
======
informatimago
That's a good question, and nowadays, it feels indeed quite hard to find such
programs, when applications with multi-decamegabyte-sized sources abound.

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/](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/](http://www.tele-
task.de/archive/video/flash/14029/)

or

[https://www.youtube.com/watch?v=gZmcmdsoAXU](https://www.youtube.com/watch?v=gZmcmdsoAXU)
[https://www.youtube.com/watch?v=-UOmItPa4iA](https://www.youtube.com/watch?v=-UOmItPa4iA)
[https://www.youtube.com/watch?v=QlPavndhYxQ](https://www.youtube.com/watch?v=QlPavndhYxQ)
[https://www.youtube.com/watch?v=y9xLi0iJg1g](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](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.

------
jonjacky
Many examples here. Also search for "tiny ..." or "minimal ..." with more
search terms to narrow down the category

[http://kmkeen.com/tiny-code/index.html](http://kmkeen.com/tiny-
code/index.html)

------
RodgerTheGreat
JonesForth:
[https://github.com/AlexandreAbreu/jonesforth](https://github.com/AlexandreAbreu/jonesforth)

------
MichaelCrawford
djbdns - Daniel J. Bernstein's nameserver. I use it, it's quite simple to set
up and configure, reliable, and far more secure than bind.

~~~
zoskia
Lol. I mean source code.

