Re:The Big Oops: Anatomy of a Thirty-Five Year Mistake
by lisbbb on Thursday July 24, 2025 @12:04AM
(#44666804)
Over multiple decades, I have come to reject all of it! Even interfaces.
I watched over and over again people writing code to interfaces, particularly due to Spring, and then none of those interface ever got a second implementation done and were never, ever going to! It was a total waste of time, even for testing it was almost a total waste of time, but I guess writing stubbed test classes that could pretend to return data from a queue or a database was somewhat useful. The thing is, there were easier ways to achieve that.
Re:The Big Oops: Anatomy of a Thirty-Five Year Mistake
by zaphar on Thursday July 24, 2025 @08:03AM
(#44669652)
Those interfaces that never got a second implementation were still defining the contract for interacting with another part of your system and that compile time enforced contract provides value. I have plenty of complaints about Spring but interfaces is not one of them.
- Encapsulation / interfaces is a good idea, a continuation of the earlier ideas of structured programming.
- Mutable state strewn uncontrollably everywhere is bad idea, even in a single-threaded case.
- Inheritance-based polymorphism is painful, both in the multiple (C++) and single (Java) inheritance cases. Composable interfaces / traits / typeclasses without overriding methods are logically and much more useful.