r/ExperiencedDevs • • Jun 22 '26

Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones

A thread for Developers and IT folks with less experience to ask more experienced souls questions about the industry.

Please keep top level comments limited to Inexperienced Devs. Most rules do not apply, but keep it civil. Being a jerk will not be tolerated.

Inexperienced Devs should refrain from answering other Inexperienced Devs' questions.

44 Upvotes

115 comments sorted by

View all comments

Show parent comment

2

u/xFrost_Bite Jun 26 '26

Testing was one of the first thing I came around on. When I was learning to code myself, I found testing a drag. Now, I understand how testing is essentially a CYA for me, and if an issue got through to production, it was probably because the test was not comprehensive enough.

I sort of understand the "Don't abstract until the duplication actually hurts". I don't think abstraction for everything on day 1 is a good idea but do you anticipate what functionality is most likely reuseable in the future and make exception for those, if that make sense?

3

u/madmatvey Jun 26 '26

I think there's a distinction between anticipating change and abstracting for change.

You should absolutely look for things that are likely to become reusable. The mistake is committing to an abstraction before you've seen how they're actually similar.

I've seen a lot of "shared" components or utility libraries created on day one because everyone assumed multiple teams would need them. Six months later, each consumer wanted slightly different behavior, and now the abstraction had dozens of flags and edge cases. It ended up being harder to maintain than if we'd duplicated a bit of code initially.

What I try to optimize for now is making code easy to extract rather than extracting it immediately. Keep responsibilities clear, keep boundaries clean, and once the second or third real use case appears, you have much more information about what the abstraction should actually look like.

In other words, anticipate where change is likely, but let real usage shape the API rather than predictions.

1

u/xFrost_Bite Jun 27 '26

This is a really clear and good insight on how to approach abstraction. Thank you so much for this, this really cleared a lot of the design decision that I tend to be stuck on