3 ms·
the standard Pythonic if approach+composition using kwargs seems to be more superior than Java-like zoo with classes, subclasses, interfaces, etc. that's the b
by slt2021 4y ago
the standard Pythonic if approach+composition using kwargs seems to be more superior than Java-like zoo with classes, subclasses, interfaces, etc.
that's the beauty of python, add one line and you add new feature/behavior, comment out one line and you disable a feature.
all code is on one screen and I dont have to scroll or navigate class hierarchy to understand code author's "design".
when I work in large Java repo, I need to read a thousand pages of doc just to understand what each class is doing and how they work together in a 1000+ class call stack.
Adapters, Bridges, AbstractBeanFactories, and other stuff still causes me nightmares
- tgv 4y agoGenerally speaking, kwargs in dispatch functions is a dangerous software engineering practice, IMO. I've debugged more function calls than I can remember, just because someone had mixed up functionality. > Adapters, Bridges, AbstractBeanFactories, and other stuff still causes me nightmares The "Javanic" approach is dreadful, I agree, but adapters and bridges (or really: using interfaces) can give you a clean and small design. I think that's what you're trying to achieve with "Pythonic if approach+composition using kwargs". But as usual, what's the best implementation depends on the context.