There Are Only Two Roles of Code

All code can be classified into two distinct roles; code that does work (algorithms) and code that coordinates work (coordinators). The real complexity that gets introduced into a code bases is usually directly related to the creation of classes that group together both of these roles under one roof. I’m guilty of it myself.  I would say that 90% of …

Back to Basics: Becoming BAT Man

In my Back to Basics post on my conclusions about blackbox automated tests (BATs) and unit testing, I said that we should: Spend a majority of your effort, all the time you would have spent writing unit tests, instead writing what I will call blackbox automated tests or BATs. In this post, I am going to outline what I think …

Back to Basics: Mock Eliminating Patterns

In my previous post I talked about unit testing without mocks.  I gave some examples of how I had done this in some of my real code from PaceMaker. This time I want to take a look at some of the common patterns we can use to extract parts of our code into dependency-lite or dependency-less classes that we can …

Back To Basics: Unit Testing Without Mocks

In my last post, I revealed my conclusions regarding what to do instead of misusing IoC containers and interfaces all over your code mostly for the purpose of unit testing. One of the approaches I suggested was to focus on writing level 1 or level 2 unit tests and occasionally level 3 unit tests with 1 or possibly 2 dependencies …

Back to Basics: Unit Testing, Automated Blackbox Testing, and Conclusions!

If you’ve been following me from the beginning of the Back to Basics series, you’ll know that I set out to reevaluate some of the commonly held truths of what best practices are, especially in regards to unit testing, dependency injection and inversion of control containers. We’ve talked about what an interface is, cohesion and coupling, and even went a …

Back to Basics: Why Unit Testing is Hard

More and more lately, I’ve been beginning to question the value of unit testing.  I’ve really been starting to wonder if all the work we put into being able to actually test at the unit level and the extra scaffolding we put into our applications to support it is worth the cost. I’m not going to talk about that subject …

Basic to Basics: What is Dependency Inversion? Is it IoC? Part 2

In my previous post on dependency inversion, I talked about what dependency inversion is and gave some examples in the real world. This post is going to focus much more on the details and how it relates to code. Back to your code… Now let’s look at a code example to see how dependency inversion helps us out. Let’s say …

trashtime.jpg

The Purpose of Unit Testing

I was reminded yesterday that there are still many people out there who still don’t really understand the purpose of unit testing. A funny shift happened in the last 5 or so years. About 5 years ago, when I would suggest TDD or just doing some unit testing when creating code, I would get horrible responses back.  Many developers and …