Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    I don't have enough rep here to downvote, but to be frank, this is a bit of FUD. DI frameworks like Spring are just tools. Can they be sharp and dangerous? Of course. Can they be extremely useful and increase efficiency? You bet. A 2hp chainsaw can be extremely dangerous if you don't use it right, but it's going to make far quicker work of that downed tree than your old hand saw. Commented May 25, 2024 at 15:56
  • 1
    The DI framework can only provide you with capabilities. It is the engineer who decides how to use those capabilities. This answer sounds like a case where developers make an interface for everything, even in circumstances where it doesn't make sense just because somebody said "best practice". The DI framework was just the medium through which these design decisions were made. Removing the DI framework, sadly, doesn't remove bad design decisions. Commented May 25, 2024 at 16:36
  • That's kind of the definition of anti pattern, too many dev misusing a pattern, and DI in particular spring is getting very close to that Commented May 25, 2024 at 23:06
  • Worst, I've seen some dev that don't know how to instantiate or architecture anything because the only thing they knew was 1 DI framework Commented May 25, 2024 at 23:10
  • 1
    This is an answer to the question "are DI frameworks a good pattern", not to "are factory methods an anti-pattern". Even as an answer to the first question, this misses various points, such as the ability to easily adapt the factories to the environment the code is running in (dev, testing, production) and others. Commented May 27, 2024 at 9:37