Monday, October 28, 2013

C# Design Strategies

This production is In Process which means we are actively recording new episodes. There are 10-12 episodes planned, currently, but there might be more. In this advanced series, Jon Skeet (of Stack Overflow fame) dives into various strategies and patterns you might want to consider when building your application. Topics covered include core Gang of Four design patterns such as the Singleton, Strategy, State and others as well as good habits such as using interfaces, Dependency Injection and Inversion of Control.
Rob and Jon have a habit of going off on small tangents – and we have a habit of recording what Jon goes off on. In addition to the core episodes, we’ll also be releasing outtakes – such as Jon writing his own IoC container from scratch!
This is an advanced series and understanding of C# and how it works is a very good idea.

Table of content

1 – Singletons
We start the series off with a bang – tackling a design pattern that plagues most developers – no matter the language. The Singleton is reviled by many – mostly because it’s nearly impossible to do it correctly. In this episode Jon takes it on and shows you not one, not two – but SIX different ways to do a Singleton. And talks about various pitfalls along the way.

2 – Interfaces
Using interfaces is accepted by many as something “you should just do”. But why? What do interfaces do for you? How are they better then just using basic object construction? In this episode Jon uses Noda Time (his OSS project) and shows you how the use of interfaces has helped him surmount the perils of System.DateTime in .NET.

3 – Dependency Injection
Using interfaces is a great way to loosen up your code’s various dependencies – but how do you go about putting together an application that effectively uses that interfaces? One pattern than many developers like is Dependency Injection, and Jon explains how this patterns works in a real-world project: Noda Time. You get to see how this pattern is used in the wild to make code more flexible and maintainable.

4 – Inversion of Control
Our code is getting looser and our hard-coded dependencies are making future maintenance less-frightening – but we are now faced with a new problem: getting a new object is becoming a bit of a pain as we need to pass in all the dependencies! This can be a nightmare – and it’s a good thing we have Inversion of Control containers to help us out. In this episode Jon refactors his code to make use of a home-spun IoC container, and shows concisely how he’s helping his future self maintain his large Noda Time project.

5 – Outtake: Skeet Builds an IoC Container
During the recording of Episode 4 (Inversion of Control) we asked Jon to “lead people along and show them the need” for using Inversion of Control with Dependency Injection. We expected a rough, hard-coded factory-style of thing, but no, Jon built a small, functional IoC container from scratch. We decided to include it here because it’s fascinating to watch and… he’s Skeet!

6 – Type Meaning And Single Responsibility
Designing a Conceptual Model is not easy, and quite often we can engineer ourselves into a very tricky spot with types that do multiple things for multiple reasons. In this episode, Jon takes apart System.DateTime – the poster child for “doing too much” (even the name has two concepts) in an effort to drive home the need for Single Responsibility and Type Clarity.

7 – Open, Closed and Substitution
Working our way through SOLID principles, Jon tackles the Open/Closed principle and Liskov’s Substitution. Along the way we discuss how to facilitate change and extension in an API’s inheritance scheme.

8 – Factory Pattern
In this episode Jon talks about various ways to create an object instance, ans shows you how you can solve the confusion that can occur when you have too many constructor overloads – using the Factory Pattern.

9 – Builder Pattern
In this episode Jon explores what happens when constructors and factories start getting a bit too complex and you need to formalize options for creating an instance of your exciting business object.
  1. Uploading.....


Contact Form


Email *

Message *

Copyright © 2013
Designed By Blogger Templates