Developer's Diary
Software development, with Terry Ebdon
14-Mar-2019 Reducing method complexity

FederationShip.isValid() is overly complex

This method has a complexity value of 33, which is far too high. See also issue issue #24 – Trek.isValid() is overly complex.

image

I split the isValid() method into 4 method calls. This reduced the isValid() complexity from 33 to 7 and improves the reported test coverage. Overall complexity for the class has increased by 1, which is an acceptable trade-off.

13-MAR-2019 👈 Top of page 👉 16-MAR-2019

© 2020 Terry Ebdon.

Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.