0

I'm suppose to identify 3 CK metrics and the most appropriate class to refactor so as to increase encapsulation, modularity and reduce the complexity of the following project

UML Diagram

According to my research, from the original metrics proposed by C&K the coupling of objects and lack of cohesion of methods impact all 3 factors and I also chose the weighted methods per class which impacts complexity.

After an initial analysis the Vehicle class has the highest values for almost all metrics, some of them are significantly higher (e.g LCOM=95 while the average is 5.7), so I think this is the right class to tackle.

No spec was given, just the code and the UML diagram above and my problem is that I don't see how I could restructure the code so as to lower these metrics.

Any suggestions, examples?

  • We can't really help you with the information you have provided us. Refactoring often depends on intimate knowledge of the problem domain, which is not something that can be expressed with a diagram. And as you probably lack any automated tests, it will be risky effort. – Euphoric Feb 4 at 12:30
  • Is there something you could identify that would increase the cohesion of the Vehicle class though? The class consists of just getters and setters, why is LCOM so high? Forgetting the actual refactoring, is a class consisting of just getters and setters really the one I should be looking at? For example controler is much more complex logic wise Controler , Project – Scb Feb 4 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.