samedi 17 octobre 2015

large dynamic language spaghetti project refactoring ??

I forked a project on github. ~1000 lines of python, single file of course. I can't bear reading this kind of code, so I devised to refactor it.

I don't have a battle tested method. Of course I have some ideas, isolate functional dependencies, scopes. Gradually eliminating global variables. The issue is I did it on the fly, without a clear plan, a `framework`. Now 2 weeks in, 70% of the code base is cleanly modular now, the code run, but I saw some regressions, nothing major but still, I haven't the slightest idea of how many and how large the regressions are. That brings me back to the framework thing. Refactoring isn't an object, I understand it, it's a craft. The first idea is of course surrounding the code base with regression tests. The original project had none, no tests at all. And I only learned unit testing on OOP, not on black boxes / god module. What else can one do ? how to make the migration as logical, documented and predicatble as possible ?

Aucun commentaire:

Enregistrer un commentaire