My TDD has improved since I first started in 2001. But even today, I make mistakes. The trick is to learn to recognize TDD mistakes. Then, learn to “listen” to them: what is it trying to tell me about the design?

Follow along as I recount the latest steps in Marvel Browser, the iOS TDD sample app. Can you spot the errors before I point them out? Continue Reading…

I want to ensure my platform does the best possible job of answering your needs and interests. And that means I need to know more about you. To do that, I’ve created my 2016 Reader Survey.

Would you please take a few minutes to fill out the survey? By doing so, you will ultimately be helping yourself. Why? Because you will be helping me create content even more interesting and relevant to you.

Your input is important to me. The survey is easy to fill out, and the results are completely anonymous. I can’t tell who said what. And you can finish in five minutes.

Thanks in advance for your help.

TDD doesn’t make anything happen automatically. You really need to level up on two other skills as you go: design, and unit testing. Doing so can shift TDD from being daunting to being simple.

Let’s look at how a change to unit testing empowers TDD.

Leverage the synergies: TDD + Design + Unit Testing

leverage the synergies keychain by , used under CC BY 2.0 / / Added text to original

Continue Reading…

“Uncle Bob” Martin creates strong impressions, with outlandish costumes and black-and-white statements. If you understand that this is his didactic style, you can appreciate him fully. But people seem to enjoy jumping on statements rather than trying to grasp the whole. (Ah, Internet culture.)

I’m referring to the sentence: “You don’t need static type checking if you have 100% unit test coverage.”

This is one of the closing statements from Uncle Bob’s recent blog post, Type Wars. Various people jumped all over this, with much LOL.

100% COVERAGE? HA-HA!

Who’s right? Is Uncle Bob right? Are his detractors right? Continue Reading…

I’m always on the lookout for new tools. Are you? Anything that might increase programmer productivity is worth a look.

You know that I’m a big AppCode fan. It saves huge amounts of time. And doing so within an IDE helps me stay “in the zone.”

I’ve shared about 6 Simple Power Tools for Better Git Use. Thanks to reader comments, I learned about Oh-My-Zsh for command-line, and SourceTree for GUI. AppCode also provides great Git support.

So I’d love to hear more from you. What are your favorite tools for productive programming? Click here to share your tips!

OCHamcrest matchers are predicates on steroids:

  • You can combine them to create expressive assertions.
  • They describe mismatches in detail, reducing the need to debug.

But OCHamcrest isn’t just a library of powerful matchers. It’s a framework for creating your own.

Dr. Seuss Matching Game

By creating a custom matcher, you create a small Domain-Specific Language. This will make your unit tests easier to write, easier to read, and self-diagnosing! Continue Reading…

AppCode vs. Xcode: Which is easier to use for unit testing? Which gives faster feedback?

AppCode vs. Xcode

Day 500-Shadowboxing by Michael Dunn, used under CC BY-NC-SA 2.0 / Logos added to original

Continue Reading…

Back in Xcode 4 days, Apple’s file template for unit tests was awkward and bloated. So I made my own.

Fast-forward 5 years to Xcode 7.3. I’m starting to write Swift. The first thing I want is unit tests — let’s create a new test suite. I look in Xcode’s file template library. Where’s the Swift unit testing template?

Where is it? Apple didn’t provide one?

Fine. I made my own.

Swift unit testing template

Edit: ⌘N for New File does let you choose the language. But not when you drag it in from the Utilities panel! In any case, the resulting file is stuffed with cruft which wastes your time. My template fixes that. Continue Reading…

Refactor tests, I say. Extract those helper methods. …But sometimes it’s not that simple! You have be careful when extracting an assertion test helper. Especially when it becomes long or complex.

YO DAWG, I HEARD YOU LIKE UNIT TESTS, SO I PUT UNIT TESTS IN YOUR UNIT TESTS SO YOU CAN TEST TESTS WHILE YOU TEST
Continue Reading…

Tests are code, too.” So you may ask: who tests the tests? Who watches the watchmen? Is TDD flawed, because it’s turtles all the way down?

This is about speed. The more I trust the tests over a section of code, the more fearless I can be with bold refactoring. Fearless refactoring means I don’t spend time checking correctness. That’s what the tests are for! Instead, I can focus completely on good design.

So how can you increase confidence in your test code? Continue Reading…