Chuck Greb
1 min readJan 19, 2017

--

I totally agree using constructor injection is usually preferable to subclass and override when possible. In this simplified example it would be easy to accomplish but oftentimes we are dealing with a class that is significantly more complex, part of a legacy code base, or maybe we are unable to change the public contract, or maybe even the class is even part of a third party dependency.

--

--

Chuck Greb
Chuck Greb

Written by Chuck Greb

Mission-driven engineering leader. Community organizer. Digital minimalist.

No responses yet