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/front_controller.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: Gordeev Andrey <gordeev.and.and@gmail.com> *TL;DR80 Provides a centralized entry poi…
Python版 https://github.com/faif/python-patterns/blob/master/structural/flyweight.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *References: http://codesnipers.com/?q=python-flyweights *TL;DR80 Minimizes memory usage by sharing data w…
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/bridge.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *References: http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Bridge_Pattern#Python *TL;DR80 Dec…
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…
Pyhon版 https://github.com/faif/python-patterns/blob/master/structural/3-tier.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ *TL;DR80 Separates presentation, application processing, and data management functions. """ cla…