Visual Studio Toolbox: SOLID Design Patterns


In this episode, I am joined by Phil Japikse for a chat about design patterns. Software design patterns have been around long before the MVC Framework gained momentum. Phil starts with a review of Robert C. Martin's (Uncle Bob) SOLID macronym. After building the proper foundation,he reviews several design patterns, their C# implementation and when and how they should be used in modern software development.

Get the code samples here.

Comments (1)

  1. Michael Parker says:

    Great talk! One small point:

    I think the discussion and description around Liskov Substitution principle isn’t quite correct. In my understanding LSP is about defining rules for good use of inheritance, not interfaces. On the one hand you CAN remove all violations of LSP by simply replacing all inheritance with composition and using interfaces, but thats a brute force method and is missing the real nuance here – you can also keep inheritance as a useful concept and still adhere to LSP, with a basic rule:

    The basic rule is that you shouldn’t override any base functionality in a derived class, i.e. if you call a function on the derived class it should do the exact same thing as the base class. This effectively means that functions on derived classes should only override functions on the base class if the function on the base class is abstract, and derived classes are basically “the base class plus more stuff”, rather than “an alternative implementation of the base class, plus some more stuff”.

    As a random side note, if you create a language that enforces this rule by default, you end up with a language that no longer has ‘the diamond problem’ with multiple inheritance, and you effectively turn inheritance into a language-supported component model (which would be fantastic). I wonder, given the bad reputation current inheritance has, whether thats a direction C# or other languages should go in, in future.

Skip to main content