was successfully added to your cart.

Design Patterns: Single Responsibility Principle – Video and Resources

Tackling the S in SOLID

When you are writing code, are you doing it right? That is a question that worries a lot of people, and it should probably at least be something every developer thinks through. Design patterns are best practice concepts that we can implement into our code to make it better in some way. Think of them as guardrails that keep our code safe. In this video, we are going to look at the first entry in the famous SOLID principle. The S stands for Single Responsibility Principle. We are going to dive into what it means, how it should change our programming practices, and how far we should take it.

Resources mentioned in the video

Sign up for my mailing list here: https://iamtimcorey.com/general-sign-up (your email will be kept safe and you will not be spammed).
My Blog: https://iamtimcorey.com/blog/
Source Code from the video: SRPDemo

Join the discussion 7 Comments

  • George Ramos says:

    I like it!

    Its help me a lot to pu the Solid priciples in practice

  • lewis says:

    Great video. I watched it on YouTube and love it like all your other videos. Keep up the great work.

  • ThomasW. says:

    Hi Tim,

    Great tutorial as always, but how do we apply this in WinForms, with events, controls and multiple forms?

    • Tim Corey says:

      The job of the code-behind (the single responsibility) is to support the UI. All other jobs should be passed off to other methods/classes. This is hard because it is so easy to just put a bit of code (that turns into pages of code) behind the form. If we properly disconnect the real processing from the form, though, it is much easier to replace the UI with something different later. For example, a button’s click event might take the first and last name fields and combine them and then pop up a message box that says “Hi Tim Corey” (or whatever the name values were). That is so easy to do right in the event but the processing should be a separate class/method. Then your code is just concentrating on the “UI stuff” like getting the name values and displaying the returned processed name on a MessageBox.

  • Dinesh says:

    Tim its awesome, I really Enjoyed and looking forward for the rest S.O.L.I.D

Leave a Reply