2

Does anyone know of any tool that would help find classes that are taking on too much responsibility?

E.g. By visualizing a file's size compared to the other files in the code base, it can be easy to spot massive classes that should probably be split up into much smaller ones.

I'm looking for something similar to the bubble chart Lyft used to compare their Objective-C and Swift code bases:

enter image description here

  • 1
    You don't already know which classes are too large? – Robert Harvey Aug 7 '16 at 19:47
1

The right tool for this depends entirely on whether you need to show the problem in a slideshow or just need to see it for yourself.

If you need to present the problem to a large group, look up circle packing visualizations.

enter image description here

If you just need to see this for yourself you can get by using the tools of your operating system. For example:

dir /os /s

In a windows OS cmd terminal this command produces a histogram of source file complexity grouped by structure and mapped to actual filenames. It looks like this:

 Directory of C:\Users\-\IdeaProjects\input\src\candiedOrange

04/29/2016  01:29 PM               138 Las.java
04/30/2016  03:45 AM               242 CandiedOrange2.java
04/29/2016  01:29 PM               242 CandiedOrange.java
05/01/2016  06:17 PM               273 Hvd.java
04/29/2016  01:40 PM               929 ErikEidt.java
04/30/2016  06:51 PM             1,156 IO.java
05/21/2016  01:33 AM             1,461 Driver.java
04/30/2016  07:19 PM             1,863 ErikEidt2.java
               8 File(s)          6,304 bytes

 Directory of C:\Users\-\IdeaProjects\input\src\candiedOrange\elevator

07/18/2016  03:27 AM             1,805 Testy.java
07/18/2016  02:47 AM             4,212 ElevatorSimulator.java
               2 File(s)          6,017 bytes

 Directory of C:\Users\-\IdeaProjects\input\src\candiedOrange\homework

08/05/2016  10:37 PM               455 W221Test.java
08/05/2016  10:42 PM             1,072 W221.java
               2 File(s)          1,527 bytes

 Directory of C:\Users\-\IdeaProjects\input\src\candiedOrange\state

07/10/2016  11:56 PM               125 Display.java
07/11/2016  12:47 AM               147 SpeedState.java
07/11/2016  01:19 AM               298 OffSpeed.java
07/11/2016  01:19 AM               298 HighSpeed.java
07/11/2016  01:19 AM               300 LowSpeed.java
07/11/2016  01:19 AM               304 MediumSpeed.java
07/11/2016  01:43 AM               398 CeilingFanPullChainInjector.java
07/11/2016  09:48 AM               474 CeilingFanPullChain.java
07/11/2016  09:48 AM             1,884 Driver.java
               9 File(s)          4,228 bytes

 Directory of C:\Users\-\IdeaProjects\input\src\candiedOrange\table

07/25/2016  10:10 PM               674 ColumnsTest.java
07/25/2016  11:02 PM             2,138 Columns.java
               2 File(s)          2,812 bytes

Always consider your audience when choosing a visualization.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.