Missing Implementor and Abstraction in Bridge Pattern
sheiun opened this issue · 2 comments
The code https://github.com/faif/python-patterns/blob/master/patterns/structural/bridge.py
different from the source https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Bridge#Python
The Bridge Pattern's UML
hi @sheiun , thanks for the issue.
-
In terms of the pattern: Abstraction/interface delegates the work to the implementation/platform.
It is not about interfaces or abstract classes in any particular programming language. -
As I see it - it is not always necessary to create python ABC classes to emulate something like interface from other languages.
TLDR: don't see a problem here.
Thoughts?
One of the benefits of duck typing is that it doesn't force you to define interfaces for everything. You can still do it if you want with a module like abc
as mentioned by @gyermolenko, but it's not mandatory. I also find the current implementation fine.