|
|
|
Ask HN: How do you balance between creating flexible systems and YAGNI?
|
|
6 points
by 3737hdhd7372
895 days ago
|
|
I feel this is a constant argument I get into on code reviews Senior devs will give me feedback around “can we make this more generic/flexible/extensible in case we need to do X in the future” But I lean more towards YAGNI I would rather keep it simple/dumb/readable until we actually need the extra functionality, then refactor at that point But I admit it’s hard to find a balance |
|
Separating out business logic by making code more generic _is_ basic good practice.
There doesn't need to be a high cost once you start to do this by default, and it leaves doors open for future changes.
My general feeling is to 'leave doors open' (or allow for flexibility) if the cost of doing so is minimal.
Simple / dumb / readable is something you can achieve no matter which route you take. Comment your code. Be more verbose if it helps legibility and necessary performance won't be impacted.
Fundamentally, the only certain thing is that change _will_ be required at some point. And unfortunately, the decision as to whether something will be needed in the future is rarely something a developer has a say in.
All you can do it make your future dev life easier by leaving doors open, not closed.