Test to the left, production to the right

Not only do I speak and read languages where texts are written and read from left-to-right and top-to-bottom, but I also work with programming languages where programs are written in the same order.

I'm also a proponent of Test-Driven Development (TDD), a practice that suggests following three simple rules:

  1. You are not allowed to write any production code unless it is to make a failing unit test pass.
  2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
  3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

Robert C. Martin, The Three Rules of TDD

Consequently, it only feels natural to me to split the editor screen vertically, with

  • the more important test code on the left side
  • the less important production code on the right side
Test code to the left, production code to the right

In JetBrains IDEs this can be achieved by right-clicking on the editor tab and then selecting Split Vertically (find out more at Editor Basics: Split Screen.

How do you organize yourself working with test and production code?

Do you find this article helpful?

Do you have feedback?

Do you need help with your PHP project?