Mads Kristensen created yet another extension to Visual Studio. This one is called File Nesting, and can be found here.
The first thing I thought about when seeing this new extension was if I could use it to nest implementations under their interface. This might sound like a bad idea to you, and I can not make up my mind if I want to do it or not.
Because I use a lot of dependency injection in my code I end up with a lot of loosely coupled "service" classes. Each of these classes implement an interface, and so I have two files pr "service". I usually like to group those two files in a folder, to keep them together in the solution explorer, like this:
However this poses a few minor problems:
- I get a lot of folder clutter
- I get more complicated namespaces
Both of these issues are of course just small annoyances - but the File Nesting extension has been created exactly for avoiding these small annoyances.
So using File Nesting I can avoid the extra folders, and instead my solution explorer looks like this:
The actual implementation is now nested under each of the interfaces, so if you want to navigate to it in solution explorer, then you have to expand on the interface:
Navigating to the implementation using Visual Studio or ReSharper shortcuts still work in the same way (Ctrl+T (Visual Studio shortcut scheme), or Ctrl+N (IntelliJ IDEA shurtcut scheme)).
What do you think of this approach? - Is it a bad practice, or do you like the idea of getting a smaller solution explorer?