Michael Long
Aug 23, 2022

--

Agree with almost all of this... but you've now exposed two dependencies in the code. The parent code now needs to know about the storage service... and instantiate the storage type.

It's the fundamental problem of constructor injection. My code now needs to know the internals of the object I want to use... and maybe even the internals of the internals of the internals...

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)