Python版 https://github.com/faif/python-patterns/blob/master/structural/mvc.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *TL;DR80 Separates data in GUIs from the ways it is presented, and accepted. """ class Model(obje…
Python版 https://github.com/faif/python-patterns/blob/master/structural/proxy.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *TL;DR80 Provides an interface to resource that is expensive to duplicate. """ from __future__…
Python版 https://github.com/faif/python-patterns/blob/master/structural/facade.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *What is this pattern about? The Facade pattern is a way to provide a simpler unified interface to a more com…
Python版 https://github.com/faif/python-patterns/blob/master/structural/decorator.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *What is this pattern about? The Decorator pattern is used to dynamically add a new feature to an object w…
Python版 https://github.com/faif/python-patterns/blob/master/structural/composite.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *What is this pattern about? The composite pattern describes a group of objects that is treated the same w…
Python版 https://github.com/faif/python-patterns/blob/master/structural/adapter.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *What is this pattern about? The Adapter pattern provides a different interface for a class. We can think ab…