Friday, March 30, 2012

Code Camp Presentation Tomorrow

So tomorrow I'll be giving a small presentation at New England Code Camp 17, entitled "What Is Dependency Injection?"

The presentation (materials for which can be found here) is very intro-level.  It's basically aimed at anybody who has experience writing business software but hasn't had a chance to take a look at dependency injection.  Maybe they've heard the term used, maybe they've seen someone implement it in code, etc.  Ultimately they've asked themselves, "Why does this look like it's more complex?  Why would I use it?"

The presentation walks through some basic definitions of dependency injection and reasons to use it.  The last few slides near the end are mostly notes and placeholders while switching over to Visual Studio and walking through the actual code.  The code evolves through four stages:
  • No Layers - This version of the code is a standalone application where the application code talks directly to the database.
  • Layers - This version of the code breaks out the data access into its own assembly and the application uses that assembly as a repository.
  • DI - This version of the code introduces an interface for the repository and introduces a dependency injection framework to wire up the implementation to that interface.
  • Domain - This version abstracts out the dependency injection framework itself as a dependency and inverts the project references so that the core domain code doesn't see (or care about) the dependency implementations at all.
The code isn't perfect, I'm sure.  Parts may be downright sloppy.  But that's fine.  The point is to quickly (within the span of a Code Camp session) walk through dependency injection as a concept and see how it can be implemented.  (The structure might look familiar to my former colleagues from BGC.  I felt that the basic structure used at the time worked pretty well for this demonstration.)

If you have any suggestions for improvements, please let me know.  I would also like to record this as a screencast at some point and post it here.  (The main hurdle to that is just finding a quiet place to record a few sessions.  Work doesn't offer much right now, and home has children.  I'll find time for something, don't worry.)

This is part of my ongoing efforts to get more speaking and writing experience in my career.  And, to that end, this will actually be my first public speaking engagement outside of the office.  Wish me luck!

No comments:

Post a Comment