Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Attain Clean Code in
Sitecore Solutions using
Design Patterns
Mike Reynolds
Hanson Dodge Creative
@mike_i_reynolds
Sitecor...
What’s a Design Pattern?
• “General reusable solution to a commonly occurring problem“
• http://en.wikipedia.org/wiki/Soft...
Design Patterns: History
• Proposed by Christopher Alexander (1970s)
• A Pattern Language: Towns, Buildings, Construction
...
Design Patterns: History
• Gang of Four (GoF) Book (1994)
• Design Patterns: Elements of Reusable Object-Oriented Software...
Design Patterns: Examples
• Adapter
• Decorator
• Composite
• Chain-of-responsibility
• Null Object
Sitecore User Group Co...
Adapter Pattern
• Allows the interface of an existing class to be used from another
• A “wrapper”
• Makes existing classes...
Adapter Pattern
Sitecore User Group Conference 2015 7
Decorator Pattern
• Encapsulates an object with the same interface
• Also a “wrapper”
• Adds/removes/alters functionality ...
Decorator Pattern
Sitecore User Group Conference 2015 9
Composite Pattern
• Encapsulates a collection of objects with the same interface
• Treats the entire collection as one obj...
Composite Pattern
Sitecore User Group Conference 2015 11
Chain-of-responsibility Pattern
• Composed of command objects and a series of processing
objects
• Each processing object ...
Null Object Pattern
• Represents the “null” state of an object
• Provides methods with no behaviour
• Removes the need of ...
Learn More!
• Recommend Books
• http://amzn.to/UPNN2F
• http://amzn.to/1ppJHeH
• http://amzn.to/1EZEa3z
• http://amzn.to/1...
Get In Touch!
Blog: http://sitecorejunkie.com
Twitter: @mike_i_reynolds
LinkedIn: http://linkd.in/1Csu1N8
Sitecore User Gr...
Questions?
Sitecore User Group Conference 2015 16
Thank you
Sitecore User Group Conference 2015 17
Upcoming SlideShare
Loading in …5
×

Attain Clean Code in Sitecore Solutions using Design Patterns

1,048 views

Published on

SUGCON Europe 2015 presentation on Design Patterns in Sitecore.

Published in: Software
  • Login to see the comments

  • Be the first to like this

Attain Clean Code in Sitecore Solutions using Design Patterns

  1. 1. Attain Clean Code in Sitecore Solutions using Design Patterns Mike Reynolds Hanson Dodge Creative @mike_i_reynolds Sitecore User Group Conference 2015 1
  2. 2. What’s a Design Pattern? • “General reusable solution to a commonly occurring problem“ • http://en.wikipedia.org/wiki/Software_design_pattern • Describes how to solve a problem • Can be across different contexts • Provides a common language for developers • Is not a cookie-cutter code solution! Sitecore User Group Conference 2015 2
  3. 3. Design Patterns: History • Proposed by Christopher Alexander (1970s) • A Pattern Language: Towns, Buildings, Construction (http://amzn.to/1BtaaIH) • Kent Beck and Ward Cunningham applied the concept to programming (1987) • Presented results at Object-Oriented Programming, Systems, Languages & Applications (OOPSLA) Sitecore User Group Conference 2015 3
  4. 4. Design Patterns: History • Gang of Four (GoF) Book (1994) • Design Patterns: Elements of Reusable Object-Oriented Software. (http://amzn.to/UPNN2F) • Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides Sitecore User Group Conference 2015 4
  5. 5. Design Patterns: Examples • Adapter • Decorator • Composite • Chain-of-responsibility • Null Object Sitecore User Group Conference 2015 5
  6. 6. Adapter Pattern • Allows the interface of an existing class to be used from another • A “wrapper” • Makes existing classes work with others without modifying their source code Sitecore User Group Conference 2015 6
  7. 7. Adapter Pattern Sitecore User Group Conference 2015 7
  8. 8. Decorator Pattern • Encapsulates an object with the same interface • Also a “wrapper” • Adds/removes/alters functionality on the inner instance Sitecore User Group Conference 2015 8
  9. 9. Decorator Pattern Sitecore User Group Conference 2015 9
  10. 10. Composite Pattern • Encapsulates a collection of objects with the same interface • Treats the entire collection as one object Sitecore User Group Conference 2015 10
  11. 11. Composite Pattern Sitecore User Group Conference 2015 11
  12. 12. Chain-of-responsibility Pattern • Composed of command objects and a series of processing objects • Each processing object executes specific command objects • Processing objects are chained together • think linked list • Processing objects are invoked in a cascading manner Sitecore User Group Conference 2015 12
  13. 13. Null Object Pattern • Represents the “null” state of an object • Provides methods with no behaviour • Removes the need of client code performing null checks Sitecore User Group Conference 2015 13
  14. 14. Learn More! • Recommend Books • http://amzn.to/UPNN2F • http://amzn.to/1ppJHeH • http://amzn.to/1EZEa3z • http://amzn.to/1bSAYsh • Blog posts • http://bit.ly/1E7J7JO Sitecore User Group Conference 2015 14
  15. 15. Get In Touch! Blog: http://sitecorejunkie.com Twitter: @mike_i_reynolds LinkedIn: http://linkd.in/1Csu1N8 Sitecore User Group Conference 2015 15
  16. 16. Questions? Sitecore User Group Conference 2015 16
  17. 17. Thank you Sitecore User Group Conference 2015 17

×