Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Monday, June 15, 2009

Resharper top 5 features

Resharper has tons of ideas that can significantly improve your performance in Visual Studio making it an essencial tool for any developer who ever used it.



I wanna share what I find the most useful, so without further delay

1. Quick "goto" context menu

Where is this function used? How does the class of this variable look like? What is the implementation of this interface method? All of this questions lead to a single shortcut [Ctrl+`] It opens context menu with appropriate gotos.



2. Quick navigate to Type/Filename by name.

What? More navigation rutine? Well couldn't live without this in any mediocre to large scale solution. It's actually becomes very natural way to navigate around in time, you'll forget about forest of files in solution explorer. It is possible to navigate to class, to file and to class member by name with use of [Ctrl+T] (for types) and [Ctrl+Shift+T] (for files). Just press shortcut and type few first letters. Note that wildcards are supported as well.


3. Generation of rutine code.

[Alt+Ins] pops up a menu for fast constructor/property creation. Just hit this combo, select operation, few specifications of what you really want and you are done.



4. Reformat code

While working with source files it becomes pretty messy over time, you have public methods mixed up with private, field declarations all over the place, etc. And since you must implement features fast you don't have much time to clean up visual aspects of code. However with resharper it's just the matter of issuing a single command named full clean up - [Ctrl+E, Ctrl+C] (you might create lesser jobs too). It will move everything around to match the pattern of file layout you provide, add this. qualifiers and do some other nice stuff to keep your code well styled. Pattern should be shared among teammates to keep considtent look of source files.

5. Duplicate code. [Ctrl+D] is very nifty when it comes to duplicating. Put a cursor on a line you'd like to dup and just press Ctrl+D. Hidden benefit of this that it doesn't even touch your clipboard! (so everything in buffer stays) Duplication works horizontally too, just select a piece of line and dups will be created to the right.

6. Beyond that

Resharper extends refactorings supported by VS. Extract method [Ctrl+M] and Introduce variable [Ctrl+V] are the most commonly used by me. There are also tons of other useful refactorings waiting for you.

Saturday, April 4, 2009

AutoDiagrammer and Dependency Structure Matrix addins for Reflector


Reflector is a great tool for any .NET developer. However you can make it even better with addins. Today I got two of them for you. Without further delay our first reviewee is...



AutoDiagrammer














This plugin allows you to build class diagrams within your Reflection thus source code isn't necessary at all. Its has bunch of options like show/hide interfaces, supports zooming in and out, printing and saving in different image formats.

Lightweight and easy to use this tool might come in handy.



Dependency Structure Matrix plugin


Dependency Structure Matrix (DSM) allows you to get an insight about connections between your modules in way more scalable view rather than typical structure diagramm. This gives you opportunity to review whole project on one screen rather than scrolling through forest of classes with arrows connecting them.

On the screen below you can see DSM addin reviewing NUnit 2.4.8 dlls:














If you haven't yet got used to DSMs this little tool might open a new way for you to think about dependency analysis (if you're already using NDepend this addin won't do much for you, still it's lightweight and might find its uses). 

DSM consists of rows and columns. They indicate which namespaces use other ones to do their work:
  • Rows give you info what namespaces use particular namespace. For example namespace NUnit.Mocks on image above is being used by only namespace with number 340 - NUnit.Core. 
  • Likewise you can check which namespaces are being used with your module by looking at its column. NUnit.Mocks being represented by column with number 29 in header depends on NUnit.FrameWork.
DSM shows you circular dependencies. For example NUnit.Core and NUnit.Util are dependant on each other.

Typical DSM application allows you to dig deeper into modules for more information. You can do that as well with DSM plugin for Reflector.

In typical multilayered architecture where lower level layers aren't allowed to use higher leve
l functionality DSM will give you a picture of triangle - top right triangle wont have any numbers in it:











With even more strict rule where layer is allowed to use only its neighbour layer beneath it, the picture all numbers will be right under the diagonal line:











Plugin allows you to sort modules with partition command so you get a normalized view.

It takes some time to get used to DSM, but when mastered pattern matching mechanics of your brain will do a good job for you with help of this kind of utils. This little plugin will help you to make your first step in that direction.


For further reading on DSM check the following document: