Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advanced design patterns

Advanced design patterns

A tour of advanced design patterns in Python, including MVC, KVO and ORM.

Marek Stępniowski

January 09, 2012
Tweet

More Decks by Marek Stępniowski

Other Decks in Programming

Transcript

  1. Gamma, et al. Design Patterns Time Hunt, Thomas The Pragmatic

    Programmer Martin Fowler Patterns of Enterprise Application Architecture Cormen, et al. Introduction to Algorithms Kent Beck Test-Driven Development Python Abelson, Sussman Structure and Interpretation of Computer Programs Chris Okasaki Purely Functional Data Structures My first language Stages of a programmer Level 9000 0
  2. Gamma, et al. Design Patterns Hunt, Thomas The Pragmatic Programmer

    Cormen, et al. Introduction to Algorithms thon
  3. t al. erns as atic er Martin Fowler Patterns of

    Enterprise Application Architecture Test-Driven Development Abelson, Sussman Structure and Interpretation of Computer Programs
  4. Design pattern def. General reusable solution to a commonly occurring

    problem within a given context in software design. A design pattern is a description or template for how to solve a problem that can be used in many different situations. last year
  5. Abstract Factory Factory Method Builder Prototype Singleton Adapter Bridge Composite

    Decorator Facade Flyweight Proxy Chain of Reponsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor DP last year
  6. Adapter Bridge Composite Decorator Facade Flyweight Proxy Memento Observer State

    Strategy Template Method Visitor Multiton Object Pool RAII Front Controller Null Object Publish/Subscribe Blackboard Servant Specification CC last year
  7. Foreign Key Mapping Association Table Mapping Dependent Mapping Embedded Value

    Serialized LOB Single Table Inheritance Class Table Inheritance Concrete Table Inheritance Inheritance Mappers Metadata Mapping Database Session State Gateway Mapper Layer Subtype Separated Interface Registry Value Object Money Special Case Plugin Service Stub Record Set PoEAA last year
  8. Embedded Value Serialized LOB Single Table Inheritance Class Table Inheritance

    Concrete Table Inheritance Inheritance Mappers Metadata Mapping Separated Interface Registry Value Object Money Special Case Plugin Service Stub Record Set Model Template View Model View Presenter Model View ViewModel Layers KVO KVC inne last year
  9. MVC ORM bindings KVO KVC delegate responder chain run loop

    observer unit of work data mapper identity map active record
  10. +notify(*) Observer +notify(*) ObserverA +notify(*) ObserverB notifyObservers(*) for observer in

    observerCollection: observer.notify(*) +registerObserver(1) +unregisterObserver(1) +notifyObservers(*) observerCollection Observable Observer
  11. ember • MVC • Templates • KVC/KVO • MVP •

    Templates • KVC/KVO • bindings • run loop
  12. Person = Ember.Object.extend({ firstName: null, lastName: null, fullName: Ember.computed(function(key, value)

    { // getter if (arguments.length === 1) { var firstName = this.get('firstName'); var lastName = this.get('lastName'); return firstName + ' ' + lastName; // setter } else { var name = value.split(" "); this.set('firstName', name[0]); this.set('lastName', name[1]); return value; } }).property('firstName', 'lastName') }); var person = Person.create(); person.set('fullName', "Peter Wagenet"); person.get('firstName') // Peter person.get('lastName') // Wagenet