2 ms·
> Avoid Object-Oriented Programming Yeah, no. Every time I saw code written by someone who attempted to avoid OOP it ended up with passing a huge 'context' par
by raincole 1y ago
> Avoid Object-Oriented Programming
Yeah, no. Every time I saw code written by someone who attempted to avoid OOP it ended up with passing a huge 'context' parameter to most functions, effectively reinventing Python's OOP but worse.
Use pure functions as the starting point, but when you find yourself start passing complex structure around (any abstract word in parameter names, like 'context', 'data', 'fields' is a sign for that) just use OOP.
- chamomeal 1y agoI think of context parameters being a replacement for dependency injection. What parts of OOP are replaced by context params? State?
- gugagore 1y agoI think of context parameters as a replacement for dynamic scoping. I think it can be all of these things, which in my opinion partially undermines the GP's point. Recommended related musings: https://wiki.c2.com/?ClosuresAndObjectsAreEquivalent https://wiki.c2.com/?ClosuresAndObjectsAreEquivalent