Architecture Clean Code Development Python 3 legacy-code
Starting a new project is fun. But what about an existing project consisting of big monolithic legacy code in Python 2 that has no tests and breaks often? Would you start from scratch to rebuild this project? We decided to do it the opposite way - we started to change our current code a step by step.
Refactoring the old code was a hard time full of trials and errors. From the beginning, we could only rely on weak monitoring to reveal bug or not properly working service. We ended up in a position where new release would put us in the risk, and we were afraid to do it. Enhanced monitoring allowed us to stabilize the service until we were able to add tests. With every small improvement our confidence rose, maintenance became easier and adding new features became smoother. Finally, we were ready for the biggest step - switch to Python 3. After a year full of preparations, this exciting and successful work took us only a few days.
But we did not stop there. Our codebase was still full of complex legacy functions, which were hard to test. We needed to improve the architecture and break the monolith to single-purpose packages, which we could connect via dependency injection. We followed the SOLID principles which allowed us to make better tests and to make our code more flexible to big changes.
I would like to explain to you our way to better code and tell you about the fundamental principles we used.
Type: Talk (30 mins); Python level: Beginner; Domain level: Beginner
I studied Chemoinformatics and Bioinformatics. I am finishing my Ph.D. thesis from Biomolecular chemistry. Concurrently I work as a full-time developer in Kiwi where I learned agile development. I focus on the bigger picture - the creation of robust software architecture.