Better parameterization (too many hard-coded variables and path dependencies)
Better performance, if possible (probably mostly achieved by improving search in #13, reducing brute force complexity)
More readable/maintainable code
I've made some progress on this refactoring already, but figured I'd write this up here as well to stick with the process. The first step for better maintainability/readability is to bring much of the core functionality out of the SqftProForma class altogether. I've created new classes for:
The "reference table" that provides development possibilities for each combination of form and parking configuration (this was previously generated in the _generate_lookup method, but I wanted to distinguish names between this reference table and the actually "lookup" process that takes parcels are returns the most profitable configuration).
The lookup process itself
I keep the original SqftProForma for its loading and saving methods, and use it as a facade pattern to call the other stuff. This is a pretty simple use case for a facade but I think it makes it easier to read.
Goals we stated before are:
I've made some progress on this refactoring already, but figured I'd write this up here as well to stick with the process. The first step for better maintainability/readability is to bring much of the core functionality out of the
SqftProForma
class altogether. I've created new classes for:_generate_lookup
method, but I wanted to distinguish names between this reference table and the actually "lookup" process that takes parcels are returns the most profitable configuration).I keep the original
SqftProForma
for its loading and saving methods, and use it as a facade pattern to call the other stuff. This is a pretty simple use case for a facade but I think it makes it easier to read.