The fourth SOLID principle I’ve read up on this week is the Dependency-Inversion Principle (the “D” in SOLID but it’s listed fourth in the PPP book). The first two lines in the chapter pretty much sum it up:

a. High-level modules should not depend on low-level modules. Both should depend on abstractions.
b. Abstractions should not depend on details. Details should depend on abstractions. (p. 127)

Seems straight forward enough, right? I think because my introduction to programming came through Rails this seemed to be one of the simpler principles for me, and in the fourth paragraph of the chapter Uncle Bob even says, “This principle is at the very heart of framework design”. Most of the code I’ve written in Rails always depended on higher-level modules that Rails provided for me. Over time I’ve begun to understand what these higher level modules are doing, but when I started writing code it didn’t matter because those modules wouldn’t be affected by what I was doing (as long as I stuck to convention).

Outside of the PPP book I’ve also been reading Software Craftsmanship by Pete McBreen and working away on my command line tic-tac-toe app.

The McBreen book has been a pretty quick read and the primary point thus far is that the most important thing in software development is the people: the strength of the craftsmen building the product, their users and customers, and the relationship between all of them. It’s an excellent read and I highly recommend it for any aspiring developers, but also for entrepreneurs looking to build relationships with developers. Although the book was written ten years ago McBreen was quite prescient- he definitely saw where software and development were headed.

And tic-tac-toe? Well, after struggling with how to TDD the interface I got clearance to go ahead and just see what I could do without testing. I implemented the interface a lot quicker than I expected and even more surprising was how few lines of code it took me. I’m sure there are quite a few “smells” in there, so I’m looking forward to today’s code review and figuring out how to do it better.