Clean Code and SOLID

I am presenting at TriNug’s Software Craftsmanship SIG on February 27, 2013.  The subject of my talk is Bob Martin’s SOLD principles.  The reason I chose that topic was because at the December lightning talks, I demonstrated the open and closed principle and there were some people in the audience that seemed genuinely interested in all of the SOLID principles.  I already have the CleanCoders brownbag materials that I used last year as a baseline, so I thought I would augment it with some additional resources.

One of the better presentations I have seen on SOLID and software craftsmanship is by Misko Henry in his series of Google Tech talks.  I had so much fun watching his talks that I jumped over to non-SOLID talks that he did.  For example, check out this talk on what Singletons are bad.  Like, really bad.  Like, poke your eyes out bad.

I incorporated what Misko said into my SRP section of the SOLID talk.  Specifically, SRP is not:

  • Use Singletons
  • Classes should only do a single thing
  • Code should be written in a single place (kinda of a DRY principle)

Rather, the SRP argues that classes should have 1 and only 1 reason to change.  To understand the reasons for change, you need to look at the actors.  Where I depart from Uncle Bob slightly is that if two actors both use a class and both have the same reason to change that class, you are still SRP.

In any event, I am doing O tomorrow.  I plan to use the notification example that I showed in the lightning talks as the code examples.

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

%d bloggers like this: