29

Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Embed Size (px)

Citation preview

Page 1: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303
Page 2: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of UsName: David HillTitle: Principal ArchitectCompany: Microsoft Patterns & PracticesSession Code: ARC303

Page 3: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Who Is This Talk For?

Page 4: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…This talk is for you if:

You build real-world applicationsYou know your chosen language very wellYou know your way around the .NET FrameworkBut...

You find your applications are hard to maintain, extend or upgradeYou find it difficult to explain how your application is designed or structuredYou find yourself spending time on plumbing instead of business functionality

Page 5: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

What Are Design Patterns?

Page 6: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Proven solution to common problems, challenges or requirementsThink of them as a template or recipe to help you design and structure your applicationSome Real-World Examples:

Patterns For The Rest Of Us…What Are Design Patterns?

Page 7: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Why Use Design Patterns?

Page 8: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…Why Use Design Patterns?

Increase QualityEncapsulate best practices

Increase UnderstandingProvide common vocabularyMake it easier to read, communicate, document

Increase MaintainabilityMake it easier to fix, extend or upgrade

Increase ProductivityLess time on plumbing code, more time on application specific code

Page 9: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…Why Use Design Patterns?

Increase TestabilityMake it easier to automate testing of your application

Increase FlexibilityMake it easier to add new functionality or customized behavior

Support Modern Development TechniquesAgile, Test-Driven-Development, Unit Testing

A bit of a no-brainer huh?

Page 10: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Where Did They Come Frome?

Page 11: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…A Brief History Of Patterns #1

First There Was Object-Orient-DesignEncapsulation, Polymorphism, Inheritance!Object-Orient-Modeling & Visualization Tools!Woo Hoo!!!

But, If You’re Not Very Careful:

Page 12: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…The Life Cycle of Bad Source Code

Complex Interactions Between ClassesReferences, Pointers, Multiple Base Classes, Virtual Methods, Macros, Templates, Operator Overloading

Leads To Complicated CodeCode that is hard to read & followCode that is fragile & hard to extendCode that is ‘styled’ – Macros vs Templates!Code that is hard to documentOriginal authors tend to disappear… and with it understanding of the design

Page 13: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

The Gang of Four (GoF)Fathers of the design pattern movementFormalized and Categorized Common Patterns:

Creation PatternsHow, Where, When, Why do you instantiate objects?GOF: Factories, Builder, Prototype, Singleton

Structural PatternsChange, Migrate, Add to, Copy, Split, Move objectsGOF: Adapter, Bridge, Composite, Decorator, Façade, Flyweight, Proxy

Behavioral PatternsPassing around, working on, alter, add functionality to objectsCommand, Chain of Responsibility, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template, Visitor

Patterns For The Rest Of Us…Enter The Gang Of Four!

Page 14: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Patterns For The Rest Of Us…A Brief History Of Patterns #2

Them Came Component Oriented DesignHigher level abstractions for object interactions – Properties, methods, events, interfacesComponent infrastructure – discovery, creation, design-time and run-time pluggabilityGreatly simplified by Java & .NET!!

So What Changed?

Page 15: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Simpler Interactions Between ComponentsImproved Re-Use OpportunitiesThird Party Components & Building BlocksPluggable Architectures

How Did Patterns Evolve?

Patterns For The Rest Of Us…A Brief History Of Patterns #2

Page 16: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Enough Talk. Show Me The Code!

Page 17: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Observer Patterns

demo

Page 18: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Singleton Patterns

demo

Page 19: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Factory Patterns

demo

Page 20: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Command Patterns

demo

Page 21: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Template Patterns

demo

Page 22: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

And Finally…

Page 23: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Anti-PatternsSquare Pegs / Round Holes

Don’t use a pattern just becauseDon’t be afraid to adapt a pattern to suit your needsDon’t over engineer your code to use a patternDon’t make fun of others & Don’t be dogmaticDon’t overuse a pattern

If every class uses the same patternit’s probably over usedThis is an easy trap to fall into.

Page 24: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Recommended ReadingWhere To Learn More

Elements of Reusable Object-Oriented SoftwareCommonly known as “The Gang of Four”

Martin Fowler’s PoEAAPatterns of Enterprise Application Architecture

O’Reilly: Head First Design PatternsJoshua Kerievsky

Refactoring to PatternsDoFactory.com

Page 25: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

What Previous Attendees Have Said..."Overall, conference was great, gave us good roadmap to follow.""Thank you for all the great ideas. I am looking forward to going home and applying them.""Many of the things I learned here will revolutionize our practices, processes, designs, and patterns. THANKS!""Speakers were great“"Excellent conference, just first day alone was worth the money. Thank you.""This was an excellent value and I would recommend it to everyone!!""All speakers were very knowledgeable and they addressed many issues that I face every day.""This was an excellent conference for me. I'm taking away some useful tools.“

More information:http://tinyurl.com/pnpsummit

Facebook: Stay tuned to updates on p&p summit by becoming a fan of p&p summit in Facebook. Click here to become a fan.Digg It: Show you support, by digging the p&p summit announcement here. Twitter: In your tweets about p&p summit, please add the tag “#pnpsummit”.

Page 26: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Special ThanksBrainstorming, Session Guidance & Inspiration

Scott Cate(!)Jeffrey PalermoGlenn BlockWard BellJames AveryPaul GlavichJeff Widmer

Page 27: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

www.microsoft.com/teched

International Content & Community

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources Tech·Ed Africa 2009 sessions will be made available for download the week after the event from: www.tech-ed.co.za

Page 28: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

Complete a session evaluation and enter to win!

10 pairs of MP3 sunglasses to be won

Page 29: Name:David Hill Title:Principal Architect Company:Microsoft Patterns & Practices Session Code:ARC303

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.