by ryan-duve · 1y ago · 0 comments
Could I get you started? Or could you point me to a place to get myself started? I primarily code in Python and I've found dependency injection, by which I mean giving a function all the inputs it needs to calculate via parameters, is a principle worth designing projects around.
class C:
def __init__(self):
self.foo = ConcreteFoo()
with: class C:
def __init__(self, foo: SupportsFoo):
self.foo = foo
where SupportsFoo is a Protocol. That’s it.