Hacker News new | past | comments | ask | show | jobs | submit login
Build Your Own X (github.com/codecrafters-io)
528 points by pretext on July 19, 2022 | hide | past | favorite | 82 comments



The tutorials listed here can vary a lot in quality. For the text editor section for example, there is a very good tutorial in C which guides its reader through the development of a kilo-like text editor with buffer management and everything, and next to that a YouTube video claiming to teach how to build a text editor in Python but is actually a (poorly coded) simple GUI using the text editor component of the Tkinter library. Well, it can serve as a Tkinter tutorial, but not as a "build your own text editor" one.


I don't think this is necessarily a bad thing on its own - it's actually quite reasonable that one person's focus when "building a text editor" is going to be lower level along the lines of "how do I write a buffer and process key presses" while another person's focus might be "how do I embed a text editor in my app so I can add my own UI around it".

But it probably does warrant some kind of rating or explanation for each tutorial, especially for the less experienced developer.


I wonder if it'd be possible to update the listings with filters or ratings. Difficulty, hardcore-ness, ETA to MVP, whatever. Even some simple notes or emojis would help.


Nonetheless quite often a suboptimal tutorial is much better than no tutorial at all.

Anyway, IMHO taking a tutorial for a copy-paste solution is really a larger problem than low quality tutorial contents.


In this comment I will teach you how to build your own bicycle! Step 1: Go buy a bicycle. Step 2: Now let's paint it and get some cool stickers!


I'd like to see the following added:

*Build your own firmware/bootloader

*Build your own FPGA/ASIC

*Build your own sound library/engine/driver

*Build your own GUI Toolkit/graphics library

*Build your own font (vector and bitmap)

*Build your own character encoding standard (à la ASCII, Unicode, etc.)

*Build your own MMO

*Build your own protocols

*Build your own mouse

*Build your own keyboard

*Build your own mail client and server

*Build your own VoIP client (à la Discord, Skype, etc.)

*Build your own instant messenger ( à la IRC, AOL, etc.)

*Build your own programming language

*Build your own markup/typesetting language

*Build your own compiler, interpreter and assembler

*Build your own machine code & microcode

*Build your own filesystem

*Build your own softmodem

*Build your own SDR

*Build your own BBS

*Build your own painting application/photo editor

*Build your own internet browser

*Build your own cryptography

*Build your own compression algorithms

*Build your own webcam and webcam client

*Build your own virtual voice assistant

*Build your own girlfriend ;)


> Build your own programming language

https://craftinginterpreters.com/ is excellent for this



> Build your own webcam and webcam client

This might help, depending on how deep you want to go:

https://m.youtube.com/watch?v=PaXweP73NT4


> Build your own keyboard

This is something I've been interested in lately as well & came across this video: https://www.youtube.com/watch?v=M_VuXVErD6E

It's targeting a split keyboard, but I think it details the general steps involved pretty well.


I was thinking of posting something along these lines, nice to see someone else also aware of this niche!

Software point of view, you'd like to use QMK or ZMK, and KiCad to design the hardware (PCBs). Reddit's r/olkb and r/ergomechkeyboards are great places to start!

Bonus: QMK supports trackpads and nipple-pointers too! (Not sure about mice though)


>> Build your own girlfriend

Or build your own religion. Them you can build as many humans as you want.


^ Snarky yet accurate comment about Elon Musk and "The Mission".


I would love to see "Build your own protocol"


I would love to understand the architecture of an MMO


wwwweird science!


> Build your own MMO

The first M makes this infeasible.

> Build your own girlfriend ;)

Eww. And illegal.


[flagged]


I knew someone would say this.

"Never roll your own cryptography", despite the ambiguity of its phrasing, means never use uncertified crypto in production unless you're willing to take the risk. It doesn't mean to never build cryptography without an expert's permission. Everyone who has ever published world-class cryptography has rolled their own crypto.


That is what I meant by my comment, I was not referring to learning exercises, I should've been more clear, though.


My apologies then. I've seen this phrase repeated ad nauseam even when its not warranted and I want to point out that it shouldn't be followed blindly.


“20 years of abstinence-only cryptography education hasn’t gotten us anything but an endless supply of bad crypto in production systems”


People absolutely should. The best way to understand how something works is to build it.

What that phrase means is you shouldn't use hobby crypto libraries for any important production services. But that's also not the point behind "Build Your Own" type projects. So your advice isn't correct in this scenario.


Everyone should build one, as early as possible and fail and then come to this realization.


the only issue is what it means to "fail". it's not really an issue until you're hacked and then it's too late


to fail doesn't mean to fail in production


right, but how else are you going to know your crypto is broken? what unit test is going to fail?


if you need expert opinion on your library order a security audit. otherwise even expert-designed systems have failed and most people know that it is very unwise to give security guarantees to devices that have so many moving parts


Interesting, this page has been around for a while and did not used to belong to codecrafters.io. I guess they bought the original repo so it would redirect here? Or maybe the original author started codecrafters.io? Indication of change here: https://github.com/codecrafters-io/build-your-own-x/commit/6... when the (non)copyright changed a week ago.

Here's what I remember seeing (someone's archive of it anyway): https://github.com/Sevistuo/https-github.com-danistefanovic-....


Likely was sold by the guy so the biz can use it as a funnel for leads


they might just be selling an ad spot :)


One advice: for any of these topics take a tutorial directed at language X and implement the solution in language Y. This will prevent you from mindlessly copying the code and will force you to understand what you are doing.


I thought it was explaining how to implement an X server.


I did that too. I was weirdly disappointed when I discovered it wasn't.


If anyone has a resource for this that isnt the X11/Xlib docs or man pages, I would love to read it



Amazing, thank you! I’ve searched for similar but never used the right keywords I guess


It’s not that.


https://zserge.com/posts/ has some good “build your own X” articles, including:

* a clone of React.js and Vue.js in <1K bytes minified * a web-based code editor and office suite * a chess engine * a TCL interpreter * a two-step verification client * a simplified C compiler


Great list. You might also want to checkout this one: https://github.com/practical-tutorials/project-based-learnin...


Surprised to see 2 of my blog posts on there. Both about building search engines. Oddly missing the posts that I would consider a lot better about the subject. Rather flattering though.


Please share your suggested pages!


The title made me assume it was a reference to building your own x.org - alas! Nevertheless, a fascinating repository.


> The title made me assume it was a reference to building your own x.org

Same. It would be an insane undertaking, and I was moderately disappointed upon clicking the link.


I remember The Great Code Club (https://www.greatcodeclub.com), started by Marc-André Cournoyer. It was a wonderful idea and it provided me hours of fun and learning. If you are into this sort of thing, you will love it.


I thought this was about building your own X11. Which seems to be missing from the list.


Not sure it is off-topic or not, but I wonder what resources it would contain to help design a software with undo/redo feature.


A Merkle-tree data structure + an append only log with checkpoints + a command processor would provide a basic foundation.

Your data can be represented in a Merkle-tree. You provide operations add-node, delete-node, move-node etc., on the Merkle-tree and build a command processor that takes as input a checkpointed Merkle-tree snapshot (could be empty when you start) and a log of operations (essentially an sequence of operations). The command processor then applies the series of tree operations in the log to build the final state of the tree. The special checkpoint operation saves a snapshot of the Merkle-tree.

This basic set of operations should allow you to do unlimited undo/redo/transaction playback capabilities.

Also see: Command Pattern, https://en.wikipedia.org/wiki/Command_pattern


Simple. For every operation performed by the user, you push a function to the end of a list that undoes that operation. When the user presses undo, you pop the function from the end of the list and call it.


check out emacs' undo-tree for a cool implementation

https://www.dr-qubit.org/undo-tree/undo-tree.txt


Emacs’s undo system is quite frankly amazing. Not only can you recover any state through an arbitrary number of undo and redo operations, but you can also localize the undo/redo operations to a selected region of the buffer.

It’s the number one feature I miss when I’m using another editor.


Am I missing something or would it just need to be a doubly linked list? It really depends on your program state being… stateful (so you can navigate forwards and back consistently)


If you store the total application state for each step then it's simple, but consumes lots of memory.

If you want to store something more like a diff, there are choices. For example, you could have code to undo each operation, but you can also implement undo by going back to some checkpoint and then recomputing all operations between the checkpoint and now. Latter consumes more CPU, but comparable memory and a lot less code surface for bugs.


If you use persistent data structures, you can store the total state, and you'll get deduplication of the common parts, which brings down the memory usage to a more reasonable amount. This is what git does essentially, which gets you O(1) checkout to arbitrary steps in the future/past. This also means you don't need to design/pick a diffing algorithm, which you would be locked into (since changing the diffing algorithm would mean you couldn't consume old diffs).


Git does store deltas when packing objects because storing all distinct objects as-is would be too inefficient for large repos. This isn't the same text diffs as shown to the user but there is still a diffing algorithm that all future git versions need to support (well, at least the patch counterpart).



For half a second my brain thought this post was about writing your own X11 implementation. I admit, I was intrigued.


I was hoping to see "build your own virtual terminal emulator". But alas! Anybody have a suggestion?



The idea is absolutely great... but the quality of the listed links/resources fluctuate a lot.


I’ve had this list bookmarked for years and love referring back to it for ideas. It’s also one of the first things I send to new(er) programmers so they can make cool tangible stuff & avoid tutorial burnout.


It's quite sad that "Build your own frontend framework/library" is just a bunch of "Build your own React" links...


What do you think it should be?


This is really awesome. I love how it covers a lot of different topics.


Build your own subtractive|fm|additive|granular|etc synthesizer.


I was scrolling up and down the repo looking for what I assumed was the tutorial - how to build your own X-server, haha


If you follow a guide or conceptually learn how write X, and write your own version of GPL code, are you now free from copyright restrictions?


Yes, if you have done a clean room implementation.


It definitely helps to use a different language, as another comment suggests.


Looks like a lot of fun. Will try it out!


Dreaming of HN where 100% of entries are like this and 0% are propaganda and narrative steering.


It’s hilarious that you would say this, because this repo is a lead generator for a YC backed company - CodeCrafters. They’re hoping you click through and sign up for their $800/year service which teaches you how to build these things.

This is advertising, pure and simple. That’s not a bad thing, but it’s funny that you praised it as being the exact opposite.


Which propaganda? Would you mind referring to a recent example?

This submission is indeed really great, but I don't see HN as being such a bad platform as you're suggesting it is. There's really a lot of value being shared here.


Everything covid, global warming, world famine, broken supply chain -related.


Oh, with referring I meant a link to a submission which you recently read and got annoyed by it.



I think https://lobste.rs/ is pretty good at staying focused on programming


Will check, thanks!


What I want is "Build your own X, but better".


Thank you, this will keep me entertained for months!


This thing is not really cool.

It's much more! Kudos!


I love this but it needs more Rust :)


Be the change you want to see in the world.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: