I have been writing Ruby for a long time, and Rails for almost as long. However MOST of my work has been Rails, something that I am VERY grateful to DHH for. His excellent ideas that became Rails changed my life, so:
“Thank you David, you can say what you want and write coupled code and not test first, you will always be a hero of mine for making it possible for me and all my geek friends to play with Ruby every day and make a living doing it!”
At first, I HATED TESTING. I fought it’s adoption arguing the position DHH has returned to, browser testing by humans. I hated it because I sucked at it. But I always have a mentor, and I ended up with one who was a XP’er and an old small talker. That changed my life.
But I was still testing too much, testing the wrong things, mocking too much and in the wrong place. I didn’t apparently REALLY know what a unit test was. I was using RSpec and everything I wrote was highly coupled to Rails and the database.
And these are the reasons why I hated testing and thought it sucked. I had code to write.
Why DHH cant TDD
Coupling is the amount of internal knowledge that “leaks” out of the objects you write. When objects start knowing about each other to the extent that you cannot change one without changing the other, or you can’t swap one out without changing the other. There are many other forms of coupling.
I am not the only who thinks this, and case in point, here is the GREAT Jim Weirich DECOUPLING his logic from Rails, something that DHH would have left alone or put into a concern: Decoupling Rails
Isolation is when your object has NO external dependencies. Isolation is where you want to be. Class A may know that it needs another class, but it doesn’t know it is Class B. If Class C follows the same interface as Class B, then Class A doesn’t care which it gets.