Not too long ago, someone asked me for a comparison of ReSharper (commonly and affectionately abbreviated R#) and NDepend. I didn’t really grok the question, so I asked, “in what sense?” The response was, “well, let’s say NDepend vs ReSharper — which makes more sense for a given person?” Bemused, my slightly snarky quip in response was, “doctor vs dentist — which makes more sense for a given person?”
I went on to clarify the analogy. Doctors and dentists both provide healthcare services, so, in this sense, one could theoretically view them as competitors. But practically speaking, that competition is going to be rare or nonexistent. There is an intersection between what the tools offer, as would be the case if a dentist noticed a throat infection or a doctor needed to peer into your mouth. And yet that intersection is small because the two products, like doctors and dentists, have fundamentally different charters.
I’ll return to that in a bit, though.
ReSharper in a Nutshell
If you go to the Visual Studio gallery and browse to ReSharper, you’ll find this subtitle.
The legendary .NET productivity tool: find and fix errors and code smells; navigate and refactor; run unit tests and write quality code faster.
And then, under “What’s ReSharper?” (Emphasis theirs)
ReSharper is a popular developer productivity extension for Microsoft Visual Studio. It automates most of what can be automated in your coding routines. It finds compiler errors, runtime errors, redundancies, code smells, and possible improvements right as you type, suggesting intelligent corrections for them.
There’s double mention of the concept “productivity tool” and it’s fleshed out a bit in the preceding paragraph. ReSharper’s raison d’etre is to remove the friction from your day to day life as a .NET developer using Visual Studio. And so it offers the following functionality for the following reasons.
- It’ll show you compiler errors and warnings as you type because finding them later when you do a build wastes your time.
- It points out possible code smells as they crop up to save you the hassle of going back and changing your code when an architect finds them later.
- One-click refactorings save you from the manual work and the possible errors of typing them by hand.
- Generate code blocks with a keyboard shortcut to save your self typing time.
- Use our unit test runner because it’s more convenient than the one built into Visual Studio.
I could go on, but you get the idea. ReSharper aims to size up all of the pain points experienced by developers doing their day to day work, and to eliminate those pain points. And, yes, this includes some code analysis.
But the focus is still around the developer’s productivity. The killer feature, if you will, is the ability to suggest fixes to the developer inline in the IDE. With that goal in mind, the code analysis is centered around locating and suggesting fixes. Could this loop be a lambda? Is this code dead and something you can delete? Could this code throw an exception (that you should be catching, but aren’t)? One might describe this as tactical, at the risk of oversimplifying.
NDepend in a Nutshell
If you give the NDepend plugin a similar treatment in the Visual Studio gallery, you will find this text highlighted.
Make your .NET Code Beautiful with NDepend
And, a more lengthy description.
NDepend is a Visual Studio static analyzer: analyze layering, specify design rules, plan refactoring, compare different versions of the code, software metrics, dependency graphs, dependency matrix, declarative code query, and more!
And, finally, one thing that can’t easily be conveyed in the text is the prominence with which the screenshots of NDepend’s visualization features occur. You see trend graphs, the dashboard, warnings, dependency graphs, etc. All of this combines to paint a unified picture of an application health monitoring tool. NDepend’s purpose in life is to give you deep, actionable insights into the state of your applications codebases.
On its features page, you can see NDepend billed as a “Swiss army knife for developers.” That seems a fair assessment, but all of the various blades, toothpicks, sporks, and magnifying glasses of the knife are focused on helping you understand the health of your code. You can visualize your dependencies to see if they’re a mess. You can use out of the box trends or define your own to see if things are improving. You can visualize the density of best practice violations. You get the idea.
So where does that leave us in the versus discussion? Simply that the two tools can coexist, and, like your dentist or doctor, they probably should. They have some overlap, but do not fundamentally solve the same problem. ReSharper is a developer productivity tool that offers some code analysis. NDepend is a deep application health analysis tool that helps productivity. Used together, the result is a healthy application being grown by productive developers.
Disclaimer: NDepend is not affiliated with ReSharper or Jetbrains in any way
In April 2014 actually I wrote a bit about this topic: NDepend vs. R# and also CodeRush, and how Roslyn will modify the landscape of Visual Studio static analysis
“NDepend has never been meant to compete with CodeRush nor R#. Some few features overlap, but many NDepend users are also using CodeRush or R# (like me actually).
NDepend is super-optimized to do macro-analysis. It does check hundreds of solution-wide code rules per second, while CodeRush and R# can do solution-wide checks, but more like in a matter of minutes on real-world large code base.
CodeRush and R# are brilliant to achieve micro-analysis, like showing to the user within the code editor that something can be improved in a method body. NDepend touches some of these areas, but a tool like CodeRush or R# prove to be invaluable to obtain smart advises in all situations. And they come with the wonder of refactoring.
NDepend offers the necessary ten-thousands foot perspective, in order to take the most relevant refactoring decisions, like about what to do to make a component more cohesive, more re-usable, less coupled, less spaghetti-like. CodeRush and R# are excellent to actually achieve the refactoring once a decision has been taken.”
Comments are closed.