By far the best tools that I have come to use over the past decade are application monitoring tools, which usually fall in the application performance management (APM) space. And there are many tools out there: AppDynamics, New Relic, Crittercism, Xamarin Insights, and Visual Studio Application Insights, just to name a few I’ve used. These offer insight into your application and tell you a great deal about how it actually works.
The figure below shows a dashboard from Visual Studio Application Insights that allows users to correlate server metrics to specific operations. There is a wealth of information on this dashboard such Top 10 slowest requests, response time by operation, exception rate, CPU usage, and memory usage. APM tools often allow you to drill into these types of metrics to perform analysis. This is great if you are troubleshooting an error in your application or are looking for the root cause of performance issues.
While all the tools I mentioned have their strengths, I would be remiss if I did not mention the one tool that has never let me down: Dynatrace. Using its PurePath technology, you are able to see things that many of the other tools don’t give you. For example, Dynatrace is able to produce a single stack trace of a business operation that contains synchronous, asynchronous and parallel code paths. This one feature alone was able to troubleshoot a production issue for a customer of mine that saved them US$40 million. The time it took to install the product and find that issue: 30 minutes.
Spotlight: JetBrains ReSharper
One of the best tools to create readable, understandable and consistent code is JetBrains ReSharper. ReSharper analyzes your code on the fly and makes suggestions on how to improve it. It has features such as code formatting, hints and suggestions, and refactoring.
You might be asking, “Doesn’t Visual Studio provide some of these features?” Yes, but not to the extent that ReSharper does. ReSharper provides more than 1,700 code inspections that help increase the quality of your code. It helps developers so much that I recommend that every developer in an organization purchase a copy.
Spotlight: Code Contracts
One new feature that has been introduced to .NET is Code Contracts, which provide a way to specify preconditions, postconditions and object invariants in your code. Preconditions are requirements that must be met when entering a method or property. Postconditions describe expectations at the time the method or property code exits. Object invariants describe the expected state for a class that is in a good state.
Recently I started working on a project where the developers were already writing code. There was a bug that we had for months where we would get a null reference to an image in our UI code. Unfortunately we were never able to reproduce the bug. It would just occur several times a day at random.
To mitigate the problem, the developer working on the UI wrote code to check for that null condition. It wasn’t until one of our developers put preconditions and postconditions in our business logic code that we were able to determine the root cause. The price of not having preconditions was extra code and months of guessing as to the problem.
One of the biggest improvements you can make to the quality of your code is to create unit tests that check for preconditions on all public methods. You should write unit tests that exercise the preconditions. Having these preconditions will save time when others use your code since they will find bugs early and often.
Spotlight: Xamarin Test Cloud
Xamarin Test Cloud allows you to automate the testing of your mobile application across thousands of devices. Anyone that has built mobile software can attest to the fact that testing across various devices and operating system versions is impossible without tools such as this.