How .NET development teams use ReSharper

Skip to end of metadata
Go to start of metadata

A natural question to ask yourself while evaluating ReSharper for team use is, "How do other development teams take advantage of ReSharper?".

We at JetBrains rarely poll customers on team use of ReSharper. Sometimes we'd love to learn and share their stories, but many customers require signed NDAs. So we thought we'd look out for public evidence of how ReSharper is used in different teams, whether small, huge or mid-size. Here's what we've found.

Headspring teams use ReSharper to maintain a consistent code style and ensure that personal style preferences don't become a factor during code reviews.

As Glenn Burnside of Headspring points out, some of their development teams use ReSharper formatting and code cleanup templates which are shared between all developers on the team, and ReSharper cleans up code based on that template every time before checking in a file. In the context of code reviews, Glenn says, this approach helps remove code style considerations out of the scope of review so that reviewers can focus less on the conspicuous and more on the important.

On some of my teams, we created a ReSharper formatting and code cleanup template, and shared it with the team. We all developed a habit that before you checked in a file, you ran the standard cleanup on it. Automating this nit-picky, boring stuff meant, we could spend more time on interesting things during review, like gauging the code’s maintainability and separation of concerns... Team-wide shared code ownership means you have to put your personal preferences aside.

At Typemock, ReSharper simplifies understanding and continuously improving code.

Eli Shalom of Typemock talks about two prerequisites for high code quality: the understanding of how good code looks and how to improve existing code (Awareness), and actually making existing code better (Ability). Eli finds that while awareness of code quality is something that many developers already have, actually improving code often takes considerable time. Eli says ReSharper makes improving code a much less expensive endeavor by simplifying both understanding code (with its navigation and search features) and changing code (with its extensive set of refactorings). Eli proceeds to illustrate his findings with specific ReSharper features that, in his experience, contribute to both improvement steps.

At every point of the development cycle there’s a tension between the short-term goals, like moving to the next feature, and the long-term goals, like reducing the price of future bug-fixes. Reducing the immediate price we need to pay reduces the tension between the short and long-term, thus allowing continuous code quality improvement. Since ReSharper is a tool that does exactly that, we believe it is a must-have tool for every developer.

ReSharper is heavily used for refactoring and inspecting code on the team developing raygun.io.

Jamie Penney from Mindscape talks about an array of ReSharper functionality that he says he uses a lot while working on Raygun, an automatic error reporting product. Apart from describing how he benefits from navigation, code inspection and code generation features, Jamie shows how he simplifies code with ReSharper refactorings such as Extract Variable and Extract Method, and goes on to show code snippets before and after applying a small chain of refactorings.

Extract Variable and Extract Method are my favourites. If I’m staring at a big method with no idea what it does, I start ripping it apart with these two tools.

Dave Schinkel talks about ReSharper use on various teams he's worked with, mostly in order to keep code bases clean.

An experienced consultant and contractor, Dave Schinkel talks about teams he has been on and their use of ReSharper. For the most part, ReSharper helps teams keep code consistently clean and uniform, by maintaining a coding standard and getting rid of unused code, which helps improve readability and simplifies maintenance.

ReSharper shows different colored bars to the right to point out different things... Don't you love that? In fact there was a team I worked with who decided that a good standard for the team as part of cleaning up code would be to check this in every class you've made changes to BEFORE you check-in the code.

At bbv, ReSharper helped simplify migration between mocking frameworks.

Daniel Marbach of bbv provides a great case of how ReSharper can be used to reduce the migration effort when a team decides to drop one external framework and adopt a different one. Particularly, when Daniel's team decided to start using a newer mocking framework, to eliminate the tedious and error-prone manual migration effort they introduced and applied a set of search and replace patterns powered by ReSharper's Structural Search and Replace mechanism. They also used ReSharper's layered settings to commit the search and replace patterns to VCS and make them available for the entire team. Daniel has also made the search and replace patterns public as a gist to help other teams, should they need to go down a similar path of mocking framework migration.

Our rule of thumb is that we simply apply the boy-scout rule for the migration process from Moq to FakeItEasy. This means if a developer touches a unit test, which contains Moq Mocks, then he quickly rewrites it to FakeItEasy. But doing that manually is tedious and error prone. Why not use ReSharper's powerful search and replace patterns to rewrite our tests almost automatically?

Mark Heath of NICE Systems talks about best team practices of using ReSharper.

Over the years, Mark Heath has developed a clear idea of how ReSharper should be used and how it should not be misused on a team. A software developer at NICE Systems at the time of writing, Mark talks about keeping code cleanup commits separate from regular commits, developing a wise, balanced approach to ReSharper's code suggestions, and taking responsibility for your own code without blaming the tools you're using. Mark also urges his readers to set up a team shared ReSharper settings file for a consistent coding standard.

ReSharper has a superb way of presenting the issues that it has found with the source file you are currently editing, by presenting a bar showing where in the file various errors and warnings are.

If you manage to eliminate them all, you are rewarded with a nice green tick, telling you that your code is now perfect. But this can lead to problems for people with an OCD tendency. They become obsessed by an overwhelming desire to make all of the warnings go away.

What you need to constantly bear in mind is that these are only suggestions. And sometimes the code is actually better like it is. Resist the urge to make a change that you don’t agree with.

Telerik used ReSharper and StyleCop to enforce a unified coding style consistent between internal teams.

Several years ago, as Telerik grew in size, development teams were faced with the challenge of setting up and implementing a uniform coding style. After starting to use StyleCop's ruleset, the team used ReSharper's formatting and type members layout to clean up their code and align it with StyleCop requirements in a matter of days.

...after we installed [StyleCop] in our team, we received more than 3000 warnings. It's very scary because we like to treat warnings as errors. For our luck we have ReSharper and we use it to clean up our code. After a day of playing with ReSharper's reformat code options and Type Members Layout, the warnings went to 0.

SSW uses ReSharper to review architecture and remove harmful dependencies.

Adam Stephensen of Australian consultancy SSW talks about a relatively new ReSharper feature, Project Dependency Analysis, and how it helped him visualize the architecture of a solution and keep it clean and free of extra dependencies. As evidenced by a blog post describing the solution, the Sparrow project, its architecture was designed with Dependency Injection from day one, contributing to a clean, organized system design.

What I love about the ReSharper dependency graph is how easy it makes it to get a high level overview of my solution. It also has the ability to track changes to your architecture as your project progresses, and to indicate metrics.

At Gerson Lehrman, ReSharper helped set up an easy way to track technical debt.

While serving at Gerson Lehrman Group, Dale Smith described how his team used ReSharper's To-do Explorer to track technical debt as the team was adopting Test-Driven Development. They decided to agree on a format of code comments based on the urgency of addressing a commented problem, and used the To-do Explorer to review and clean up problematic code at different stages of their iterations.

So before the end of the current iteration, we know we need to clean up our HACKs and TODOs. And at the beginning of the next iteration, we can throw the DEBTs in with the requirements to be prioritized and worked into the iteration plan.

At CodeValue, ReSharper's advanced code analysis helped migrate to a newer API of a third-party library.

Igal Tabachnik, a developer of OzCode by CodeValue and a ReSharper expert, has found a great way to use ReSharper's External Annotations to mark an old API of a third-party library as obsolete, even without having the library's source code available. As a result, ReSharper was able to highlight usages of the old API as errors, and by putting a ReSharper annotations file to source control, Igal shared the obsolete API highlighting with his teammates.

The annotations mechanism is used to decorate various .NET types and methods with special attributes that provide ReSharper with additional information. Turns out, it is possible to use the same mechanism to apply the Obsolete attribute as well! This way, ReSharper could mark the usage as an error, even if it’s not really a compilation error (which is good enough for me!).

neev technologies used ReSharper for massive code cleanup.

The team at neev technologies used ReSharper for a mass cleanup of a massive C# solution, removing unused methods, classes, and references:

It was a really challenging and tedious job to scan through each of the CS files. I had set aside thirteen full days to complete the task since it was very laborious. I then started searching for a tool that could help me achieve this task... Once I installed ReSharper, all the unused codes were grayed out while providing the appropriate description.

ReSharper is a must-have for contributors to Warewolf ESB.

Ashley Lewis of Warewolf ESB explains how ReSharper helps save time and ensure code quality in an open-source project. Among other things, Ashley mentions the importance of code formatting and naming conventions for keeping the codebase consistent and clean. Ashley describes how these conventions are enforced with ReSharper and ReSharper command line tool, and how the shared settings make the conventions available across the team.

The first thing my team tells a new developer is to install ReSharper and relevant ReSharper plugins and apply those settings when writing their contribution. ... These settings are the single source of truth for what is considered clean, consistent code for our repository.

For .NET teams already trying ReSharper or just considering to, we think these stories can provide useful ideas and inspiration. Would you like to share your experience, too? Do get in touch with us.

  • No labels