No description, website, or topics provided.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
My Journey into Dependency Injection.pptx


A set of examples using DI from a talk I gave, recording here -

One of the ways to make maintainable code is through loose coupling. DI enables loose coupling

Use the bootstrapper to decide which example to run.

Do the examples in the following order :-) Have left this crazy numbering system so it's in sync with the video

-1. Dependency injection - Just a Reader and Writer

-7. Manager comes along wants you to write business logic that looks for [OldDbName] and replace it with [NewDbName] in Sql script input file - Addition of a Transformer class

-2. Manager comes and says wants to log all the writes to a file - decorator pattern

-8. Using logging with a decorator with 7

-6. Manager wants to log file and database. Adding in an AggregateWriter.. The WriterLogger decorates the AggregateWriter, which takes an array of IWriters

-5. Testing - want to make sure the datetime of the logger is correct. Uses a Func

All new changes - only affect compostiion root, and new code is added. ie codebase is Open for Extension, Closed for Modification Open/Closed principle

The diagramming in VS2013 Professional is useful. Slightly broken - when you press View Class diagram in file explorer it should go to the specific diagram. However I tried to change things manually by editing the xml and haven't been able to fix it yet.

Many thanks to Mike Hadlow