Object-oriented design reading list

When I was teaching a university course about writing clean and maintainable code about 8 years ago, there was one topic I touched only lightly: object-oriented design (OOD). The reason was simple — I was struggling with it myself. I was still exploring the topic and had more questions than answers in my head. Unsurprisingly, I wasn’t comfortable teaching it at that stage.

Over the years, I gradually learned OOD and became proficient in it. And then I started to see that some of my colleagues at SUSE (my employer at the time) are in the same situation I was few years ago. They understood objects and classes at the technical level, but had trouble partitioning problems into classes and methods, and struggled with designing larger object systems.

I decided to help them. Shortly before I left the company I prepared and sent around a reading list consisting of materials (videos, websites, and books) about OOD and related topics. The idea was to give everyone a starting point to begin learning OOD on his/her own.

Today, I share this list with you — in pretty much the original form.

The list is split by topics and carefully arranged so that it makes sense to go through it top to bottom. If you actually read everything and reach the end, you won’t suddenly become the world’s brightest OOD designer, but I can promise you’ll feel the difference. And you’ll never look at your old code the same way :-)

Enjoy!

Object-oriented design

Sandi Metz: Go Ahead, Make a Mess (video)

Software is always a mess, but not every mess is equal. This talk shows how to manage bad kinds of messes and how to convert them into good ones. It introduces various OOD principles and demonstrates how an OO designer thinks about dependencies and knowledge.

Sandi Metz: Rules (video)

In this talk Sandi introduces 4 rules that naturally lead towards creating small objects with small methods and separating business logic from framework code. These rules are proxies to creating software more efficiently. As a bonus, the talk includes general discussion about rules and their following.

Sandi Metz: All the Little Things (video)

Here an ugly piece of conditional code is gradually refactored into few simple objects. Along the way, you’ll learn few things about duplication, abstractions, open/closed principle, inheritance hierarchies, and applying a “squint test” to assess code quality.

Sandi Metz: Practical Object-Oriented Design in Ruby (book)

If you liked Sandi’s talks, you’ll like her book even more. It introduces many OOD principles in accessible way, explains motivation behind them, and discusses trade-offs involved. It’s the best OOD book for beginners I know of.

Robert C. Martin: Clean Code: A Handbook of Agile Software Craftsmanship (book)

This book is about writing clean code in general, but since OOD has overlap with that topic, it will also teach you some bits of it. The most useful part for many will probably be an extended example, where a piece of bad code gets gradually rewritten into much better shape.

Michael Feathers: Working Effectively with Legacy Code (book)

Michael’s definition of legacy code is “any code that doesn’t have tests”. The book describes how to tame such code and add tests over time, which will allow you to make changes with confidence. The book is filled with examples of both untestable and testable code and shows various techniques how to covert the former to the latter. And because testable and well-designed code are highly correlated, the book also teaches good software design along the way.

SOLID

Wikipedia: SOLID (object-oriented design) (web)

Entry point to get an overview about SOLID.

Sandi Metz: SOLID Object-Oriented Design (video)

Brief introduction into some of the SOLID principles using an example. For me, the best part of the talk was an explanation of how you should depend only on things that are more stable than you are.

Robert C. Martin: The Principles of OOD (web)

A series of texts introducing each of the principles behind SOLID, plus few other more high-level OOD principles. The texts are written in context of C++, they’re slightly outdated, and sometimes include dubious advice (from today’s POV), but they still present a nice overview and are a good resource.

Dependency injection

Wikipedia: Dependency injection (web)

Entry point to get an overview about dependency injection.

Miško Hevery: The Clean Code Talks - Don't Look For Things! (video)

A look at dependency injection mainly from testing POV. Miško explains how passing already constructed collaborators to objects makes test setup shorter, mocking easier, and the whole code less coupled. The underlying idea is that object construction is a separate responsibility and it should not be implemented in objects that implement business logic.

I highly recommend to look up other Miško’s talks and his blog, there is quite some wisdom hidden there.

Refactoring

Martin Fowler: Refactoring: Improving the Design of Existing Code (book)

A classic that made refactoring popular. It’s mainly a catalog of refactoring techniques with motivations and examples. It also contains a list of “code smells”, which indicate there is something wrong with your code. For many beginners in OOD, this will be the most useful part.

Jan 22, 2015 – 8:30

Comments

There are no comments yet.

Add comment

It is not possible to add comments to posts older than one month.