SlideShare a Scribd company logo
StructureMapping
               Your Way to
      Better Software
        Matt Honeycutt
        @matthoneycutt
     http://trycatchfail.com
The Plan



  Better    StructureMap   StructureMap   Advanced
software?       Basics        in Action    Recipes
SOLID Principles

Single Responsibility

Open-Closed

Liskov Substitution

Interface Segregation

Dependency Inversion
SOLID
Why Use StructureMap?

           • Achieve loose coupling
           • Extensibility everywhere
Design     • Improve testability
           • SOLID!



           • Mature: one of the oldest containers
           • One of the fastest IoC containers
Features   • Easy to learn Domain Specific Language
           • Fully-loaded
Code!
Everyone Loves WebForms!
Structure mapping your way to better software
Service Locator

 Design pattern which encapsulates the
processes involved in obtaining a service.

      Requester                  Service Locator

                          Based on configuration, builds
 Asks the locator for a   up and returns the requested
  particular service.               service.
Model-View-Presenter
 MVP is a user interface design pattern engineered to
   improve the separation of concerns within an
           application’s presentation layer.

    Model               View             Presenter

  Object that      Interface that     Acts upon the
defines the data displays the data. model, tells the
to be displayed.                    view what to do.
ASP.NET MVC DependencyResolver
                http://mysite/Home/Index


                   Hey, give me the
                   HomeController!



  ASP.NET MVC
    Pipeline                               DependencyResolver




                      Here ya go!
                                             Activator.CreateInstance(
                                             typeof(HomeController));
ASP.NET MVC DependencyResolver

                Hey, give me the
                HomeController!



  ASP.NET MVC
    Pipeline                       SmDependencyResolver




                  Here ya go!
                                      Container.GetInstance(
                                     typeof(HomeController));
Decorator Pattern
  Design pattern that allows behavior to
    be added to an object at runtime.
  Service Interface     Decorated Type       Decorator

 Defines the public                       Wraps an instance
contract for the type
                        Base type that      of the service
  being extended.       implements in      interface to add
                         the interface.     new behavior.
Decorator Pattern

     SomeOtherDecorator
     : IProductRepository

   ProductLoggingDecorator
     : IProductRepository


  InMemoryProductRepository
     : IProductRepository
Think compositionally!
“Favor composition over inheritance!”
We’ve only just begun!
To Recap

IoC rocks. Use it. Embrace it!

There’s a learning curve… but it’s worth it!

Makes it easier to create SOLID code.

Do it all with StructureMap!
Want to know more?



http://trycatchFAIL.com     @matthoneycutt
   Blog, Videos, and      I might say something
         More!            interesting some day…

More Related Content

PPTX
BDOTNET AngularJs Directives - Uday
PPTX
Angularjs basic part01
PPTX
AngularJS - Architecture decisions in a large project 
PDF
Project development - preparing hell dish together – Oleksii Dashkevych
PDF
PLAT-9 Actions & Behaviors
PDF
Intro to Sails.js
PPTX
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
PPT
Integration and Acceptance Testing
BDOTNET AngularJs Directives - Uday
Angularjs basic part01
AngularJS - Architecture decisions in a large project 
Project development - preparing hell dish together – Oleksii Dashkevych
PLAT-9 Actions & Behaviors
Intro to Sails.js
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
Integration and Acceptance Testing

What's hot (20)

PPTX
Angular js for beginners
PDF
AngularJS 101 - Everything you need to know to get started
PDF
AngularJS Best Practices
PDF
AngularJS with RequireJS
PDF
Frontend Application Architecture, Patterns, and Workflows
PPTX
Introduction to Angular js 2.0
PDF
Node PDX: Intro to Sails.js
PPTX
Angular js tutorial slides
PPTX
Why angular js Framework
PPTX
Introduction to Angular JS
PPT
Getting started with angular js
PPTX
AngularJS is awesome
PDF
AngularJS - What is it & Why is it awesome ? (with demos)
PPTX
Angular 2 + TypeScript = true. Let's Play!
PPTX
Web designing avdhesh
PPTX
AngularJS - The Next Big Thing?
PPTX
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
PDF
AngularJS Basics and Best Practices - CC FE &UX
PPTX
Introduction to single page application with angular js
PDF
JSConf US 2014: Building Isomorphic Apps
Angular js for beginners
AngularJS 101 - Everything you need to know to get started
AngularJS Best Practices
AngularJS with RequireJS
Frontend Application Architecture, Patterns, and Workflows
Introduction to Angular js 2.0
Node PDX: Intro to Sails.js
Angular js tutorial slides
Why angular js Framework
Introduction to Angular JS
Getting started with angular js
AngularJS is awesome
AngularJS - What is it & Why is it awesome ? (with demos)
Angular 2 + TypeScript = true. Let's Play!
Web designing avdhesh
AngularJS - The Next Big Thing?
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
AngularJS Basics and Best Practices - CC FE &UX
Introduction to single page application with angular js
JSConf US 2014: Building Isomorphic Apps
Ad

Similar to Structure mapping your way to better software (20)

PPTX
Common ASP.NET Design Patterns - Telerik India DevCon 2013
PPTX
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
PPTX
Dependency injection
PPTX
Most Useful Design Patterns
PPTX
Clean Code Part II - Dependency Injection at SoCal Code Camp
PPTX
Application Architecture April 2014
PPTX
Application Architecture
PPS
Design Patterns For 70% Of Programmers In The World
PPTX
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
PPTX
GoF Design patterns I: Introduction + Structural Patterns
PPTX
Inversion of Control and Dependency Injection
PPTX
Cut your Dependencies - Dependency Injection at Silicon Valley Code Camp
PPTX
ASP.NET MVC as the next step in web development
PPTX
Gof design patterns
PPTX
Mvc summary
PPT
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
PPTX
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
PPT
5 Design Patterns Explained
PDF
Smart Client Development
PDF
Design patterns illustrated-2015-03
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Dependency injection
Most Useful Design Patterns
Clean Code Part II - Dependency Injection at SoCal Code Camp
Application Architecture April 2014
Application Architecture
Design Patterns For 70% Of Programmers In The World
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
GoF Design patterns I: Introduction + Structural Patterns
Inversion of Control and Dependency Injection
Cut your Dependencies - Dependency Injection at Silicon Valley Code Camp
ASP.NET MVC as the next step in web development
Gof design patterns
Mvc summary
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
5 Design Patterns Explained
Smart Client Development
Design patterns illustrated-2015-03
Ad

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
A Presentation on Artificial Intelligence
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
MYSQL Presentation for SQL database connectivity
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25-Week II
A Presentation on Artificial Intelligence
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
A comparative analysis of optical character recognition models for extracting...
Per capita expenditure prediction using model stacking based on satellite ima...
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.

Structure mapping your way to better software

  • 1. StructureMapping Your Way to Better Software Matt Honeycutt @matthoneycutt http://trycatchfail.com
  • 2. The Plan Better StructureMap StructureMap Advanced software? Basics in Action Recipes
  • 3. SOLID Principles Single Responsibility Open-Closed Liskov Substitution Interface Segregation Dependency Inversion
  • 5. Why Use StructureMap? • Achieve loose coupling • Extensibility everywhere Design • Improve testability • SOLID! • Mature: one of the oldest containers • One of the fastest IoC containers Features • Easy to learn Domain Specific Language • Fully-loaded
  • 9. Service Locator Design pattern which encapsulates the processes involved in obtaining a service. Requester Service Locator Based on configuration, builds Asks the locator for a up and returns the requested particular service. service.
  • 10. Model-View-Presenter MVP is a user interface design pattern engineered to improve the separation of concerns within an application’s presentation layer. Model View Presenter Object that Interface that Acts upon the defines the data displays the data. model, tells the to be displayed. view what to do.
  • 11. ASP.NET MVC DependencyResolver http://mysite/Home/Index Hey, give me the HomeController! ASP.NET MVC Pipeline DependencyResolver Here ya go! Activator.CreateInstance( typeof(HomeController));
  • 12. ASP.NET MVC DependencyResolver Hey, give me the HomeController! ASP.NET MVC Pipeline SmDependencyResolver Here ya go! Container.GetInstance( typeof(HomeController));
  • 13. Decorator Pattern Design pattern that allows behavior to be added to an object at runtime. Service Interface Decorated Type Decorator Defines the public Wraps an instance contract for the type Base type that of the service being extended. implements in interface to add the interface. new behavior.
  • 14. Decorator Pattern SomeOtherDecorator : IProductRepository ProductLoggingDecorator : IProductRepository InMemoryProductRepository : IProductRepository
  • 17. To Recap IoC rocks. Use it. Embrace it! There’s a learning curve… but it’s worth it! Makes it easier to create SOLID code. Do it all with StructureMap!
  • 18. Want to know more? http://trycatchFAIL.com @matthoneycutt Blog, Videos, and I might say something More! interesting some day…

Editor's Notes