Better OOP Through Lazily-Instantiated Memoized Dependencies
Better OOP Through Lazily-Instantiated Memoized Dependencies
Well that's quite the mouthful, isn't it?
I've been known to voice my displeasure with the programming pattern known as DI (Dependency Injection), but the question which immediately rises is: if you don't use DI, what do you use? It's important you write loosly-coupled code so that one class isn't overly dependent on another class in a way that can't be modified or overruled.
Thankfully, Ruby provides us with some neat syntax and even metaprogramming abilities (optional I assure you!) to make this process straightforward.
(Questions? Comments? Reply to this email and let me know.)
Jared
Don't miss what's next. Subscribe to Fullstack Ruby: