Ask HN: “Write your own” or “Build your own” software projects
I am looking for writings/tutorials/videos which describe a specific technology or feature by implementing them, ideally in no more than few thousands lines of code (and not just 10-20 line code snippets). Idea is to teach about underlying technology by a hands-on project, which is not overwhelming like trying to implement full-feature game engine and yet captures the essence of technology. Some examples are -
* Build a simple database (https://cstack.github.io/db_tutorial/)
* Containers in 500 lines (https://blog.lizzie.io/linux-containers-in-500-loc.html)
* Malloc tutorial (https://danluu.com/malloc-tutorial/)
* Nativecoin - build your own crypto-currency (https://lhartikk.github.io/)
I'm sure there are great such projects/tutorials in domains like networking, filesystem, databases, compiler, web design, messaging, game design, fintech, etc. If you have come across such writings/projects, kindly share.
86 comments
[ 3.1 ms ] story [ 82.5 ms ] threadInstead, think of it as 12 mostly-independent projects implementing a small part of a computer's functionality: the set of logical gates, the ALU, the CPU, the computer hardware, the assembler, assembly programming, stack op implementation, a compiler, and and OS. Any one of those will be only a few days.
(I'm in the middle of the Coursera course for it and have done 1-5 and 7-10.)
http://www.nand2tetris.org/course.php
It only has up to chapter 6 online, but there's an old version of the book available for free but I don't have the link handy.
https://viewsourcecode.org/snaptoken/kilo/
There's also Handmade Hero (https://handmadehero.org/)
The Raytracing books by Peter Shirley are also very interesting, starting with "Raytracing in one weekend" (https://www.amazon.com/Ray-Tracing-Weekend-Minibooks-Book-eb...)
And lastly there's Crafting Interpreters (http://www.craftinginterpreters.com/)
[0]: http://nand2tetris.org/
Peter also uses area lighting derived from the surroundings, whereas my implementation uses point lights that result in sharp specular highlights. There are no surroundings in my image, only the lights.
No doubt Peter's materials look great. I wish I had time to cover more in my course, but I wanted to make sure I covered the prerequisite vector math as well for students without strong mathematical backgrounds.
Need to find some time to look more and actually try and work thru it.
At the time I wrote it I was modeling the opcodes on the Z80, but I guess I simplified once I'd got it working enough to make myself happy. (Lots of toy-virtual machines, of which this definitely is one, don't implement labels or "decompilers".)
It won't be the JVM but it could be a good start
https://github.com/kanaka/mal
Lots of examples across 72 languages.
Marc-André Cournoyer has put together several different projects: - 2D/3D Game - Database Engine - Virtual Machine - Backend + Frontend Framework - Neural Network - Language - Server - Real-Time Web Engine
Full Disclosure: I am a happy customer of Marc Andre’s “Owning Rails” [2] workshop. No other affiliation.
[1] http://www.greatcodeclub.com [2] http://owningrails.com
On the other hand, it was enough to get me off the ground for my lexer and write a parser that wasn't entirely dumb.
And just FYI, the interpreter we build in the book ends up with ~3900 lines, including the full test suite.
The most interesting and educational one for me is `browser`, which crudely shows web pages and is written in less than a thousand lines of Rust from scratch.
[0] https://github.com/redox-os/orbutils/tree/6764004b9f6f386af1...
The Architecture of Open Source Applications
500 Lines or Less
http://aosabook.org/en/index.html
It's an old classic, using somewhat outdated technologies, but there are more moderns versions floating around, for example a C + x86 one: https://github.com/lotabout/Let-s-build-a-compiler
[1] http://www.linuxfromscratch.org/
[0] https://github.com/markerikson/react-redux-links/blob/master...
[1] https://github.com/markerikson/react-redux-links/blob/master...
[2] https://engineering.hexacta.com/didact-learning-how-react-wo...
[3] https://zapier.com/engineering/how-to-build-redux/
https://egghead.io/courses/getting-started-with-redux
https://hitch-tls.org/
Tldr: all you need to make your own scalable Twitch without coding (but with patience). It’s a <2mo old so feedback appreciated, but my live vlog has been going strong for weeks and syndicating to 4+ other networks.
https://www.destroyallsoftware.com/screencasts/catalog
Not free, but very good.