File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why TDD is "harder"

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A hypothesis on why TDD seems "harder" especially at first. Thoughts?
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me its often time constraints. They want a champagne wedding on a beer budget and they want it yesterday. On top of that your standing on the carpet of shifting requirements, everything is in a constant state of flux. Write it, change it, move it, delete it, refactor it etc. Writing the unit tests is just one more thing to write and re-write. On projects like these TDD on all but the most important stuff falls by the wayside for me. Once things stabilize if time and money permits I always go back and add them but that is not TDD. Of course often times the process of adding them calls out some opportunity for refactoring as well.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill Gorder wrote:For me its often time constraints. They want a champagne wedding on a beer budget and they want it yesterday. On top of that your standing on the carpet of shifting requirements, everything is in a constant state of flux. Write it, change it, move it, delete it, refactor it etc. Writing the unit tests is just one more thing to write and re-write.

Perhaps the unit tests are too low level? If written at an interface level, they can provide regression and actually speed things up. (once you achieve fluency in testing.)

We had a production problem at work once, the same day as robotics kickoff (where they announce the challenge for teams). My contribution was to write a converter to reverse the bad data. It was in my interest to get it done as fast as humanly possible so I could go and brainstorm with the team. And of course it had to be perfect so I didn't get called to go back to the office. I didn't have time to NOT do TDD there. And yes, my code was perfect. It wouldn't have been without the tests though.
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unit tests usually are at the interface level, assuming its not a utility class. Sometimes testing the functionality in and out of that is fairly simple. Some implementations tie together or integrate several other service layer interfaces which all must be mocked, and of course all the conditionals, and edges must be appropriately tested. That takes time especially if tomorrow everything changes and you are doing something totally different and all that code and its tests get thrown away. Some of the development I do is very rapid and the requirements can literally change on a moments notice. Sometimes you just have to pick where the tests are most important or not test all the branches, or deadlines slip. I am pretty quick with JUnit, and Mockito. By the time code is productionalized the unit tests are in place, but we are talking about TDD here.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill Gorder wrote: Some of the development I do is very rapid and the requirements can literally change on a moments notice.

Yet it is worth writing the code? .

I can't tell if this is a spike or if it isn't known in advance what is throw away.
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if it isn't known in advance what is throw away.


Yes that
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic