When it comes to writing software, two of the most popular schools of thought are:
- YAGNI (or “you aren’t gonna need it”),
- and Generalization (or maybe “premature generalization”).
They aren’t necessarily exact opposites, but for where I’m going with this, it’s worth treating them as such.
In my experience, projects boil down to projects for customers or products that you’re building to sell. This isn’t to say we don’t build products for customers, so maybe it’s just easier to say:
- “Hey, I’m building this for someone else,”
- or, “Yeah, I’m building this for me [for profit].”
Here’s the thing: I often find that when it comes to building things for other people, it’s easier to want to go about Generalization for their code and YAGNI for our code.
So which one is right? Or is there even a right one?