Here are two things at odds with each other:
- All code needs to be maintained
- Good code is reusable
If all code needs to be maintained, you'll likely be going back to your code on a regular basis to either squash bugs or add new features.
This is normally not an issue...but if good code is reusable, and you want to write good code, then updating a function all of a sudden becomes more of a hassle. There could be a dozen other things that depend on that function, and by improving one thing, you could break half a dozen more.
So, assuming you write good, reusable code, then the more features you add that depend on that code, the harder it gets to maintain that code. Because one change no longer affects one thing. It affects a dozen things. You need to take all that depends on your code into consideration when making even the smallest of changes.
This happens to me a lot when working on big projects:
- I notice an issue with a thing
- I fix that thing
- A bunch of other things break
I usually know right away what happened. Thing B depended on Thing A, and the changes I made to Thing A didn't sit well with Thing B.
There are definitely good ways to reduce this problem. But I feel no matter what you do, the more things you add to your project, the more things you have to make sure play well with others.
And before you know it: the technical debt collector finds you. It becomes time to pay your dues and you find yourself in need of a costly system overhaul.
The technical debt collector scares me.
Now, I am terrified to add features to my projects. Sometimes, the decision to sacrifice a feature is easy:
- Do I really need a custom accordion or can I use
<details>
? - Do I really need a modal system for this site?
- Do I really need a fixed mobile navigation?
Other times, the choice becomes much harder:
- Do I really need a cookie consent system? (It might be required!)
- Do I really need a keyboard-accessible interface? (Yes!)
- Do I really need a screen-reader-accessible website? (Yes!)
I find it's the little details that I like the most. Like how the CSS-Tricks star rotates when you quickly scroll to the top of the page. Or how the Eleventy documentation button is comically huge.
Normally, I wouldn't spend any code on these little details. Because no matter how small, it costs maintenance, but adds little to the product. But these are the kind of good-for-nothing details that I love seeing on the web. Its these passion projects that I love the most.
You got to figure out what level of technical debt you're willing to take on. And so do I.
Perhaps you're fine adding tiny easter eggs. Or perhaps you only want to work on big picture stuff and not spend code on anything not necessary. Or perhaps you're fine going all out and coding everything your heart desires.
I'm still learning to come to terms with the technical debt collector. Maybe I'll get there someday.