Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adoption of TDD on older Java application

I've got a problem and I'm asking you for help

I've started working on web application, that has no tests, is based on spring 2.5 and hibernate 3.2, is not very well modularized, with classes having up to 5k lines, as view technology there is JSP used all over the place with quite a lot things duplicated (like many similar search forms with very few differencies but with not many shared parts).

Aplication works well, however, everything is running just fine, but when there is need to add or to change some functionality, it is realy slow and not very convenient.

Is there any possibility to employ TDD at this point? Or what would you recomend as I dont't think I can develop it forever the way it is now, it is just getting messier all the time.

Thanky you for answers.

like image 802
Jarek Avatar asked Dec 28 '22 04:12

Jarek


1 Answers

I would start by picking up a copy of Michael Feathers' book Working Effectively with Legacy Code - this is pure gold.

Once you learn techniques for refactoring and breaking apart your application at it's logical seams, you can work on integrating TDD in newer modules/sprout classes and methods, etc.

Case in point, we recently switched to a TDD approach for a ten year old application written in almost every version of our framework, and while we're still struggling with some pieces, we've made sure that all of our new work is abstracted out, and all of the new code is under test.

So absolutely doable - just a bit more challenging, and the book above can be a tremendous help in getting started.

like image 157
Bob Palmer Avatar answered Dec 31 '22 12:12

Bob Palmer