Slides of the 'Design patterns in Javascript' talk in @MadridJS
Code from talk can be found in:
https://github.com/tcorral/DesignPatterns_code
Running examples in:
http://tcorral.github.com/Design-Patterns-in-Javascript/
Code of examples in:
https://github.com/tcorral/Design-Patterns-in-Javascript
5. • Abstract those that vary.
• Program to an interface not an
implementation.
• Favor composition over inheritance.
• Strive for loosely coupled designs
between objects that interact.
• Classes should be open for extension
but closed for modification.
• Depend on abstraction. Do not
depend on concrete classes.
38. Converts the interface of a class into another
the clients expect.
Lets classes work together that couldn't otherwise
because of incompatible interfaces.
46. Defines an interface for creating an object, but
lets subclasses decide which class to instanciate.
Factory Method lets a class defer instanciation
to subclasses.
54. Encapsulates a request as an object, thereby letting
you parameterize other objects with different
requests, queue or log requests, and support
undoable operations.
70. Defines a family of algorithms, encapsulates each
one, and makes them interchangeable.
71.
72.
73.
74. Compose objects into tree structures to represent
part-whole hierarchies.
Lets clients treat individual objects and
compositions of objects uniformly.
75.
76.
77.
78. Separates elements of the application in layers.
Logic, data and views are separated.