3 ms·
Yeah I've see a lot of people (the author included) call this horrifying, I think it's beautiful! It's a piece of code that is simple on it's surface but has a
by Klathmon 7y ago
Yeah I've see a lot of people (the author included) call this horrifying, I think it's beautiful!
It's a piece of code that is simple on it's surface but has an incredible amount of depth to it. Every single line has a purpose and a backstory. And it solves a very simple to understand problem that many don't even know is a problem until it bites them (most often when trying to use a library in a web worker the first time).
- chii 7y ago> simple on it's surface but has an incredible amount of depth to it that's the definition of bad code: looks simple and innocuous. Does something completely out of the world and "unexpected" (from the point of view of a novice/unknowledgable programmer).
- Klathmon 7y agoBut that's what makes this beautiful in my opinion, it can't really be simplified anymore and still do it's job! It's bad code that has to be bad, it has to be complex, it's inherently difficult and needs to tiptoe around edge cases and avoid pitfalls that 99% of us don't know or have to care about. And yet it's able to do that and still be small, concise, and relatively easy to understand on a basic level, even if you can't quite understand the full reasoning behind why it was created that way on the surface. I have similar feelings about the fast square root function from Quake III. It's horrible and ugly and confusing on the surface, but incredibly powerful, fast, and humbling when you really look at it. And it served a purpose that enabled the game to work!