December 16th, 2021 update
Hey everybody,
Welcome back to the wiki. Last update, I mentioned that I was working on Part V: Object-Oriented Design With Tests, a long-awaited portion of this book — even from readers who bought the book last year.
I estimated that you'd be reading the new section today, December 16th. However, after some feedback from readers, I've decided I need to spend some more time on the crunch. It's not nearly as accessible as I'd like just yet. That's very important.
I'm going to be taking the next two weeks off from Apollo GraphQL & khalilstemmler.com writing to enjoy the holidays with my family, only to return in the new year with gusto.
In the meantime, I'd like to share some of my thoughts on the endeavour of learning and teaching object-oriented programming.
Learning object-oriented programming
Part of what makes OO so challenging to learn and teach is that it involves so many little atomic elements (like abstractions, static scoping, polymorphism, and so on). Each of these concepts are equally important to understand. Why?
Because it's about the way that we use them and what — and it's the way that we combine those elements
The lack of feedforward & feedback in OO
If you'll recall from Part II: Humans & Code, we learned about the ideas of feedforward and feedback. Feedforward is what the thing you're about to interact with tells about how it is to be used, while feedback is the result you get from the world when you take an action.
Object-oriented programming has poor feedforward and poor feedback. It doesn't tell you the right things to do (feedforward) and it can take months to know when you've done the wrong thing (feedback).
A good starting point
We're going to correct this. We'll learn how to get really good at OO. Luckily, we have a good starting point:
- A better conceptual model of OO (see 23. Programming Paradigms)
- An understanding of how OO works in real web application architectures (see 24. An Object-Oriented Architecture)
- And an understanding of the mechanics of Classic TDD, how to inch a design forward by first using English to express the behavior (TDD), and how to keep the algorithmic basis' of our code as simple as possible (see Part IV: Test-Driven Development Basics)
Our north star: Simple Design
In Part III: Phronesis, we learned half of how to accomplish the goal of software design. We learned how to satisfy the needs of the customer. Now, we're focused on the needs of the maintainer.
Our north star can be summarized by one Agile/XP idea: Simple design.
Simple Design, as we discussed in 4. Demystifying Clean Code (and will continue to discuss), is our strategy to addressing the developer-focused side of the goal of software design. There are a lot of different definitions for what Simple Design means, but one that we'll settle on for now is that Simple Design means:
- We have no duplication
- We have tests that confirm the code works
- The code is as expressive as possible (high cohesion)
- There are as few elements as possible (low coupling)
So far, we know how to address the duplication and testing part of simple design (and if you don't, make sure to read Part IV: Test-Driven Development Basics).
But those last two — the ones about code being expressive and minimal — these have more to do with coupling and cohesion: the two true (yet somewhat elusive) measurements of good design. Good object-oriented software is a careful balance of these two measurements.
This is what we'll strive to master in this and the Design Patterns, Principles, and Architecture portions of the book.
Happy holidays!
Khalil
- December 16th, 2021 update
- The lack of feedforward & feedback in OO
- A good starting point
- Our north star: Simple Design