Comment by cube00
21 hours ago
I think of this every time I see hundreds of interfaces, all with single class implementations.
The excuse always comes back "but it's extendable", how many implementations of a ConfigurationSingleton could you have in an application?
Put the class in and if you need the interface later any refactoring tool can easily create it when you have that second class (which 99% of the time will never happen).'
This is what worries me when people say AI is great for boilerplate, I worry this is the kind of boilerplate they'll be creating because they've put "must be well designed and extendable" in their AGENTS.md.
One great use of interfaces is for automated testing, the test class can implement the same interface specification as the code.
A long time ago I also used structuremap to automatically wire up default implementations of interfaces, which reduced the need to write boilerplate code enormously. It also helped separate concerns because separating out interfaces means I could concentrate on only the specification of the class.
I haven't seen AI systems do this in my experience unless you specifically ask for it. Sometimes the outcomes can be a bit complex, but I find myself having to prompt it specifically when I want something more abstract.
Honestly curious question: why do you think an interface adds complexity?
An interface specifies a contract that its users can depend on. Having one saves me from reading implementations of dependencies when reading a class.