17 ms·
Ask HN: What are some examples of beautiful software?
So I've been reading Paul Graham'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'd like to know examples of beautiful software and what makes it beautiful.
- albertzeyer 11y agoI 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
- hebdo 11y agoVarnish 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 11y agoNice, 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 11y ago"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 11y agoWell, 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.
- c_lebesgue 11y agoI think the complexity of the problem actually speaks in favour of Varnish. The Unix philosophy of writing software is based on the principle of doing one, possibly small thing very well. And that's exactly what Varnish does: it is a reverse-proxy cache that can optionally do a bit of preprocessing on the incoming HTTP requests. Besides, it's not trivial to write a high performance HTTP cache.
- amelius 11y ago> Besides, it's not trivial to write a high performance HTTP cache. Certainly true. I guess that for me "beautiful code" invents some abstractions that transform a problem that initially seems dauntingly difficult into something that is easy to reason about. A proxy cache does not, for me, satisfy the first part of this premise, although I can imagine that the details of such a project take a lot of effort (hence "not trivial", but in a different way).
- qwertyuiop924 11y ago>I guess that for me "beautiful code" invents some abstractions that transform a problem that initially seems dauntingly difficult into something that is easy to reason about. Well then, look no further than any RDBMS. Seriously, for as much as people sometimes rag on the relation model, it is amazing for its power and relative simplicity.
- nickpsecurity 11y agoThe complexity of the problem is significant enough that there's only two verified HTTP servers I recall and a specifying/verifying a web app was considered good work. The bugs, inconsistent perfirmance, and CVE's in various caches also suggests they're not dead simple. They're certainly easier to write than a lot of software. Their simplicity is deceptive, though, when real-world isdues come into play. Esp if result is to be beautiful.
- imtringued 11y agoConcurrent garbage collectors exist. It's nothing new or special. The problem is you need read barriers which means your garbage collector ends up slowing your entire programm significantly down. For some reason Intel and AMD decided it's not worth it to add hardware acceleration for read and write barriers so end up paying a lot of $ for custom designed processors from Azul if you truly need a concurrent garbage collector. http://www.azulsystems.com/products/vega/processor http://www.azulsystems.com/products/vega/processor
- zengr 11y agoSurprised 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 11y agoMaybe they should put that effort into their documentation ;)
- binarymax 11y agoThere is a really good list covered in detail here: http://www.aosabook.org/en/index.html http://www.aosabook.org/en/index.html
- yannis 11y agoKnuth's TeX. Set the standards for documentation, reliability, portability, typography, extensibility and scripting, is well into its fourth decade and is free software.
- dheera 11y agoAnd after those four decades, I still can't figure out how to get my figures to appear where I want them.
- yannis 11y agoGet some help http://tex.stackexchange.com http://tex.stackexchange.com waiting for four decades to get your figures to appear where you want them is too long...
- GFK_of_xmaspast 11y agoThe trick is deciding to want them wherever tex puts them.
- jjgreen 11y agoIn this way commences typographical wisdom.
- j-pb 11y agoYeah, but no. Making a document description language purposefully turing complete is an offence that should be punishable by lashes with a fiberoptic cable.
- w8rbt 11y agoPersonally, 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 11y agoIf 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.
- stray 11y agoThe 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.
- spotman 11y agoRedis is my favorite example. It's some of the easiest to read, digest, and modify source code out there.
- percept 11y agoantirez as Italian Renaissance code painter?
- eternalban 11y agoBeautiful software =/= beautiful code. Beautiful software: Java Virtual Machine (the code? could be entirely un-beautiful ;)
- sklogic 11y agoI'm genuinely puzzled. What can be beautiful anywhere in the JVM?!?
- _pmf_ 11y agoHot loop replacement? Dynamic devirtualization and revirtualization?
- daveguy 11y agoIt's enterprise beautiful.
- kpil 11y agoIt'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 11y ago> 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 11y ago
- malux85 11y agoIn terms of source code? If so my favourites to read are: LLVM and Clang. Redis. TensorFlow. Doom. Sha256k (the one Bitcoin core uses).
- julie1 11y agoDrivers. The interface between the physical world and the digital world. They are the lenses of computers as much as its magic.
- cyphar 11y agoThe 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.
- decaffito 11y agodaisydisk. oh it's smooth, harmonious colours, quintessential edit: other comments seem to be from a source code perspective ?
- xkarga00 11y agoAll of the btcsuite code (btcd, btcwallet, ...)
- jamescun 11y agoSay 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.
- hendekagon 11y agoIf you mean applications, Adobe Illustrator If you mean code, Smalltalk or LISP
- sctb 11y agoArthur Whitney's one-page interpreter: http://code.jsoftware.com/wiki/Essays/Incunabulum http://code.jsoftware.com/wiki/Essays/Incunabulum
- agumonkey 11y agounicorns level in ioccc standards
- mtrn 11y agoThe Go standard library. At least two things coming together: A stripped down language, that explicitly aims to be readable and experienced programmers / authors.
- cyphar 11y agoI'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 11y ago> 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 11y ago> 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 11y ago> 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.
- PeCaN 11y agoLuaJIT. 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.
- chadcmulligan 11y agothe lua vm to, the code is so small but works so well.
- jballanc 11y agoLuaJIT 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 11y agoBut... 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 11y agoD'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.
- superuser2 11y agoNot 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 11y agoNot 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.
- sklogic 11y agoTeX and Metafont. It'd be hard to find anything even matching these gems.
- seivan 11y agoGrand 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 11y agoI 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.
- fufefderddfr 11y agoIt'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.
- fufefderddfr 11y agoI've evaluated what I have used over the years... POSER 4 seems like the most beautiful app.
- klibertp 11y ago> 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 11y agoIn 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.
- apdar 11y agoBeautiful 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-trace.html http://www.cse.unsw.edu.au/~billw/cs9414/notes/prolog/path-t...
- analog31 11y agoTurbo 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 11y agoRelated: - 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 11y agoTurbo Pascal 5 got me into programming. I wish people would build smaller things again.
- agumonkey 11y agoRemember punching in 4 pages of Pascal from a PC Magazine in early 90s. I had no idea about anything, syntax, semantics... it was long and painful.
- enneff 11y agoI also learned to properly program using Turbo Pascal. You might enjoy Go. I find its small language, library, and tools that I can keep in my head leave me feeling similar to how I felt using Turbo Pascal back in the day.
- e12e 11y agoOr perhaps Nim: http://howistart.org/posts/nim/1 http://howistart.org/posts/nim/1 (That article btw, is itself an example of beautiful software. So short and sweet, and still manage to cover a pretty deep rabbit hole of computer science and plain fun, with it's mandelbrot-in-brainfuck-in-nim)
- 11y ago
- jaybosamiya 11y agoNot 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]
- cyphar 11y agoThe recursive Fibonacci definition in Haskell is far more beautiful IMO. But there's always more beautiful one-line snippets (like the regex that can tell you if a number is prime). fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
- CyberDildonics 11y agoWill you still think that when you realize it isn't actually a quicksort?
- eru 11y agoIt'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.
- sahreeg 11y agoThis 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.
- sam_lowry_ 11y agoCheck for the Beautiful Code book. It has some examples in it.
- eliboy 11y agoThe 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.
- Luc 11y agoDoom. 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
- dmytroi 11y agoFMOD [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/FMODStudio/Source/FMODStudio/Public/FMOD/fmod.h https://github.com/fmod/ue4integration/blob/master/FMODStudi...
- donatj 11y ago"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 11y agoHe wrote tinycc, qemu, a new image compression, AND he can write? Who is this man?
- paxswill 11y agoI think you're confusing Fabien Sanglard (writer of the above article) with Fabrice Bellard (prolific programmer)
- molyss 11y agoYou're mixing him up with Fabrice Bellard, I believe (http://www.bellard.org/ http://www.bellard.org/)
- vmorgulis 11y agoYes and both are french :)
- CyberDildonics 11y agoGood catch
- bobbylox 11y agoI've thought about writing an "Another World"-style game engine many times myself.
- stordoff 11y agoI'm not a big fan of the game (love its style, but the gameplay hasn't aged well IMO - playing it for the first time in 2014 probably didn't help), but this is a really neat architecture. Thanks for the link.
- percept 11y agoNobody mentioned git?
- johan_larson 11y agoI'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/sites/3/2015/03/World%E2%80%99s-Biggest-Excavator.jpg http://earthfirstjournal.org/newswire/wp-content/uploads/sit...
- collyw 11y agoI 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 11y agoI 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/
- based2 11y agoKay's power tools
- sevkih 11y agowhy plan9 hasn't come up yet?
- huuu 11y agoFor me it's Blender. - Starts in a sec. - API is the program, the GUI just an interface. - Free but very professional - Shortcuts are ergonomic.
- agumonkey 11y agoReminds me of Maya. I had to sit down for a minute when I realize 90% of the UI is a mel Script. The core of the software is an interpreter/server for some lazy DAG. Actually I wanted to mention Maya, from its performance on piss poor[1] desktop hardware of the late 90s it was able to pull real time Rigid Body dynamics over Nurbs surface (and even pseudo Non Rigid) while staying responsive. [1] Pentium 2 350 with a NV3 ~gpu.
- frik 11y agoBlender 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 11y agoYes. 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...
- awinter-py 11y agoFor 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 11y agoAnd recursive thinking gets your while loop invariants a lot clearer.
- hatsunearu 11y agoRust. It's god damn beautiful. It's design is magnificent, so much so that it seems easy to write beautiful rust code myself.
- matteotom 11y agoAlso, the documentation is one of the best among all languages I have used
- steveklabnik 11y agoThank you so much!
- neikos 11y agoYes, there is a special kind of joy knowing that unless the underlying infrastructure has a problem you have handled all the edge cases, and it is still readable.
- AsyncAwait 11y agoI also think Rust is magnificent, the way they combined manual memory management with the feel of an automatic one, all at compile time, paired with the rest of the type system; functional, compossible and flexible, is exactly the level of practical, useable innovation I would like to see more frequently.
- ycmbntrthrwaway 11y agodwm: http://dwm.suckless.org/ http://dwm.suckless.org/
- gravypod 11y agoI found this a while ago on hackernews: https://github.com/Hypsurus/skod https://github.com/Hypsurus/skod Amazing source.
- ycmbntrthrwaway 11y agoWhy 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 11y agoNot my software, but if you have looked at other FTP clients this is an amazing thing to read though.
- ycmbntrthrwaway 11y agoOther 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 11y agoI 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.
- lobster_johnson 11y ago
- ycmbntrthrwaway 11y agohttp://suckless.org/rocks http://suckless.org/rocks
- weej 11y ago"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
- ponderatul 11y agoI need to get myself a copy!
- vram22 11y agoYes. 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.
- phkahler 11y agoSolveSpace - 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 11y agoCool! I was looking for a decent free CAD program. Will check it out.
- phkahler 11y agoBe 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.
- paulsutter 11y agoThe 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 11y agoWhen 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?
- rahimnathwani 11y agoThis paper[0] says "In addition it receives a reward rt representing the change in game score." [0] https://www.cs.toronto.edu/~vmnih/docs/dqn.pdf https://www.cs.toronto.edu/~vmnih/docs/dqn.pdf
- slpsys 11y agoThere 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 11y agoYeah, I love sethbling. And the lua for MarI/O is only one file, and a relatively small one at that.
- ycmbntrthrwaway 11y agoX11 terminal emulator as one C file: http://git.suckless.org/st/tree/st.c http://git.suckless.org/st/tree/st.c
- reitanqild 11y agoKind 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.)
- s_dev 11y agoApparently Doom 3: http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-...
- deleted 11y ago[deleted]
- mcculley 11y agoI 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.
- pmarreck 11y agohttp://smile.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047?sa-no-redirect=1 http://smile.amazon.com/Beautiful-Code-Leading-Programmers-P... 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.
- joshuata 11y agoMy 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 11y agois 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 11y agoI'd argue that good engineering is beautiful also.
- marcolinux 11y agoAnd according to them, valgrind (and linux) can be qualified as beautiful piece of code[1]: "Valgrind is perhaps the most amazing and useful developer tool in the world. Valgrind is a simulator - it simulates an x86 running a Linux binary. (Ports of Valgrind for platforms other than Linux are in development, but as of this writing, Valgrind only works reliably on Linux, which in the opinion of the SQLite developers means that Linux should be the preferred platform for all software development.) As Valgrind runs a Linux binary, it looks for all kinds of interesting errors such as array overruns, reading from uninitialized memory, stack overflows, memory leaks, and so forth. Valgrind finds problems that can easily slip through all of the other tests run against SQLite. And, when Valgrind does find an error, it can dump the developer directly into a symbolic debugger at the exact point where the error occur, to facilitate a quick fix." [1] https://www.sqlite.org/testing.html https://www.sqlite.org/testing.html
- trentnelson 11y agoAesthetically, SQLite is some of the most perversely formatted C code I've ever seen. I find it more painful to view than GNU-style C.
- braythwayt 11y agoThe 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
- agumonkey 11y agomaru 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/
- wstrange 11y agoZFS 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 11y agoThe source code is pretty neat too. At least at FreeBSD 9.2.
- agumonkey 11y agoLet's make an OS out of that thread.
- vmorgulis 11y agoOberon, 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
- rwallace 11y agoThe 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 11y agoErm... Which Scheme? Or do you mean the standard?
- qwertyuiop924 11y agoI 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.
- type0 11y agoEmacs
- CoryG89 11y agoI 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 11y ago> 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 11y agoIndeed. 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_Architecture_(RINA) https://en.m.wikipedia.org/wiki/Recursive_InterNetwork_Archi...
- tbrock 11y agoC: 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.
- Biganon 11y agoIsn't Flask made by Armin Ronacher?
- tbrock 11y agoOh right, whatever Kenneth Reitz did then
- Hovertruck 11y agoNotably the "requests" library
- abustamam 11y ago
- muzani 11y agoJSON. 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.
- kpil 11y agoIt's having a rather half-hearted schema definition language though, and the json-encoding itself contains a few fuzzy corners, lacking important data types, and is to be honest not particulary sophisticated. On the other hand, it's readable, good enough for most tasks, not overly complex, and it's nicer than XML. That is not a small acomplishment. Still... I am waiting for ASN.2 ... All good features and ideas from ASN.1 without everything bad, which is rather much too :-) One good idea from ANS.1 is "criticality", how important a future extension to a protocol is, which means that older participants can still handle newer messages, if they contain no "critical" extensions. Another good thing is that the encoding is detached from the schema representation, which is too good for people to appreciate. You can use the same schema to send XML, BER (original simple tag-value binary format), PER (no unneccesary bytes are sent), or plain strings. (No JSON yet - at least in the standard) In that way, it's possible to select encoders that suits the mission. Send human-readable data when size/speed/consistency does not matter, and packed super efficient messages when sending from a space probe. Same schema. ASN.1 is ugly as hell though, and clearly designed by committee.
- stray 11y ago> JSON is just this beautiful thing that lets you store data however you want. What if I want to store integers? Not floats. Integers.
- 11y ago
- fitzwatermellow 11y agoUnreal Engine 4 https://www.unrealengine.com/ue4-on-github https://www.unrealengine.com/ue4-on-github
- mintplant 11y agoThe software or the code? From a user perspective, the editor is full of bugs and unpleasant surprises.
- fitzwatermellow 11y agoUnreal Engine 4 https://www.unrealengine.com/ue4-on-github https://www.unrealengine.com/ue4-on-github
- jpgvm 11y agoPostgreSQL. The best C codebase I have ever worked with and IMO very beautiful and well designed.
- elkhourygeorges 11y agoRuby on Rails. It's literally beautiful.
- mlvljr 11y agoYour C++ compiler. Kidding.
- e12e 11y agoMight add that what I've seen of the internals of both Sqeak/Pharo Smalltalk and Racket would probably qualify as beautiful software.
- zachrose 11y agoNot 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
- im_down_w_otp 11y agoJoe Armstrong's "Universal Server".
- myhf 11y agodjb servers are really beautiful. Built securely from the ground up, with very little attack surface area. http://thedjbway.b0llix.net/ http://thedjbway.b0llix.net/
- dorfsmay 11y agobottlepy is a one file web framework that just works in both python2 and python3.
- userbinator 11y agohttps://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.
- foota 11y agoI'm a big fan of SqlAlchemy for python.
- collyw 11y agoCurious why this got downvoted. I have never looked at the source code, but I often hear that its a very well engineered library.
- foota 11y agoYou 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.
- ktRolster 11y agoEarly 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-source-code/ http://www.computerhistory.org/atchm/macpaint-and-quickdraw-... 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"
- 0xAC1DBA5E 11y agoIDTECH[0-9]+ shameless fanboy here
- shumster 11y agovisiplanes ftw!
- cdcarter 11y agoCamping -- it was _why the lucky stiff's Ruby web-microframework, under 4k of code and absolutely brilliant from top to bottom.
- numlocked 11y agoqmail 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
- altitudinous 11y agoWell, 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 11y agoIf we are going that road, many games qualify. (Portal takes my vote)
- Quiark 11y agoIPFS 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.
- lkrubner 11y agoAnything 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
- escherize 11y agoWow, I knew about aleph, but just learned of automat. I was always a fan of FSMs in school, and automat's readme gave me goosebumps. Thanks!
- slantedview 11y agoI was going to post this. Not only is Zach's work very creative, but it's very well written, composable stuff.
- dschiptsov 11y ago> "Always be composing" the ideas were stolen from the Wizards talk 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/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- prospero 11y agoI wasn't aware of this talk, so I'm not sure how I could have stolen anything from it. Cool link, though, thanks.
- dschiptsov 11y agoI should have used quotes.
- zem 11y agoi 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.
- davepeck 11y agoI'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/src/raster/ftraster.c#n74 http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree...
- sysret 11y agoexamples: 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.
- nstart 11y agoThis 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.
- lucaswiman 11y agoPeter 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 11y agoOuch. 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/Sudoku.Solver/Program.cs https://github.com/mdpopescu/public/blob/master/Sudoku/Sudok... - 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.
- lewisjoe 11y agoWerkzeug'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 11y agoYou 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 11y agoYeah, my bad. Updated the details. Thanks. 'Mitsuhiko' is a hard name to remember.
- iamd3vil 11y agoErlang Virtual Machine - It's an amazing piece of software
- dschiptsov 11y agonginx/src/core/*
- executesorder66 11y agobspwm [0] + sxhkd [1] [0] https://github.com/baskerville/bspwm [1] https://github.com/baskerville/sxhkd
- dschiptsov 11y agoThere 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.
- baby 11y agoLook at Laravel, every comments is made on 3 lines that go smaller and smaller. The amount of details in the framework is pretty huge.
- murukesh_s 11y agoWhy 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..
- Ace17 11y agoI'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!
- wingerlang 11y agoWhat if OP wanted different examples and the explanation why they are beautiful in the posters opinion? Seems like it would get more interesting submission than simply asking for "small" software.
- lucideer 11y agoI completely agree with wingerlang here, and I think the fact that the OP ends with > ... and what makes it beautiful. makes this clear. It's a subjective question deliberately looking to elicit subjective answers, with the point of interest being the individual justifications behind those answers. However, despite my disagreement with your sentiment (calling for a more objective question), you did actually answer the question as well. Thanks for the list.
- ponderatul 11y agoHi, that is exactly what I meant. The reasoning behind it is just as important as what it is your example. Paul Graham says in Hacker's and Painters that “... If there is such a thing as beauty, we need to be able to recognize it. We need good taste to make good things. Instead of treating beauty as an airy abstraction, to be either blathered about or avoided depending on how one feels about airy abstractions, let's try considering it as a practical question: how do you make good stuff?” So I'm really looking for patterns here. 'Clean code' seems to be a characteristic of beautiful software. Another one seems to be ' code is clever ' from what I see. That's all I'm doing here, finding some patterns. So if I would've asked what are some example of beautiful software ( where beautiful means 'clean code') I might've gotten a more focused set of responses, but then I would've missed out on the other dimensions of beautiful.
- z3t4 11y agoThis 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.
- jarcane 11y agoThe 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 11y ago>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.
- booop 11y agoI'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-with-chris-sawyer-the-creator-of-rollercoaster-tycoon http://www.eurogamer.net/articles/2016-03-03-a-big-interview... and http://www.chrissawyergames.com/faq3.htm http://www.chrissawyergames.com/faq3.htm
- ranko 11y ago"If Hemingway Wrote Javascript" (https://www.nostarch.com/hemingway https://www.nostarch.com/hemingway, see also https://javascriptweblog.wordpress.com/2015/01/05/if-hemingway-wrote-javascript-explained/ https://javascriptweblog.wordpress.com/2015/01/05/if-hemingw...), 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.
- motyar 11y agovim
- rpdillon 11y agoThe 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.c https://github.com/emacs-mirror/emacs/blob/master/src/buffer...
- collyw 11y agoAnything written in Perl.
- aggieben 11y agoI think the OpenBSD code is quite nice, actually (maybe not the cross-platform bits).
- lambdafunc 11y agoPresto also has a high quality codebase: https://github.com/facebook/presto https://github.com/facebook/presto