How do I analyze a service with intent of splitting it up ?

I have  a service with 10 methods on the interface. There are also 10 injected dependencies into the implementation class. This class is getting way too fat. The interface has a large number of users.

To my understanding, there are at least two main perspectives I can have on refactoring this: I could try to determine common usage patterns of the interface and split it into multiple interfaces. I could also look at the dependencies injected into the implementation class and decide to split the interface into groups decided by the dependencies of the implementation methods. (I could of course just split the whole thing into 10 interfaces too )

Now in all likelyhood I want to do something right in the middle, leaning slightly towards the first approach. Ideally I would be looking at some kind of scenario analyzer taht would let me see both these perspectives at the same time.

Anyone know any feature in idea 8 that can help me ? even just grouping the usage of different methods of an interface would be really nice !

0
4 comments

CodeExplorer plugin is a scenario analyzer for these cases:
- add all methods of the class to the diagram
- switch to show usages mode and click on all these nodes

And you can see all usages AT ONCE

I can add an action that shows all these usages at one click

Also I'm going to create a new plugin with similar functionality (and additional features) but simpler UI (without graph component)

0

That's a really really good plugin !! Thanks a lot !

For the purposes of my refactoring it would be a lot better if I could show usages by *class* instead of the *class.method* combination which is the default. Is there any way to do this ?

0

Actually, if I select the "horizontal view" i really only need the nodes sorted alphabetically without regard to which method they are calling? But I really need to group by classes ....;)

0

The next release will include grouping nodes by classes

0

Please sign in to leave a comment.