Possible Duplicate:
Techniques to re-factor garbage and maintain sanity?
Code maintenance: keeping a bad pattern when extending new code for being consistent, or not?
I was hired about 6months by a company that uses Agile, but after learning the code I've realized that it's bad code - methods with over 100 lines of code, duplicate code, methods that says it does one thing but does a few other unrelated things. It works, but the more we update it, the more it become like a house of cards. Refactoring one little thing requires changing lots of others, which can make program unworkable. What did go wrong and is it possible to fix it? I thought agile was supposed to make a good code.