
Ask HN: What are some examples of beautiful software? - ponderatul
So I&#x27;ve been reading Paul Graham&#x27;s - Hackers and Painters. A bit late, I know. And I find his ideas fascinating. One that struck a chord with me, was the idea of taste, recognising good taste. I&#x27;d like to know examples of beautiful software and what makes it beautiful.
======
tbrock
C: anything by antirez (redis, etc...) Redis is the epitome of well written
understandable C.

Ruby: anything written by _why (if you can find the source) He once gave a
whole presentation on the splat operator and it's bizarre uses that gave me
goosebumps. A true artist. The code twists and contorts ruby in unimaginable
ways.

JS: anything written by TJ hollwaychuck (express, mocha, etc...) Express is so
simple but powerful, when you read the source you can't help but wonder where
the rest of the code is.

Python: anything written by Kenneth Reitz (Requests, legit, records...) This
guy can lay down some serious Python and gets things done. He writes the
batteries that python should have had included.

~~~
oluckyman
"The code twists and contorts ruby in unimaginable ways." Doesn't sound like
my idea of beautiful software.

~~~
skewart
I completely agree. It sounds like the opposite of beautiful software if you
ask me. Maybe it's interesting, thought-provoking, or amusing code, but not
beautiful.

~~~
ikurei
Beauty comes in very different forms. Not all beautiful paintings are pleasing
and peaceful fields for flowers; IMHO, something can be dark, strange, even
scary, and still beautiful. E.g.: The Garden of Earthly Delights[1], or It
Follows[2].

[1]
[https://en.wikipedia.org/wiki/The_Garden_of_Earthly_Delights](https://en.wikipedia.org/wiki/The_Garden_of_Earthly_Delights)
[2]
[http://www.imdb.com/title/tt3235888/](http://www.imdb.com/title/tt3235888/)

------
Ace17
I'm seeing a lot of meanings to "beautiful" here, please, let's define what
we're talking about.

Does "beautiful" means "the code is clean"? If so, the Quake source code is
"beautiful", while Duke3D Build engine is "ugly".

Does "beaufitul" means "the code is clever"? If so, gcc, ffmpeg and ODE are
"beautiful", and Google's Ninja is "tasteless".

Does "beautiful" means "the code is modular" (I mean "open-closed" here)? If
so, VLC is "beautiful", and everything monolithic is "ugly" (gcc, Linux,
systemd, LLVM, ...).

Does "beautiful" means "the software performs flawlessly"? If so, the Duke3D
Build engine, Quake's engine, and Portal's physics engine are "beautiful",
while VLC is "ugly".

Does "beautiful" means "the software embodies a clever concept"? If so, "grep"
and "xargs" are "beautiful", and the Windows Batch interpreter is "ugly".

Does "beautiful" means "the software is easy to use"? If so, the Windows
calculator is "beautiful", while Mathematica and vim are "ugly".

Does "beautiful" means "the software can be twisted in lots of interesting
ways"? If so, dynamic language interpreters are "beautiful", while static
language compilers are "ugly".

My point is, any piece of software can be seen as "beautiful" or "ugly".

We have meaningful objective attributes at our disposal, like "simple",
"clever", "fit", "robust", "fast", "small", "user friendly"... let's use them!

~~~
eru
> Does "beautiful" means "the software can be twisted in lots of interesting
> ways"? If so, dynamic language interpreters are "beautiful", while static
> language compilers are "ugly".

You'd be surprised what people do to static language compilers. C++'s template
are turing complete, after all.

~~~
pjc50
Templates can achieve "towering soviet concrete brutalist monument to
ugliness" levels of ugly.

~~~
eru
Yes. I mentioned C++ templates, because I don't want to only talk about
Haskell. (People make ghc do interesting things, too. And some of them are
even not-so-ugly.)

------
donatj
"Another World" There's a very interesting write up here:
[http://fabiensanglard.net/anotherWorld_code_review/](http://fabiensanglard.net/anotherWorld_code_review/)

The game itself has an amazingly beautiful vector style. The engine is
remarkably tiny, 20kb. I decided years ago if I ever find time to build a game
I'd like to architect it like "Another World".

~~~
CyberDildonics
He wrote tinycc, qemu, a new image compression, AND he can write? Who is this
man?

~~~
molyss
You're mixing him up with Fabrice Bellard, I believe
([http://www.bellard.org/](http://www.bellard.org/))

~~~
vmorgulis
Yes and both are french :)

------
joshuata
My vote is for SQLite. It is very well written, incredibly well tested, and
one of the simplest and most flexible tools out there. My favorite part is the
extensive documentation explaining the architecture decisions they made.

~~~
TickleSteve
is this more a case of 'well-engineered'?

I agree the quality of SQLite is very high, but is it just devotion to details
or aesthetic?

~~~
EdwardDiego
I'd argue that good engineering is beautiful also.

------
hebdo
Varnish cache.

1) Configured via a special DSL (Varnish Configuration language) that gets
translated into C, compiled and loaded into the Varnish process via a .so.
Perfect combination of expressiveness and speed. You can even inline raw C
code in it!

2) Heavy, good use of virtual memory. Varnish allocates quite a lot of
gigabytes and leaves it up to the operating system to decide what should be in
RAM and what should be on disk.

3) LRU garbage collection of cached objects requires a synchronized priority
queue. Varnish people transformed the decades old idea of implementing a heap
in an array that every CS graduate knows and came up with a faster, paging-
aware solution
([http://queue.acm.org/detail.cfm?id=1814327](http://queue.acm.org/detail.cfm?id=1814327)).

~~~
amelius
Nice, but they are solving a problem that is not all that hard. For example,
I'd rather see a beautiful implementation of a concurrent garbage collector
(which probably doesn't exist because it is almost impossible to achieve; a
purely functional programming approach doesn't even apply here). Or how about
a beautiful implementation of a web browser?

~~~
nickpsecurity
"Nice, but they are solving a problem that is not all that hard."

Apparently it was hard if it took that long to get a great, clean, FOSS
solution to the problem.

~~~
amelius
Well, in any case, I've never heard of a government software project being
overdue because their proxy cache contained spaghetti code :)

To be clear, I'm not trying to denigrate this project in any way. I'm just
saying that the complexity of the problem should be taken into account here.

~~~
inopinatus
Maybe this will change your opinion. I recalling helping rescue a government
software project that was horribly behind schedule. One of the many issues
being an e-learning system for a state department of education. Their CMS
(Blackboard) was fronted by a forward HTTP proxy/cache/load-balancer that was
misbehaving but near-impossible to debug. Details a bit hazy now but I recall
it being a hairball of poorly written java. I ripped that out and replaced it
with Squid and some rewrite code.

HTTP intermediate services are easy to write, but operate in a hostile and
chaotic environment; they are very very hard to make reliable, performant,
interoperable, secure, forgiving, and compliant. To achieve that and still
have elegant code is really something so yay Varnish.

I'm a bit of a fan of the Dovecot mail server source for similar reasons (but
I'm biased, having made a small contribution and got into the authors file)

~~~
jrochkind1
Nice. I'm pretty sure that for any "a government software project being
overdue because X", there is such an X... and someone on HN was there.

~~~
Thirdegree
The government should stop hiring HN programmers, that's clearly the problem!

------
PeCaN
LuaJIT. It's a cutting-edge JIT with remarkably understandable algorithms and
source. Every single piece of it is well thought out. Even the asm
interpreters are pretty clean and explain why they work the way they do.

Mike Pall is a demigod.

~~~
jballanc
LuaJIT is, indeed, a genius masterwork, but it's also very intricate and
complex. I'm not entirely sure anyone _other_ than Mike Pall could understand
it completely.

On the other hand Lua (The Original™) is also a beautiful bit of programming,
and much more approachable. If you've ever wondered what it means when people
talk about "Stack-based VMs", reading through the Lua source is an excellent
way to learn more.

~~~
PeCaN
But... Lua is a register-based VM since like Lua 5.

Not disputing that Rio Lua is also an excellent work though. Lua 5.1 only has
38 opcodes total. A complete description of how the VM works fits on a page or
so.

~~~
jballanc
D'oh, my mistake. The VM is, indeed, register-based. The C API is stack-based.
But yes, a very lovely bit of code all together.

------
analog31
Turbo Pascal for DOS. Simple, compact, quick, well documented, reasonably easy
to learn, and not too expensive.

I think that bloat is the enemy of beauty, so we're probably likely to find
beauty in software that does a few things well.

~~~
ycmbntrthrwaway
Related:

\- Things That Turbo Pascal is Smaller Than:
[http://prog21.dadgum.com/116.html](http://prog21.dadgum.com/116.html)

\- A Personal History of Compilation Speed, Part 2:
[http://prog21.dadgum.com/47.html](http://prog21.dadgum.com/47.html)

~~~
mtrn
Turbo Pascal 5 got me into programming. I wish people would build smaller
things again.

~~~
foobarian
My personal favorite thing about TP:

    
    
      begin
        asm
          mov ax, 10h
          ...

~~~
analog31
I didn't go quite that far, but I did some insane stuff using the built-in i/o
port access and the parallel printer port.

------
stray
The most beautiful I'm aware of is Robert Strandh's SICL
([https://github.com/robert-strandh/SICL](https://github.com/robert-
strandh/SICL)). CL-PPCRE ([https://github.com/edicl/cl-
ppcre](https://github.com/edicl/cl-ppcre)) is very nice as well, imo.

What makes them beautiful? They're very straight forward and clearly
communicate what they're doing, and how.

And the parentheses in their language of choice softens the visual display of
the code -- while the semantics of the language cause the shape of the code to
communicate quite a bit about how the machine will go about executing it.

There are no surprises.

In terms of conceptual beauty, it'd be hard to beat Screamer
([https://github.com/nikodemus/screamer](https://github.com/nikodemus/screamer)).

What makes this beautiful? The way it makes a hairy problem seem simple and
straight-forward.

~~~
agumonkey
Note SICL is used in CLASP
[https://github.com/drmeister/clasp](https://github.com/drmeister/clasp)
(according to CLASP author's talk somewhere)

------
weej
"Beautiful Code: Leading Programmers Explain How They Think" is a book that
attempts to to tackle this topic. "The authors think aloud as they work
through their project's architecture, the tradeoffs made in its construction,
and when it was important to break rules." The book has been sitting in my to-
read stack forever. You might want to check it out.

[http://shop.oreilly.com/product/9780596510046.do](http://shop.oreilly.com/product/9780596510046.do)

~~~
vram22
Yes. IIRC, they also had a series of posts on the same topic, with columns by
some well-known programmers, maybe on programming.oreilly.com or
radar.oreilly.com - some years ago.

------
wstrange
ZFS

The idea of collapsing a volume manager and file system into one was very
innovative and led to substantially more functionality with less code
(although some called it a "rampant layering violation" ).

ZFS is a joy to use, dead simple, and arguably the most robust file system out
there.

~~~
agumonkey
The source code is pretty neat too. At least at FreeBSD 9.2.

------
albertzeyer
I really like reading most code from John Carmack, e.g. Quake 1-3. Much of it
can be seen here: [https://github.com/id-Software](https://github.com/id-
Software)

------
hatsunearu
Rust. It's god damn beautiful. It's design is magnificent, so much so that it
seems easy to write beautiful rust code myself.

~~~
matteotom
Also, the documentation is one of the best among all languages I have used

~~~
steveklabnik
Thank you so much!

------
paulsutter
The Deepmind Atari Player is only 22KB of source code:

[https://sites.google.com/a/deepmind.com/dqn/](https://sites.google.com/a/deepmind.com/dqn/)

If you haven't seen the video it's remarkable:

[https://m.youtube.com/watch?v=EfGD2qveGdQ](https://m.youtube.com/watch?v=EfGD2qveGdQ)

~~~
BigJono
When he says "the algorithm is given just the pixels", does that mean it's not
given any information about the game itself, like the objective? How does it
know how to measure it's own success?

~~~
slpsys
There is an objective, but it may not be exactly as you reason about it.
There's a great video that made the rounds last year about building a neural
net that plays Super Mario World, that may help visualize what's going on -
[https://www.youtube.com/watch?v=qv6UVOQ0F44](https://www.youtube.com/watch?v=qv6UVOQ0F44)

There's also a great snippet in the currently-ongoing AlphaGo videos that
explains that when AlphaGo plays in ways that you may not expect, it's because
it's strictly worried about _winning_ (even by the slimmest margin) with the
greatest probability, and not necessarily by winning handily, like a human
might.

~~~
qwertyuiop924
Yeah, I love sethbling. And the lua for MarI/O is only one file, and a
relatively small one at that.

------
mtrn
The Go standard library. At least two things coming together: A stripped down
language, that explicitly aims to be readable and experienced programmers /
authors.

~~~
cyphar
I'm not sure I agree with that. JSON parsing uses panic() and recover() for
some logic. And templating is more of a PoC for coroutines in Go than a
properly fleshed out library. Not to mention that the AST parsing for Go is
horribly designed (though you can do some cool stuff with it).

~~~
enneff
> And templating is more of a PoC for coroutines in Go than a properly fleshed
> out library.

I worked with Rob on that library and that's really not the case. It was
designed from the ground up to replace the existing template library which was
bad in several ways. The parser (which is I think what you refer to) is just
an implementation detail.

~~~
cyphar
> I worked with Rob on that library and that's really not the case. It was
> designed from the ground up to replace the existing template library which
> was bad in several ways. The parser (which is I think what you refer to) is
> just an implementation detail.

Right, but why can't I call define custom operators? And why is there no
bracketing in conditionals? It just feels clunky to me (but maybe I'm too
spoiled with Jinja2). I still feel like you could allow execution of functions
passed in the data argument (as long as the developer doesn't shoot themselves
in the foot, it shouldn't be a security problem).

It's stuff like that which makes me feel like it was a PoC (or at least, not
designed to be feature-complete). Still, it works pretty well for plenty of
usecases (I use to generate config files every once in a while).

~~~
enneff
> I still feel like you could allow execution of functions passed in the data
> argument

I don't recally anyone asking for this before. File an issue?
[https://golang.org/issue/new](https://golang.org/issue/new)

> It's stuff like that which makes me feel like it was a PoC (or at least, not
> designed to be feature-complete).

It's designed to be a useful template engine. I don't know about "feature
complete", but we are still improving it. If you find it lacking then please
file issues so that we can think about improving it.

------
Luc
Doom.

At the time I had never heard of Binary Space Partition Trees. Beautiful
concept for a monument of a game.

[http://fabiensanglard.net/doomIphone/doomClassicRenderer.php](http://fabiensanglard.net/doomIphone/doomClassicRenderer.php)

------
jarcane
The Haskell and Clojure standard libraries.

It's very rare in a programming language that I can click through to the
implementation of a function and actually understand the code I get through
the wall of error checking and coercion and OOP gobbledygook to even make
sense of what I'm looking at.

But I've never had this problem in Haskell or Clojure. Haskell because that
awesome type system makes most of that boilerplate unnecessary, and Clojure
because for good or ill, the priority seems to be on clarity of code and
letting the Java type system kind of catch a lot of the obvious errors.

Racket, on the other hand, much as I love it, when I go looking at it's
internals most of the time it's practically unintelligible to me.

~~~
qwertyuiop924
>Racket, on the other hand, much as I love it, when I go looking at it's
internals most of the time it's practically unintelligible to me.

This is one of the reasons Racket never appealed to me. R5RS and R7RS are so
simple that you can write most of the interpreter in about a page of code in
the language. Although if you read SICP, you already know that :-).

Racket and R6RS, OTOH, are full to the brim with complex systems that all
interact in a manner that's hard to wrap your head around. Custodians,
Contracts, OOP, Delimited Continuations, all there by default... It's just too
much. I also dislike syntax-case, but that's more of a personal issue than
anything else.

I'd even prefer Common Lisp. Sure, it's about the same size at least, but it's
not trying to make you use 5 paradigms at once. Sure, you COULD, but you don't
HAVE to. But then, I suppose that is what lisp is about.

------
w8rbt
Personally, I like Tarsnap and anything from the OpenBSD project. Of course,
this is highly subjective, and I would not call the code 'beautiful'. However,
to me, these are a few examples of code performing complex tasks written in a
simple, straight-forward way that I can follow and understand.

~~~
cperciva
If you like the Tarsnap code, you should read the spiped code. Tarsnap is made
ugly in places by needing to work with/around the original tar code it's based
on; spiped is code entirely written by me.

------
muzani
JSON.

The way it displays and organizes complex data, better than other standards
like CSV or XML. Or the things that use tables.

When I first started programming, I had two favorite ways of storing data -
INI and arrays. INI for its elegant key/value style. Arrays were just natural
because of the way computers think.

I spent months trying to mold these two things together; how would you
actually store key-value things within an array? Do you make an array of
pointers that lead to key-value objects? (I used C)

JSON is just this beautiful thing that lets you store data however you want.
It's beautiful because it doesn't get in the way. Not only that, but it's a
data structure you can understand just by looking at it; you'd have to squint
to understand raw XML or a SQL table.

~~~
stray
> JSON is just this beautiful thing that lets you store data however you want.

What if I want to store integers?

 _Not floats._

Integers.

~~~
erichurkman
Or dates? No one would ever need to store dates or times, right?

~~~
gbaygon
Write the dates/times as string in ISO 8601 format.

------
lucaswiman
Peter Norvig's sudoku solver is beautiful on all levels.
[http://norvig.com/sudoku.html](http://norvig.com/sudoku.html)

It's clearly explained code that's shorter than you would have thought. Norvig
showcases his expertise in manipulating both the basic data structure of the
Python language, and a deep understanding of the underlying problem and
methods for solving it.

~~~
mdpopescu
Ouch. I admire Norvig, but that's one of the most horrible pieces of code I
have ever seen. I've read that page several times, I've even translated it to
C# -
[https://github.com/mdpopescu/public/blob/master/Sudoku/Sudok...](https://github.com/mdpopescu/public/blob/master/Sudoku/Sudoku.Solver/Program.cs)
\- but I still think it's incredibly ugly. I will admit that my knowledge of
Python is very basic but still, if I had to maintain that code without the
entire description around it, I'd give up and rewrite it.

------
awinter-py
For me, learning about functional programming and 'feeling my way' into
avoiding excess local vars, paying careful attention to side effects. To be
clear: I'm talking about functional style in imperative languages, not about
making the jump to functional languages (which are still less widely used --
maybe because they're not 'necessary enough').

I'm not saying my code is particularly readable to anyone but me, but
functional style is something that 'clicked' when I fell into it.

~~~
agumonkey
And recursive thinking gets your while loop invariants a lot clearer.

------
nstart
This might sound crazy but I actually found the discourse source code to be a
beautiful thing. When I read it I had never used ruby beyond understanding the
syntax via ruby koans. And one day I wanted to learn how they manage long
running tasks without blocking the rest of the web application, and so I
jumped into the code using only github and github source code search. 15
minutes in I had notes which drew the entire picture of how and where sidekiq
comes in and how and where emails are constructed (I was starting out by
trying to understand how things like password reset emails are handled iirc).
I know there must be some ugly parts in there, but I went in with no
understanding of what to look for except some keywords. I came back with a
pragmatic understanding of how to implement a certain workflow regardless of
language or framework. This was the mark of something beautiful to me.

------
spotman
Redis is my favorite example. It's some of the easiest to read, digest, and
modify source code out there.

~~~
percept
antirez as Italian Renaissance code painter?

------
ycmbntrthrwaway
X11 terminal emulator as one C file:
[http://git.suckless.org/st/tree/st.c](http://git.suckless.org/st/tree/st.c)

------
yannis
Knuth's TeX. Set the standards for documentation, reliability, portability,
typography, extensibility and scripting, is well into its fourth decade and is
free software.

~~~
dheera
And after those four decades, I still can't figure out how to get my figures
to appear where I want them.

~~~
GFK_of_xmaspast
The trick is deciding to want them wherever tex puts them.

~~~
jjgreen
In this way commences typographical wisdom.

------
sctb
Arthur Whitney's one-page interpreter:
[http://code.jsoftware.com/wiki/Essays/Incunabulum](http://code.jsoftware.com/wiki/Essays/Incunabulum)

~~~
agumonkey
unicorns level in ioccc standards

------
rwallace
The Scheme programming language. As close to the core essence of programming
as an actually usable, practical programming language has ever come.

LLVM. Being able to fully represent general code in a simple, well-defined,
readable text-based format is a far bigger achievement than you would think
until you look at what it took to do it.

~~~
klibertp
Erm... _Which_ Scheme? Or do you mean the standard?

~~~
qwertyuiop924
I think he means R5RS. But honestly, It's missing a bit of what you need for
most programming. Chicken Scheme is probably the best actual scheme on the
sliding scale of elegance/power, IMHO.

------
eternalban
Beautiful software =/= beautiful code.

Beautiful software: Java Virtual Machine (the code? could be entirely un-
beautiful ;)

~~~
sklogic
I'm genuinely puzzled. What can be beautiful anywhere in the JVM?!?

~~~
kpil
It's a really clean abstraction of a computing environment, which is as well
defined and predicatable that is possible.

I tend to prefer that to performance cludges, arcane architectural hand
waving, and undefined behaviour.

Some people thinks it's useless, since they do no see the benefits, as there
are costs.

(There are some obvious UX-flaws, especially on the desktop, where it takes a
bit to start up, and clearly failes to define a jxe file-extension for
executable jars... Not to mention all the enterprise-level shit that goes
on...)

~~~
sklogic
> It's a really clean abstraction of a computing environment

No, it's a clumsy and leaky abstraction which was not well thought out.
P-codes are a nice abstraction. AS/400 is a nice abstrction. Dozens of other,
better VMs are a nice abstraction. But not a JVM, which is broken by design.

I'd never chose it as an underlying VM for anything important.

~~~
qwertyuiop924
You forgot about Squeak. Now THAT is a brilliant abstraction. Provided you
don't touch the outside OS, you can copy an image, bit-for-bit, to another
computer that runs the Squeak VM, and it'll just work.

------
vmorgulis
Oberon, TempleOS or OpenGenera. These projects are vertical, consistent and
use only one programming language.

In OpenGenera, everything displayed on the screen is typed and can be
retrieved as an s-expression (like in a web browser):

[https://www.youtube.com/watch?v=o4-YnLpLgtk](https://www.youtube.com/watch?v=o4-YnLpLgtk)

[https://github.com/ynniv/opengenera#additional-
reading](https://github.com/ynniv/opengenera#additional-reading)

------
lewisjoe
Werkzeug's Jinja2 templating engine written in Python.

I happened to dig into its source code for something and eventually found
myself amazed at how the entire base is beautifully laid out. It's no nowhere
near being naive. It's almost a simple programming language implemented in
python. A compiler of sorts with its own abstract syntax tree and stuff. Yet
the code is very readable, straight forward and just taught me how to write
good python.

[edit] corrected typo.

~~~
plaes
You mean Jinja2?

Also, Jinja2 and Werkzeug aren't coupled - you can use practically any Python
templating lib with it as Werkzeug is just a WSGI library (+ and of course
something else..).

And they happen to share the author.

~~~
lewisjoe
Yeah, my bad. Updated the details. Thanks. 'Mitsuhiko' is a hard name to
remember.

------
lkrubner
Anything by Zach Tellman:

[https://github.com/ztellman/aleph](https://github.com/ztellman/aleph)

[https://github.com/ztellman/automat](https://github.com/ztellman/automat)

In terms of his ideas, watch "Always be composing":

[https://www.youtube.com/watch?v=3oQTSP4FngY](https://www.youtube.com/watch?v=3oQTSP4FngY)

And he offers some great thoughts about queues and backpressure in "Everything
will flow":

[https://www.youtube.com/watch?v=1bNOO3xxMc0](https://www.youtube.com/watch?v=1bNOO3xxMc0)

~~~
dschiptsov
> "Always be composing"

the ideas were stolen from the Wizards talk

[http://ocw.mit.edu/courses/electrical-engineering-and-
comput...](http://ocw.mit.edu/courses/electrical-engineering-and-computer-
science/6-001-structure-and-interpretation-of-computer-programs-
spring-2005/video-lectures/3a-henderson-escher-example/)

~~~
prospero
I wasn't aware of this talk, so I'm not sure how I could have stolen anything
from it. Cool link, though, thanks.

~~~
dschiptsov
I should have used quotes.

------
huuu
For me it's Blender.

    
    
      - Starts in a sec.
      - API is the program, the GUI just an interface.
      - Free but very professional
      - Shortcuts are ergonomic.

~~~
frik
Blender is great, but the UI is very non-standard (for little benefit). A good
program can be used by domain experts without reading the manual, something
that's not possible with Blender. 3D Max, 4D Studio, and CAD apps like CATIA
have a much more intuitive UI.

~~~
jakobegger
Yes. I've dabbled with blender a couple of times, and it's infuriating how
hard it is to do simple things like rearranging palettes. Blender is different
than any other software I've used, and is unique in requiring a tutorial just
to understand basic stuff like how to open and save files...

------
jpgvm
PostgreSQL. The best C codebase I have ever worked with and IMO very beautiful
and well designed.

------
rpdillon
The Emacs source code was always impressive to me. Much is lisp, but even the
primitives (like buffer) that are written in C use macros to maintain semantic
parity with the lisp code, defining macros like EQ and DEFUN. It's kind of fun
to read (for me, anyway). [https://github.com/emacs-
mirror/emacs/blob/master/src/buffer...](https://github.com/emacs-
mirror/emacs/blob/master/src/buffer.c)

------
superuser2
Not sure if this is what you're looking for, but from the UX side, Square
Cash.

Does one thing, does it well with large responsive colorful UI that still
displays everything you need to know. Is minimally invasive (debit card
instead of bank account verification). Uses your existing contacts, so
everything "just works" by default.

~~~
ponderatul
Not looking for anything specifically, I'm just a junior developer and mostly
in javascript. I'm just looking for traits, common elements or approaches to
beautiful software. So thank you for sharing :D.

------
CoryG89
I would say that not many actual implementations of software turn out to be
beautiful, assuming it is above a certain threshold of complexity and it is
meant for production use.

On the other hand, the ideas, algorithms, or the protocols on which software
is based often seem beautiful, elegant, or brilliant, at least to me.

A few examples I can think of are: Google PageRank algorithm, Bitcoin's
protocol and the block chain, the TCP network protocol, the BitTorrent
protocol, Dijkstra’s algorithm, etc.

~~~
CephalopodMD
> tcp protocol

I respectfully disagree. Many of the elements of tcp are very complicated, and
more or less of a hack. Compose them all together, and it's a hugely complex
and arguably ugly (if utilitarian) standard.

~~~
supdog
Indeed. No Starch Press's book on TCP/IP by Kozierok is 1600 pages!

RINA is a beautiful new redesign of the networking stack wherein "computer
networking is just inter-process communication."

[https://en.m.wikipedia.org/wiki/Recursive_InterNetwork_Archi...](https://en.m.wikipedia.org/wiki/Recursive_InterNetwork_Architecture_\(RINA\))

------
phkahler
SolveSpace - parametric CAD program. Single executable, well done UI, small
code base, nice constraint solver, originally by a single person. It's the
only OSS CAD I've found useful (QCad was second, then FreeCAD). There are also
a few active developers now with major improvements on the way.

~~~
upstandingdude
Cool! I was looking for a decent free CAD program. Will check it out.

~~~
phkahler
Be sure to get the latest from whitequarks repository. He's been doing (or
integrating) most of the recent development including the GTK3 and native OS X
ports.

------
ranko
"If Hemingway Wrote Javascript"
([https://www.nostarch.com/hemingway](https://www.nostarch.com/hemingway), see
also [https://javascriptweblog.wordpress.com/2015/01/05/if-
hemingw...](https://javascriptweblog.wordpress.com/2015/01/05/if-hemingway-
wrote-javascript-explained/)), in which five short programs are each written
in five different styles (all in Javascript). It shows how different
programming styles can be used in the same language to solve the same problem.
It's unlikely that you'll start writing in the style of Borges or Austen after
reading this, but it is entertaining and amusing.

------
mcculley
I learned an enormous amount about how to ship code that works on multiple
platforms back in the 90s just by reading the GNU Emacs and XEmacs source
code. I really owe a lot to that source code being available.

------
apdar
Beautiful code: graph search in prolog. So much in as few lines as possible[1]

[1]:
[http://www.cse.unsw.edu.au/~billw/cs9414/notes/prolog/path-t...](http://www.cse.unsw.edu.au/~billw/cs9414/notes/prolog/path-
trace.html)

------
binarymax
There is a really good list covered in detail here:

[http://www.aosabook.org/en/index.html](http://www.aosabook.org/en/index.html)

------
gravypod
I found this a while ago on hackernews:
[https://github.com/Hypsurus/skod](https://github.com/Hypsurus/skod)

Amazing source.

~~~
ycmbntrthrwaway
Why not use enum?

[https://github.com/Hypsurus/skod/blob/master/src/skod.c#L290](https://github.com/Hypsurus/skod/blob/master/src/skod.c#L290)

Also, at least some functions should be static.

_cla means "command line arguments", not obvious.

Useless comments:
[https://github.com/Hypsurus/skod/blob/master/src/skod.c#L273](https://github.com/Hypsurus/skod/blob/master/src/skod.c#L273)

~~~
gravypod
Not my software, but if you have looked at other FTP clients this is an
amazing thing to read though.

~~~
ycmbntrthrwaway
Other clients code being bad does not make this code easy to read or
beautiful.

All those MAX_STR and strcat's make me wonder about security:
[https://github.com/Hypsurus/skod/blob/master/src/ftp.c#L14](https://github.com/Hypsurus/skod/blob/master/src/ftp.c#L14)

Amazing read:
[https://github.com/Hypsurus/skod/blob/master/src/ftp.c#L22](https://github.com/Hypsurus/skod/blob/master/src/ftp.c#L22)

No enum again:
[https://github.com/Hypsurus/skod/blob/master/src/utils.c#L14](https://github.com/Hypsurus/skod/blob/master/src/utils.c#L14)

~~~
gravypod
I hold it to a standard of how to organize your code. The organization of the
source is superb.

Even without much documentation, you can go through and read it while
understanding what is happening.

------
jaybosamiya
Not specifically "software" but this piece of Haskell code is the most
beautiful code I've ever seen:

    
    
        quicksort [] = []
        quicksort (x:xs) = quicksort [y|y<-xs,y<x] ++ [x] ++ quicksort [y|y<-xs,y>=x]

~~~
CyberDildonics
Will you still think that when you realize it isn't actually a quicksort?

~~~
eru
It's tree sort. It does the same comparisons as quicksort, but organizes its
data differently.

It's nifty, but not an especially beautiful use of Haskell.

Okasaki's Red-Black Trees rendered in Haskell are nicer, for example.

------
braythwayt
The HashLife algorithm for Conway’s Game of Life:

[https://en.wikipedia.org/wiki/Hashlife](https://en.wikipedia.org/wiki/Hashlife)

My implementations in Literate CoffeeScript:

[http://recursiveuniver.se](http://recursiveuniver.se)

And JavaScript:

[http://raganwald.com/hashlife](http://raganwald.com/hashlife)

------
cdcarter
Camping -- it was _why the lucky stiff's Ruby web-microframework, under 4k of
code and absolutely brilliant from top to bottom.

------
sahreeg
This Beauty! I mean that in terms of code aesthetics.
[http://www.ioccc.org/2011/eastman/eastman.c](http://www.ioccc.org/2011/eastman/eastman.c)

(winner of the 20th International Obfuscated C Code Contest)

Nevertheless once you run it, you will have a sweet surprise.

------
altitudinous
Well, I think Jonathan Blow's Braid is a beautiful thing. Many in here seem to
be talking about the beauty of the source code or something related, but I
like a simple well executed idea that is beautiful to look at as well. No
corners were cut here - I think it is a work of art.

~~~
andrepd
If we are going that road, many games qualify. (Portal takes my vote)

------
zachrose
Not working software per se, but I think there's a lot of beauty in the way
Sandi Metz demos a refactoring of a thing called The Gilded Rose in this
video:

[http://m.youtube.com/watch?v=8bZh5LMaSmE](http://m.youtube.com/watch?v=8bZh5LMaSmE)

------
ktRolster
Early MacPaint and Quickdraw source code is worth a look. Clean and simple,
yet solved a rather complex problem.
[http://www.computerhistory.org/atchm/macpaint-and-
quickdraw-...](http://www.computerhistory.org/atchm/macpaint-and-quickdraw-
source-code/)

Here is what the author said about it (and code in general):

"It’s an art form, like any other art form… I would spend time rewriting whole
sections of code to make them more cleanly organized, more clear. I’m a firm
believer that the best way to prevent bugs is to make it so that you can read
through the code and understand exactly what it’s doing"

------
jamescun
Say what you like about Rails (or Ruby for that matter), but go and look at
its source. It is well laid out, the commenting is extensive and descriptive,
and it follows a natural flow.

The same can be said of the PostgreSQL source.

------
eliboy
The way ruby uses instance_eval. I didn't pay attention at first, I just
enjoyed the beautiful interfaces. But when I saw how they use instance_eval
behind the scene and how simple is, I was in awe.

------
dmytroi
FMOD [1] sound framework provides one of the best C API's in industry :
stable, works everywhere, clean and beautiful. Please find API example at [2].

[1]: [http://www.fmod.org/](http://www.fmod.org/) [2]:
[https://github.com/fmod/ue4integration/blob/master/FMODStudi...](https://github.com/fmod/ue4integration/blob/master/FMODStudio/Source/FMODStudio/Public/FMOD/fmod.h)

------
booop
I'm surprised no one has mentioned roller coaster tycoon. 99% of the game was
written by one man in x86 assembly and it ran beautifully.

[http://www.eurogamer.net/articles/2016-03-03-a-big-
interview...](http://www.eurogamer.net/articles/2016-03-03-a-big-interview-
with-chris-sawyer-the-creator-of-rollercoaster-tycoon)

and

[http://www.chrissawyergames.com/faq3.htm](http://www.chrissawyergames.com/faq3.htm)

------
Quiark
IPFS

Just read through the design, it's very simple and extremely modular. It
learns the lessons from previous related systems and applies them in the new
system.

------
zengr
Surprised that no one mentioned elasticsearch here. The Java code is truly one
of the best I have seen in any large open source Java project.

~~~
bpchaps
Maybe they should put that effort into their documentation ;)

------
malux85
In terms of source code? If so my favourites to read are: LLVM and Clang.
Redis. TensorFlow. Doom. Sha256k (the one Bitcoin core uses).

------
ycmbntrthrwaway
dwm: [http://dwm.suckless.org/](http://dwm.suckless.org/)

------
ycmbntrthrwaway
[http://suckless.org/rocks](http://suckless.org/rocks)

------
im_down_w_otp
Joe Armstrong's "Universal Server".

------
percept
Nobody mentioned git?

~~~
johan_larson
I'd be a bit surprised if anyone did. Git is powerful and flexible, but it is
also complicated and difficult to use for people who aren't experts.

Beautiful software should make simple things simple, and hard things possible.
Git leans strongly toward the latter, to the detriment of the former.

I need version control software that's mostly like a shovel and maybe
sometimes like a backhoe. Git is like one of these:

[http://earthfirstjournal.org/newswire/wp-
content/uploads/sit...](http://earthfirstjournal.org/newswire/wp-
content/uploads/sites/3/2015/03/World%E2%80%99s-Biggest-Excavator.jpg)

~~~
collyw
I am of the same opinion as you. I have started using git flow recently and it
keeps me from shooting myself in the foot as often.

So far this is as much documentation I have needed.
[http://danielkummer.github.io/git-flow-
cheatsheet/](http://danielkummer.github.io/git-flow-cheatsheet/)

~~~
qwertyuiop924
I would agree with you, but this[1] article changed my mind.

0: [http://lucumr.pocoo.org/2015/2/17/ui-and-hidden-
consistency/](http://lucumr.pocoo.org/2015/2/17/ui-and-hidden-consistency/)

------
davepeck
I've always found FreeType to be quite wonderful; it integrates the artistry
and mathematics of typography with entertaining low-level wizardry.

Take a look at the rasterizer, for example:
[http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree...](http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/raster/ftraster.c#n74)

------
pmarreck
[http://smile.amazon.com/Beautiful-Code-Leading-
Programmers-P...](http://smile.amazon.com/Beautiful-Code-Leading-Programmers-
Practice/dp/0596510047?sa-no-redirect=1)

This book might help.

H&P is great, by the way. It was that book and "Cathedral & The Bazaar" that
made me quit a Microsoft-only job and go open-source.

------
baby
Look at Laravel, every comments is made on 3 lines that go smaller and
smaller. The amount of details in the framework is pretty huge.

------
sevkih
why plan9 hasn't come up yet?

------
julie1
Drivers.

The interface between the physical world and the digital world. They are the
lenses of computers as much as its magic.

~~~
cyphar
The code for most drivers however, is less than beautiful. And I'd argue that
it's controller firmware that is the "real" bridge between the analogue and
digital.

------
reitanqild
Kind of out-of-place but Manic Time is the best GUI I remember having used on
Windows.

It has every feature but takes 5 minutes to learn. And it (mostly) seems to do
the most reasonable thing every time you do anything.

(plus: there is a working free model and a really useful paid upgrade.)

------
userbinator
[https://news.ycombinator.com/item?id=8558822](https://news.ycombinator.com/item?id=8558822)

A tiny self-interpreting compiler and virtual machine. The beauty is in how
amazingly minimal and yet functional it is.

------
murukesh_s
Why do we assume that software is same as code? I wonder if graphics
tools(like photoshop) were't invented as a point and click tool, but something
that you would need to code instead, we would have praised some X or Y instead
of Z..

------
z3t4
This is highly opinionated. It will change from person to person, even for the
same person in different times of his/her life. My answer would be that "when
the planets align": Meaning the right product at the right time.

------
zem
i maintain a lingering fondness for the [aurora text editor]([http://www-
personal.umich.edu/~knassen/aurora.html](http://www-
personal.umich.edu/~knassen/aurora.html)), a dos-based text editor that was,
like emacs, largely written in its own scripting language. the editor was
sadly closed-source and has now gone the way of most closed source stuff, but
the scripted bits were open source, and they were a real pleasure to work
with. again, like emacs, you could build some surprisingly non-text-editor-
like things on top of it.

------
s_dev
Apparently Doom 3:

[http://kotaku.com/5975610/the-exceptional-beauty-of-
doom-3s-...](http://kotaku.com/5975610/the-exceptional-beauty-of-
doom-3s-source-code)

------
sysret
examples:

1\. a. whitney 2\. ioccc.org winners (djb, etc.)

what makes [some] software beautiful?

the ugliness of other software.

most software is large, slow, complicated and bug-ridden.

this makes small, fast, clean software written by competent programmers
"beautiful".

taste varies. what is too terse and "obfuscated" to some is pleasingly
succinct and manageable to others.

right now there's another post about yann lecun on the front page. he once
wrote a lisp-like interpreter that compiles to C called "lush". of all the
lisps i have tried i think it's one of the more "beautiful" ones in it's
design.

------
numlocked
qmail and djbdns by D. J. Bernstein. But don't take my word for it:

[http://www.aaronsw.com/weblog/djb](http://www.aaronsw.com/weblog/djb)

------
lambdafunc
Presto also has a high quality codebase:
[https://github.com/facebook/presto](https://github.com/facebook/presto)

------
e12e
Might add that what I've seen of the internals of both Sqeak/Pharo Smalltalk
and Racket would probably qualify as beautiful software.

------
fitzwatermellow
Unreal Engine 4

[https://www.unrealengine.com/ue4-on-
github](https://www.unrealengine.com/ue4-on-github)

~~~
mintplant
The software or the code? From a user perspective, the editor is full of bugs
and unpleasant surprises.

------
xkarga00
All of the btcsuite code (btcd, btcwallet, ...)

------
agumonkey
maru lisp by ian piumarta : Maru is a symbolic expression evaluator that can
compile its own implementation language.

[http://piumarta.com/software/maru/](http://piumarta.com/software/maru/)

------
aggieben
I think the OpenBSD code is quite nice, actually (maybe not the cross-platform
bits).

------
dorfsmay
bottlepy is a one file web framework that just works in both python2 and
python3.

------
myhf
djb servers are really beautiful. Built securely from the ground up, with very
little attack surface area.

[http://thedjbway.b0llix.net/](http://thedjbway.b0llix.net/)

------
iamd3vil
Erlang Virtual Machine - It's an amazing piece of software

------
sam_lowry_
Check for the Beautiful Code book. It has some examples in it.

------
hendekagon
If you mean applications, Adobe Illustrator

If you mean code, Smalltalk or LISP

------
executesorder66
bspwm [0] + sxhkd [1]

    
    
      [0] https://github.com/baskerville/bspwm
      [1] https://github.com/baskerville/sxhkd

------
elkhourygeorges
Ruby on Rails. It's literally beautiful.

------
foota
I'm a big fan of SqlAlchemy for python.

~~~
collyw
Curious why this got downvoted. I have never looked at the source code, but I
often hear that its a very well engineered library.

~~~
foota
You and me both :) I almost asked people why.

I think part of it has to do with the fact that sqlalchemy isn't by any means
a small library and has a lot of elbow grease put into it.

It isn't some ornate stained glass window, it's bullet proof glass.

------
agumonkey
Let's make an OS out of that thread.

------
type0
Emacs

------
collyw
Anything written in Perl.

------
based2
Kay's power tools

------
0xAC1DBA5E
IDTECH[0-9]+

shameless fanboy here

~~~
shumster
visiplanes ftw!

------
motyar
vim

------
seivan
Grand central dispatch is so beautifully designed. Both its API and just
general use. It clicked with me the first time it got introduced and I
abandoned bothering with NSOperarion

~~~
elsurudo
I like NSOperation. Basically because I find it nice to encapsulate tasks that
are to run in another thread in their own class. Not always, of course, but if
they are "long enough", I think they should stand on their own.

------
dschiptsov
There is a few rather universal generalizations about most of these projects
people find beautiful - _the code has been written after throughout
understanding of what one is doing and why_ \- the domain, the first
principles, the logic and the representation. And then one _returns_ and
refines (refactors) the code several times as long as one's understanding
clarifies in the process of writing it down.

Jumping right into IDE to solve a problem is a way to end up with bullshit,
like to write down the contents of undeveloped and undisciplined mind.

"My code is my documentation", or auto-generated "documentation" is bullshit
for the same reasons.

------
sklogic
TeX and Metafont. It'd be hard to find anything even matching these gems.

------
dschiptsov

       nginx/src/core/*

------
decaffito
daisydisk. oh it's smooth, harmonious colours, quintessential

edit: other comments seem to be from a source code perspective ?

------
fufefderddfr
It's funny to read what people think are beautiful apps here.

IMHO, the most beautiful software are always games and entertainment titles...
After all that is the purpose.

Office 2013? It's very useful! I use a classic menu template and got rid of
the ribbon, since the functionality is the same, but in my preferred format.
Beauty does not come into play with office...

I can use it for creating beautiful PowerPoint and excel spreadsheets.

Code is never 'beautiful'. It's either concise, well-written and formatted
well, or it isn't.

~~~
klibertp
> Code is never 'beautiful'. It's either concise, well-written and formatted
> well, or it isn't.

This is not true. You may not value beauty as a characteristic of code, but
there are people who do.

Also, you could say the same thing about novels. "concise, well-written and
formatted well" are features of most published novels; does it mean they all
are the same in terms of beauty?

Beauty is inherently subjective and relative. Personally, I find the code
which form and function fit together pretty. It's the same kind of beauty I
feel when reading poems. You're free to ignore such things, of course, but
saying that the code can _never_ be pretty is actually quite a bit rude to
some people.

~~~
V-2
In my opinion it depends on the type of code. It's unlikely to find beauty in
a run-of-the-mill CRUD app; it can be nice and neat at best. Beautiful code is
possible when there's creativity involved - there should be some conceptual
originality to the code in question. Of course it's not physically impossible
to bury some brilliancy in a bank transaction processing script, it's just a
less probable place to find one.

