Decoupled Design
Recently, I’ve had a large number of discussions around the use of mocks for testing, probably because I keep saying that Mocks are Evil. As a result, I’ve had to articulate how I design systems. This...
View ArticleHow I Learned to Stop Worrying and Love the Mock
I learned something very useful from Marty Nelson’s blog entry on the proficinecy levels of TDD. It was the first time that I saw a construction which included mock objects as a good thing and that...
View ArticleMock Free Example, Part 1: Project Intro
Previously, I presented mocks as nuclear weapons. Unsurprisingly, commenters wanted examples. I exist to serve. This series will discuss a partly-completed project that I have lying around. The project...
View ArticleMock Free Example, part 2: Simulators
One of the common uses for mocks is to replace expensive or stateful components, such as file systems, networks, GUIs, and databases. However, I also see a cluster of other problems that arise at...
View ArticleSimulating the File System
I recently posted an entry about replacing mocks with Simulators. That one used a Simulator from my running example code. Here’s another example, which may make the concept more clear. This is a file...
View ArticleMock Free Example, Part 3: Fixing Untestable Code Sequences
In my character printer, at one point I had some code like this monstrosity. I know it’s a monster, because testing it Requires at least one test double (the _character field). Involves running a bunch...
View ArticleAgile vs Design
An overheard conversation at work got me thinking while I was headed home. I’ve now got to send some of those thoughts your way. The one guy was arguing against agile on the basis that it “throws the...
View ArticleEasily Eliminate Most Mocks
In previous discussions about mock-free unit testing, I’ve shown techniques that I use to eliminate the hard-to-eliminate test doubles. I’ve skipped the simple techniques that I apply all the time....
View ArticleMock Free Example 4: Everything’s Better with Async
In the previous post in this series (“last week” to those who didn’t read it over a year ago), I made simple code complicated in the effort to make it unit testable. It was all going along fine, until...
View ArticleThe No Mocks Book
Recently on twitter, Clayton asked for a good book about unit testing without mocks. I don’t believe such a thing can be written, so I’ll try to write it in one blog post. First, here it is in one...
View ArticleArchitecture – Scaling Design
My position on architecture is different from most peoples’. My view works really well at scale (much better than the traditional view, in my experience), but it is very different. I start with one...
View ArticleGood naming is a process, not a single step
Many people try to come up with a great name all at once. This is hard and rarely works well. The problem is that naming is design: it is picking the correct place for each thing and creating the right...
View ArticleNaming is a Process, part 2: Missing to Nonsense
In part 1, we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleNaming is a process, part 3: Nonsense to Honest
In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleNaming is a Process, part 4: Honest to Honest and Complete
In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleNaming is a Process, part 5: Honest and Complete to Does the Right Thing
In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleNaming is a Process, Part 6: Does the Right Thing to Intent
In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleNew code is legacy code
My series about naming as a process is really about design. It focuses on design in legacy code. That has sparked people to ask about new code. What about new code? Why not start with intent? I was...
View ArticleNaming is a Process, Part 7: Intent to Domain Abstraction
In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working...
View ArticleThe No Mocks Book
Recently on twitter, Clayton asked for a good book about unit testing without mocks. I don’t believe such a thing can be written, so I’ll try to write it in one blog post. First, here it is in one...
View Article