I have 1000 LOC that I plan to refactor into different files and functions. The goal is to be able to test the business logic independently from the visual display. Hence, I am considering an MVC pattern.
One of the challenges is that I repeatedly need access to (properties and methods of) a unique instance of an object, let us call it a session object, which stems from a closed source library. That is why I ended up with a long code in the first place, which is largely procedural/functional.
I will pursue this object in Python 2.7.
- How can I transition from "spaghetti code" to a decent "lasagna" with layers, without ending up with "ravioli code" that is too modular?
- How can I concretely work with layers (including MVC) in Python and the object+folder structure?
- How can I achieve modularity when I need to make multiple calls to an instance of a session object (due to its God-like nature)?