简体中文 / [English]


Some Random Thoughts While Slacking Off Instead of Writing Code

 

This article is currently an experimental machine translation and may contain errors. If anything is unclear, please refer to the original Chinese version. I am continuously working to improve the translation.

Just some rambling thoughts. Feel free to skip. -w-

I suddenly felt like writing this down.

It all started yesterday when my laptop’s disk got full, so I began moving dozens of gigabytes of files from the recycle bin to my storage server.

Yes… unlike those people who empty their recycle bin every time they delete a file, I never clean mine. When it gets full, I just move everything out and archive it properly.

Why? Because I always think I might need those files again someday. (And honestly, that does happen quite often.)

While waiting for the files to copy, I idly browsed through my old backups and archives, and even searched for some of my old code. I eventually found a few pieces of code buried deep in a system-reinstall backup from my second-to-last laptop.

Judging by the modification dates, they were written back in junior high—around ninth grade.

One of them was a “Dark Forest Simulator,” a GUI app written in Java Swing. I probably made it right after reading The Three-Body Problem and thought it’d be fun. Proudly wrote over a thousand lines of code, even though it didn’t actually simulate anything.

Another one was a 500-line Python HTTP server. It didn’t use Django, Flask, or any third-party packages. Not even CGI. Back then, I manually implemented an HTTP server from scratch—just raw sockets, single-threaded TCP listening, parsing HTTP request strings, processing them, and crafting raw HTTP responses to send back.

Judging from the comments and variable names, I think I used this to run an HTTP server on my Android phone.

I can’t remember exactly why I chose such a raw, hands-on approach. It definitely wasn’t to learn the HTTP protocol. Most likely, I just didn’t know Flask existed, wanted to do something with Python, and so I followed some documentation and built the protocol layer myself.

If I were asked today to come up with a hundred ways to set up an HTTP server, I still wouldn’t think of implementing it from scratch. Honestly, this method has no advantages whatsoever—there are thousands of mature, robust, and simple alternatives.

That kind of bold (and kind of dumb) approach has long been quietly abandoned.

As I’ve learned more, I’ve become increasingly cautious and obsessive, always chasing “perfect” code. Tools have made our code shorter and cleaner, but while I hesitate and overthink best practices, I haven’t actually built any meaningful projects in a long time. Sure, maybe I don’t have much time—but the real reason is probably my obsession with so-called “Best Practices,” which keeps slowing me down.

Now, seeing these old projects again, I realize this obsession might not be necessary at all. After all, the act of writing code and creating something from scratch is exciting in itself.

Just something to keep in mind.

This article is licensed under the CC BY-NC-SA 4.0 license.

Author: lyc8503, Article link: https://blog.lyc8503.net/en/post/reflection-2022/
If this article was helpful or interesting to you, consider buy me a coffee¬_¬
Feel free to comment in English below o/