I fixed the code and made it worse | Issue #86


In a recent video on refactoring complicated business logic, I managed to introduce several subtle errors. Many of you immediately spotted them in the comments. That’s exactly what my first video in 2026 is about.

I walk through the mistakes I made, explain why they happened, and show how easy it is to accidentally change behavior when you refactor code. Even with tests in place and decent coverage, assumptions can sneak in, business rules can shift, and logic can quietly break without anyone noticing.

This video is also about something broader: there often is no single ground truth in business logic. Not the original code, not the refactored version, not the tests, and not even the requirements. As developers, we constantly translate vague, changing reality into deterministic code. And that’s where many of these mistakes come from.

I hope you enjoy the video, and I want to wish you a great 2026, with lots of learning, curiosity, and healthy skepticism (keep it coming!).

Cheers,

Arjan


Do you enjoy my content on YouTube and would you like to dive in deeper?

🚀 Check out my online courses

My courses have helped thousands of developers take the next step in their careers. Check out these courses to help grow your skills and become a senior developer:

👕 Clean code and clean clothes

The ArjanCodes merch store features T-shirts, hoodies, hats, and more for the clean-code-obsessed. Careful though: you'll look dangerously professional while reviewing PRs.

👉 Check out the store here and grab something before your stand-up call starts.

Unsubscribe | Sent by ArjanCodes

Wolvenplein 25, Utrecht, UT 3512 CK

The Friday Loop

Every Friday, you'll get a recap of the most important and exciting Python and coding news. The Friday Loop also keeps everyone posted on new ArjanCodes courses and any limited offers coming up.

Read more from The Friday Loop

You’ve tested the endpoint. The response looks right. No errors in the terminal. So you’re done, right? Well... not quite. In the last video of this year (time flies!) I start with a tiny FastAPI app that "works", and step by step, I turn it into something that’s actually ready for production (and that's more work than you think). That includes: Proper type usage Input validation and error handling Configuration management Rate limiting to prevent abuse ...and more! All using a real example:...

Sometimes your code fails, you change absolutely nothing, and on the next run everything works again. If that sounds familiar, this week’s video is for you. These kinds of failures usually have nothing to do with bad code. They come from the outside world: APIs that time out, networks that briefly misbehave, or LLMs that occasionally return something almost structured, but not quite. It’s frustrating, because the failure feels random, and those types of failures are really annoying to debug!...

If you’ve ever opened a function and instantly regretted it… this week’s video is for you. I’m talking about those legendary functions: ten levels of indentation, contradictory conditions, duplicate branches, mysterious try/except blocks, and business logic so unclear that nobody knows what it actually does anymore. I start with a really messy example and walk through the exact process I use to refactor it safely. You’ll see how to create characterization tests so you don’t break existing...