Bits and Pieces

Object Thinking

We refer to object-oriented programming as a paradigm or way of thinking because it’s more than just a set of techniques and practices. It’s a different way of modeling behaviors. It’s not necessarily as easy to learn as the syntax of a programming language. Object-oriented programming is subtly different than procedural programming and it’s easy …

Read More
Bits and Pieces

Making Code Testable

I believe that testability is one of the key characteristics of good, maintainable software. But what do I mean by testability? Testable code is code that’s written in such a way that it is independently verifiable. It has a well-defined programmatic interface and it can be fully tested based on that interface. Testable code receives …

Read More
Bits and Pieces

Complex Systems

When I look at the systems around me I noticed three kinds. There are simple systems, there are complex systems, and there are complex adaptive systems. Most of us are familiar with simple systems. They have a direct cause and effect relationship that can be easily traced. Other systems are less direct. Complex systems are …

Read More
Bits and Pieces

Trade-Offs

Of course, we want the best of all worlds. We want our code to be clear and performant and extendable. But what happens when benefits are at odds with each other? What happens when, for example, in order to gain some clarity and improve maintainability we have to sacrifice some performance? Of course, the answer …

Read More
Bits and Pieces

Independence

Well, happy Independence Day. Functional independence is one of the key characteristics of testable code so I thought it fitting to discuss today. We want to make each piece of our code as functionally independent as possible and make those pieces as small as possible. This is not always easy to do but most of …

Read More
Bits and Pieces

Introducing TDD to Teams

When managers find out that I teach test-driven development to software development teams, they sometimes ask me how they can introduce TDD to their team. Unfortunately, it’s not always easy. We software developers are jaded. And for good reason. It seems like nearly every day we are hit with new technologies or methodologies that are …

Read More
Bits and Pieces

Aggregation or Composition

I often get questions when I teach object-oriented programming about the difference between aggregation and composition. These are two relationships that are easy to confuse. Aggregation in the UML class diagram is represented by an open diamond whereas composition is represented as a closed or filled-in diamond. Related to this is the “uses” or “depends …

Read More
Bits and Pieces

Thinking with Objects

It took me more than a decade of doing object-oriented programming-and then teaching it-before I really started to understand the subtle power of using objects, and how to create behavior through the interaction of objects rather than through program logic. I struggled for many years with how to explain this different way of thinking. It’s …

Read More
Bits and Pieces

Keep Defects from Escaping

Toyota did not start out as a car company. They started by making industrial looms for the creation of textiles. They became a leading loom manufacturer by building looms that required minimal human intervention because they recognized that an operator’s time was expensive. If one operator could run a dozen looms instead of just one …

Read More
Bits and Pieces

Why Why

In my last post, I discussed barely sufficient documentation and I said that the best place to express what the code is doing is in the code itself. But there is another form of documentation that we often overlook. It’s actually the most important kind of documentation yet we rarely devote even a sentence to …

Read More
Bits and Pieces

Barely Sufficient Documentation

In Agile, when we say “barely sufficient documentation,” we’re not referring to user documentation. User documentation has been notoriously bad throughout the entire history of the software industry. As an industry, we must do much better with user documentation than we have in the past, but this post is not about user documentation, it’s about …

Read More
Bits and Pieces

Take Your Caller’s Perspective

As software developers, many of us have been trained to dive right into implementation. As soon as we learn about a problem, we think about how to code a solution. But this is not always the right approach. Sometimes, it makes more sense to step back and look at the big picture, to try to …

Read More
Bits and Pieces

Slow Down to Go Faster

I know it seems like a paradox but often we have to slow down in order improve our productivity. We need to step back and look at what we’re doing and see if we can find more effective ways to meet our goals. A NIST study (http://www.cse.psu.edu/~gxt29/bug/localCopies/nistReport.pdf) showed that over 80% of software developers’ time …

Read More
Bits and Pieces

Changeable Code

So, what are the practices that support changeability in code? There are surprisingly few, and I’ve written about them extensively here in this blog, in my book, and I discuss them in detail in my courses: inject dependencies, embody the SOLID principles, keep code quality high, and understand design patterns… There’s a lot to it …

Read More
Bits and Pieces

Domain Language

Software is a model. We’re used to thinking of models as physical models that occupy space, but software represents a different kind of model, not a physical model but rather a behavioral model. Behavioral models take place in time rather than in space. You can think of them as black boxes where some input comes …

Read More
Bits and Pieces

Changeability

What does changeability mean in the context of software? Software is soft so shouldn’t it all be changeable? Not exactly. It turns out we have to build changeability into code, but this is rarely done. To do this we have to understand the nature of software and the nature of change. Software doesn’t behave like …

Read More
Bits and Pieces

An Object Model

If you were to draw out all the objects in your system and their relationship to each other at runtime, that would be a graphical representation of your object model. Object-oriented programming is about modeling the behavior of entities. It is a programming paradigm that, when used correctly, helps us build resilient systems that are …

Read More
Bits and Pieces

Acceptance Criteria

Acceptance criteria are simple tests to tell us when we’re finished implementing a feature. Knowing when we’re done building a feature is extremely important to developers because we’re not always sure how robust a feature should be. We don’t like it when our code breaks in the field so we want our code to be …

Read More
Bits and Pieces

Use Examples

Requirements have gone from lengthy specifications that state “The system shall…” for dozens of pages, ad nauseam, to a single sentence story. But stories aren’t meant to capture all the details needed to build a feature, so where do those details come from? Alistair Cockburn describes user stories as, “a promise for a conversation.” Stories …

Read More
Bits and Pieces

Developers Love Development

We software developers are a fortunate lot. We love what we do, and a lot of the time, when we’re actually building software, we’re very happy people. Unfortunately, this isn’t universally true since so many software development projects require developers to do a lot of other things aside from writing code such as sitting through …

Read More
Bits and Pieces

Collective Code Ownership

Like many artists I used to sign my work. When I wrote a class or a module, I put my initials in a comment that indicated I was the developer who wrote that code. This was a common practice at virtually everywhere I worked from IBM to small shops that developed financial or banking software. …

Read More
Bits and Pieces

Let Testability Guide You

In my last blog post, Let Code Quality Guide You, I said you don’t have to focus on all five CLEAN code qualities and that if you improve one, it’s typical that the others improve as well because they’re all interrelated. And that’s true, but they’re interrelated at a higher level, which points to a …

Read More