LegacyRecently watched this video:
https://www.youtube.com/watch?v=Rryo6CoKamEIn fact, this is my favorite type of tech videos when ugly old code is refactored into something readable and maintainable. I especially enjoyed Uncle Bob's videos on this matter, highly recommended.
From the title I expected that this would be about something big, yet the example was based on a function under 100 lines long. An especially funny moment was when Arjan called in "big". He-he, I'd call it maintainable compared to some other examples I had to work with.
Anyway, a bigger example would make it impossible to go through in half an hour, plus I learned a very practical trick: convert all conditionals to == instead of mixing == and != (watch the video to understand more). I'm going to use it quite soon. I even did that before, but by skipping some steps and extracting common code to a class earlier. Sometimes it led to failing tests or issues.
At the end he suggests an algorithm for refactoring legacy code, and I liked that. Yet each step of that algo can be explained to a single book or something. And that something I missed from this video, this is something I need right now.
I think I might expand my thoughts on this later.
#python #legacy #refactoring