Friday, 31 August 2012

Refactoring and dependency fixes

As I was working on the solver improvements, I decided to move the solver methods to a new class that would contain only the solvers and the related methods, and this lead to some interesting changes.

First of all, we have several unrelated 'Solver'classes. We have the GeometricSolver and derived classes, which are used with the Hinter, and the actual Solver which is for now in the Sketch2DSolver class. I've split these two and the new Solvers will all be in the SolverModule class. The constraints will be in a separate module, the ConstraintsModule.

After making these changes there were several problems caused by circular dependencies, mainly because helper methods and utility classes were using business logic layer methods. To solve these issues I used a great tool, NDepend.

It allows all kinds of queries related to assemblies/methods/types that are using and being used by a certain assembly/method/type and creates all sorts of useful graphs.
Here's for example a graph of direct and indirect callers for the new ConstraintsModule:


The dependency errors are fixed now, so I'll go back to working on the Solver, but after I'm done with that I'll do some more modules refactoring and ensure that everything is in the correct class, remove unused code and references.

No comments:

Post a Comment