• 0

Receiving a new project, refactor or continue?


Question

Hej hej,

 

During our Agile Methods course, we received a project that was done by last year's students. We have to plan 4 sprints, each lasting one week, and work on improving the project as part of the course. One of the things that we noticed first is that there are many half-baked things, such as event handlers missing for some UI events, bad coding habits / standards, messy code located in wrong places, and so on. The whole project is about 3000 lines of code, so it is not that complicated. The project is basically an app that processes PDFs, DOCXs, and TXTs for keywords, building a database of which keywords can be found in which files.

 

How would you guys approach such a task? Would you first try to refactor the whole code into a more readable state, thus spending a few days better understanding the code and building a better base for future modifications, or would you just continue adding new features and fixing bugs in the same style as the code itself?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Since this part of a course I would use the opportunity to learn the messy codebase and try to refactor and improve it. You'll be doing a lot of that in the industry, so better get used to it. 3000 lines really isn't that daunting. Also it's easy to criticize a codebase on superficial inconsistensies and apparent problems but if it works then you can be sure it's been hard to make it work and by starting from scratch you'll be going through all that hard work again. Fully working, optimized, debugged code is rarely also clean and consistent.

 

If you're going the refactor route, a solid approach is start by writing unit tests for all the functionality you want to keep, and then you can rework things with those unit tests as a safeguard to tell whether you're breaking anything. It can be hell refactoring a large piece of code that you don't fully understand otherwise.

Link to comment
Share on other sites

  • 0

I'd treat it as a blackbox. Write new code in a standardised and clean way. Add notes to modifications of old code so it's easy to see which parts have been changed and by whom.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.