The S.O.L.I.D code

As they say, “A picture is worth a thousand words”. Just came across some motivational posters on Uncle Bob’s SOLID Principles on software design. If you are a software developer who likes to keep an eye on what’s going on in the object -oriented (OO) development fraternity, chances are that you would have come across the famous clash of OO titans (Joel vs UncleBob). Interesting perspectives, but that’s a different story altogether and will get into that some other time.

Uncle Bob’s SOLID principles are a collection of five OO design principles. These are:

1. Single Responsibility Principle (SRP)
2. Open Closed Principle (OCP)
3. Liskov Substitution Principle (LSP)
4. Interface Segregation Principle (ISP)
5. Dependency Inversion Principle (DIP)

    DIP

THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE.
https://codingcraft.files.wordpress.com/2011/03/dip.jpg

    OCP

SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION BUT CLOSED FOR MODIFICATION.
https://codingcraft.files.wordpress.com/2011/03/ocp.jpg

    LSP

FUNCTIONS THAT USE REFERENCES TO BASE CLASSES MUST BE ABLE TO USE OBJECTS OF DERIVED CLASSES WITHOUT KNOWING IT.
https://codingcraft.files.wordpress.com/2011/03/lsp.jpg

    ISP

CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DO NOT USE.
https://codingcraft.files.wordpress.com/2011/03/isp.jpg

    SRP

HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS.
ABSTRACTION SHOULD NOT DEPEND UPON DETAILS. DETAILS SHOULD DEPEND UPON ABSTRACTION.
https://codingcraft.files.wordpress.com/2011/03/dip.jpg

Irrespective of whether you are on Uncle Bob’s side or Joel’s side, these principles to me are great pointers to a good software design. Of course, like any other engineering principles, these should not be treated as commandments. Rather the requirements of the project should dictate the degree of relevance of these principles in their case. That is where Coding becomes a Craft and not mere a discipline of science.

With that said, having the mind laden with these principles will definitely put ones thinking in the right direction. In the direction in which the fundamental requirement of all good software design can be achieved – “Loose Coupling”.

Advertisements

9 thoughts on “The S.O.L.I.D code

  1. Together with every thing which appears to be building throughout this particular subject material,
    a significant percentage of viewpoints are generally rather exciting.
    However, I beg your pardon, because I do not give credence to your entire suggestion, all be it refreshing none the less.

    It would seem to everyone that your opinions are actually
    not totally rationalized and in simple fact you are yourself not even thoroughly convinced of your point.
    In any case I did enjoy examining it.

  2. With havin so much written content do you ever run into any problems of plagorism or copyright violation?
    My blog has a lot of completely unique content I’ve either written myself or outsourced but it seems a lot of it is popping it up all over the internet without my authorization. Do you know any ways to help stop content from being stolen? I’d
    truly appreciate it.

  3. Terrific work! This is the type of information that should be shared across the net.
    Disgrace on the search engines for not positioning this put up higher!
    Come on over and seek advice from my website .
    Thank you =)

  4. Hi! I know this is kinda off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

  5. One more thing to say is that an online business
    administration program is designed for individuals to be able to smoothly proceed to bachelor degree
    education. The 90 credit college degree meets
    the lower bachelor college degree requirements and when you earn your associate of arts in BA online, you will get access
    to the latest technologies within this field. Several
    reasons why students would like to get their associate degree in business is because
    they are interested in the field and want to have the general schooling necessary
    prior to jumping in to a bachelor college diploma program.
    Thx for the tips you actually provide as part of your blog.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s