Home > Coding > Building S.O.L.I.D. code (part 5 of 5 ) or the Grand Finale!

Building S.O.L.I.D. code (part 5 of 5 ) or the Grand Finale!


This is the fifth part of a 5 part series where we will explore the tenets of the S.O.L.I.D principles.

After having viewed the “I” of SOLID (Interface Segregation Principle), we are now heading down the loop to the “D” which stands for Dependency Inversion Principle.

If I was to keep only one principle of the SOLID methodology, I would keep this one!

I learned this one way back when I was coding a critical in-house software a a big pharmaceutical company. Back then I committed to do test driven development. And early enough in the project, I learned not to try to test everything at once. And a good way to streamline my tests was to remove the “internal” dependencies of my system under test (SUT) so that I could pass it various thing in order to test it! Therefore I decided to start passing dependencies in the constructors of my objects.

Back then I didn’t know that a design pattern / principle existed neither I knew that it was called “Dependency Inversion”. 😦

This principle builds on top and leverages of all previous ones!

Watch this video and let me know what you think!

# 96 – Creating SOLID Code: Dependency Inversion Principle

Again, this video is being performed by CodeBetter.Com (awesome folks out there)…

Past videos:

#88 – Creating SOLID Code: Single Responsibility Principle (SRP)

#90 – Creating SOLID Code: Open/Closed Principle (OCP)

#92 – Creating SOLID Code: Liskov Substitution Principle

#94 – Creating SOLID Code: Interface Segregation Principle


During this video, the speaker also talks about popular engines to remove the constructor dependency in his Main() function. He’s referring to an engine called “Structure Map” which uses another principle of OOP called “Dependency Injection”. This design allows a developer to “loosely couple” object in a clever way. A clever way since .Net by itself doesn’t get along to well with “loose” coupling.

Categories: Coding
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: