Recently, I was handed the document-sharing website, thearchive.fr. While the site mostly served its purpose, its source code was a jumbled mess of Python, presumably hastily written to meet a deadline.
Let me be clear, I see absolutely no problem with "quick and dirty" solutions. However, I do take issue with the additional mess of features that were worked on after the initial launch of the site. The problem was, as it always is, that despite the high quality of the code being added later, the backbone of the site was clearly broken.
When I first gained access to the code, I was met with thousands of lines of legacy code, and it became obvious that a rewrite was in order.
Now, I am by no means a senior developer. In fact, I’m not even a professional developer. But once I decided a rewrite was necessary, I saw an opportunity. I knew I didn’t want to repeat the mistake of the previous owner: using Python, a great language but not one ideally suited for large-scale web development. This realization presented me with a choice: what language should I use?
I realized this was not a decision to take lightly. So, I listed my personal grievances with modern programming languages:
With this list in mind, I briefly considered Rust a language I love to tinker with because of how logical its syntax feels. However, Rust has some challenges: too many type complexities and an HTTP library I found unwieldy.
Enter Go:
I immediately fell in love with Go. The standard library is "batteries-included," the type system is strict but not overbearing, the error-handling system allows you to focus on what matters, and the compile times are lightning fast, especially considering I came from Python, where execution begins quickly.
With my choice made, I dived into the rewrite.
Working with Go has been a pleasure. Nearly everything feels as verbose or concise as it needs to be. Where I once struggled to read deeply nested Python code, my Go code remains clear and easy to maintain. I even had the pleasure of deleting dependencies.txt
from my codebase! The standard library truly covers everything I needed!
The performance improvements were noticeable too, a nice bonus for my rather modest home server setup.
Additionally, I experienced significantly lower memory overhead and was able to completely remove external dependencies.
Primarily, this is a word of caution for other developers: while temporary solutions are great and get the job done, you should always pick the right tool for the job. Python is fantastic, but it’s not always the best fit for backend work. I’m confident that the previous owner could have written almost flawless Go code, and to be fair, I’d struggle to do a better job than he did in Python. But, trying to shoehorn Python (or JavaScript) into every field is simply not ideal.
Take the time to evaluate your tools and avoid the pitfalls of overextending a language beyond its best use cases.
Conclusion:
Learn a new language! Worst-case scenario? You learn to approach problems from a different angle. That’s a win no matter how you look at it.