29 October 2009

ReSharper 5 -- Less Shifting Means More Speed

JetBrains .NET blog and web site are talking about major features in ReSharper 5, like showing metadata for library classes, downloading source code for .NET Framework, code inspections, ASP.NET MVC support and other great things. But there are many more improvements in ReSharper 5 which deserve attention and I thought I should blog about them.

When ReSharper first introduced CamelHumps to .NET world (and then other tools and Visual Studio 2010 followed), it worked only in Go To Type and similar features. It is very convenient to type just "TMV" and see "TreeModelView" in the list. In previous version of ReSharper we added CamelHumps matching to intellisense and that increased productivity once again. In ReSharper-enabled teams one can often hear people talking abbreviations.

But original style of typing abbreviations has one issue - to much Shift use. Now, with ReSharper 5, it is no longer needed:

ReSharper can recognize CamelHumps and match them to lower case letters. This of course works in completion too:

That tiny feature alone can increase code crafting speed and make you more productive, especially when you have longer descriptive type names.

ReSharper 5 early builds are currently available throught Early Access Program. ReSharper 4.5 purchases made on or after October 15, 2009, qualify for a FREE upgrade to ReSharper 5.0

08 July 2009

Migrating Source -- Switching Unit Testing Framework

I noticed several people are migrating their source code base from NUnit to MSTest and vice versa. I thought I could share a useful technique to automate this process with ReSharper, and it appears to be large enough topic to not fit my my twitter feed. Obviously, it applies not just to Unit Testing Framework switching, but to almost any library migrations.

If I were faced with the task to migrate NUnit to MSTest I wouldn't use search-and-replace, but instead migrate it via temporary stubs. It would require me do several pretty easy steps:
  1. Remove references to nuint.framework.dll. I will get lots of red code, but we'll fix it in a minute.

  2. Add nunit.framework.dll source code to solution (if permitted by license), or write stubs for what I use, like TestFixture, Test, Setup and TearDown attributes and assertion classes. When I'm done with that, all code should be green again, which you can instantly verify with Solution Wide Analysis.

  3. Move all those types to MSTest namespaces.

  4. Rename types to match MSTest types.

  5. For assertions, implement missing members using existing API and use Inline Method refactoring to get rid of them.

  6. Remove stubs and add references to MSTest assemblies.

  7. Enjoy MSTest runner in ReSharper 4.5 to run your beloved tests.

Using this technique, or variation of it, you can easily migrate your source code to different API, library or technology, even if you don't have source code for it.

Develop with pleasure!

08 April 2009

ReSharper 4.5 Released

We just released ReSharper 4.5, minor version aimed at performance, stability, compatibility and less memory usage. All the same great features plus some nice additions, free for owners of ReSharper 4.x licenses. You can read more about what we were doing to improve quality of our product for your pleasure.

Download ReSharper 4.5 and enjoy your productivity boost!

From now on, we are going to focus on ReSharper 5 with the main goal to support Visual Studio 2010 and C# 4. But that is not the whole story about next major version! I will be blogging about ReSharper 5 cool new features during our way to the next release.

Develop with pleasure!

06 April 2009

Mortal Kode -- Quite Simple Generics

It is very important for a tool to understand correctly what is written in the code. You just can't underestimate the importance of this ability. If the code is not correctly parsed, resolved, analyzed and understood by the tool's core, any other feature of the tool can easily fail. Nobody wants Rename refactoring to miss changes, code completion to insert unavailable symbols and code navigation to put the caret in a wrong position. Actually, the most annoying thing would be wrong code analysis, when code is incorrectly flagged with error, when in fact it compiles just fine. This all can easily happen if underlying code model is wrong.

That's why here at JetBrains, we put a lot of effort into our code model, language understanding and work hard to handle even most complex cases -- after all, they can easily be found in real applications.

Today we will look at complexity of code involving generics in C#. Consider the following example (thanks to Vladimir for this one):

  abstract class A<T>
    public abstract void Foo(T x);
    public abstract class B<S> : A<B<S>>
      public class C<U> : B<C<U>> 

I think not too many people out there can easily say what would be the correct signature for the implementation of method Foo in the nested class C<U>. As for me, I can't. Doing it manually is simply too much.

First, we try Visual Studio "override" helper and we get the following:

  public override void Foo(A<B<S>>.B<C<U>> x)
    throw new NotImplementedException();

Complex enough, and not quite correct:
error CS0115: 'A<T>.B<S>.C<U>.Foo(A<A<A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>>.B<S>>.B<A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>.C<U>>)': no suitable method found to override 
error CS0534: 'A<T>.B<S>.C<U>' does not implement inherited abstract member 'A<A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>>.Foo(A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>)'

Let's see what ReSharper 4.5 inserts when developer uses "Implement missing members" action from the "Generate" menu:

  public override void Foo(A<A<T>.B<S>>.B<A<T>.B<S>.C<U>> x)

You can see that parameter type is exactly the same as expected by compiler. Needless to say the signature is correct, and you don't have to compile it first.

Does your tool understand non-trivial code?

Next time, we'll take a look at some lambda fun.

20 March 2009

ReSharper 4.5 -- From Beta to Release

It's been a while since we released ReSharper 4.5 Beta and it went pretty cool. Those who like fresh bits posted some feedback about Beta already, and they like it!

Of course, Beta is not Release and it has its own problems, which we are working on all days long. Nightly Builds are published and quality constantly improves. You can see community-based build rating improving from "Works" to "Stable", and we aim at five stars "No problems at all" for final version!

There is only one issue with achieving best quality for everyone:

Every combination of
project, environment and developer
is unique

We thoroughly test lots of cases: various packages and extensions installed into Visual Studio, operating system versions, types and sizes of projects, configurations of the environment. But there are thousands other unique combinations of those things, and of course your unique way of working with code.

In our course from ReSharper 4.5 beta to release, we welcome you to participate in the process of making ReSharper best productivity tool for you. Please, do not hide in shadows waiting for release. Tell us anything and everything you feel wrong about latests builds. Don't wait for someone else to report the problem, it can very well happen there is no someone else. Write in comments, post to Twitter, submit requests to our issue tracker, or send email to support at JetBrains. We are in hunger for your feedback! And we promise to do our best to improve your experience with ReSharper.

Thank you for your participation in the Early Access Program!

PS: Try Scott's Nightly Builds Updater, it will help you run the most recent bits of ReSharper.

12 March 2009

ReSharper 4.5 -- What Were We Doing?

Recently we looked at ReSharper's past. You probably noticed that we often have x.5 releases, aimed at performance and stabilization. After the big marathon run for C# 3.0 and VS2008, we finally got some time to perform housekeeping, clean out and sweeping tasks. Not just for beautiful code, but for improvements in speed and memory that require architecture changes.

Since ReSharper 4.1 release in September, we spent lots of time with dotTrace, running hundreds of use cases and analyzing results. We identified several major bottlenecks that hindered performance, and hundreds of smaller problems. We also analyzed managed and unmanaged memory usage in many types of solutions of different sizes. For many issues, small changes here and there just weren’t enough. We had to change data structures, algorithms, dependencies, ownership of objects, and sometimes even basic principles of our code.

Tough decision, but we decided that performance, memory usage and building a foundation for further improvements were of a higher priority than API compatibility. Without that massive code cleanup we would have been spending more and more resources to make our product better for you, and without much success. Please accept our apologies, plug-in developers! We really had to do that to gain 30% speed improvement overall, up to 60% in many cases if you use multicore processor. We‘re hoping to extend parallel processing capabilities in ReSharper 5 and improve speed even more, but we had to lay a foundation for this.

Another big part of our work was dedicated to Visual Studio integration. It is too early to speak about Visual Studio 2010 integration at the moment, but even earlier versions required substantial efforts. We improved integration with various packages, provided fixes or workarounds for a good deal of problems. We spent lots of time doing low level debugging in mixed (managed/unmanaged) environment and I must admit -- it was fun but also very hard. Microsoft Development Tools Division did a great job helping us solve issues and answering our questions (which were far from being trivial, as you might guess). In fact, during the past year we got much more assistance from Microsoft than ever! Thank you guys, I hope you don't have my picture attached to your dartboards :)

Developing new features and improving existing ones was the last, but not the least piece of our work. We reworked ReSharper naming system and, finally, you can configure a style for virtually any identifier . We added more functionality to Solution Wide Analysis -- it is now able to highlight globally unused symbols for you, redundant virtual keyword, parameters that are not used in any overrides, and much more. My favorite global inspection detects potential problems in cross-casts, like when you cast a variable of type IFoo to IBar, but there is no class in solution that implements both interfaces! New Go to Implementation feature allows you to jump straight to the code that might run, skipping all interfaces and abstract classes. Find Referenced Code can now run on any selection in Solution Explorer, quickly showing you dependencies of a particular part of your solution. MSTest is now built into ReSharper, Visual Basic .NET support has been greatly improved, and many reworked refactorings are now particularly rock solid.

These days we are preparing to publish ReSharper 4.5 Beta. As more and more people download ReSharper 4.5 nightly builds, we get invaluable feedback to make this release really shiny. It is currently very stable, with several known glitches that we are fixing. Each new build is better than previous ones.

Don’t hesitate to download it, try it yourself and tell us how it works for you!
We mean it: we really, really need to know how it behaves in your unique environment with your unique solution, and it’s only you who can let us know about it!

ReSharper 4.5 -- Looking in the Past

I didn't post anything for 4 months and I want to fix that. Where is my light bulb I wonder? Not that I had nothing to say, more like I was wearing developer's hat. Anyway, I thought I could explain what's been going on and what we've been doing for the upcoming release, ReSharper 4.5.

But before I start talking about the new release, I'd like to look back at ReSharper history.

2004, July: ReSharper 1.0
First release of JetBrains ReSharper, productivity add-in for Visual Studio 2003 and C# 1.1. Code analysis, quick fixes and context actions, refactorings and templates, all in JetBrains' intelligent style.

System.Console.Out.WriteLine("Hello .NET world");

2005, March: ReSharper 1.5
Added 8 new refactorings. Performance was significantly improved.

2006, May: ReSharper 2.0
With this new release, ReSharper makes a step up from a simple add-in to a real development environment. Support for Visual Studio 2005 and C# 2.0, more refactorings, ASP.NET support, Unit Testing, build script support, additional navigation commands and more.

2006, December: ReSharper 2.5
Focus on the performance improvements and usability to improve developers' experience. Of course we couldn't resist a few new features as well: null-reference analysis, Navigate from Here and Go to File Member.

2007, June: ReSharper 3.0
Major feature-loaded release, bringing many productivity enhancements to the table. Many of them are now perceived as if they've been there forever. Go to Symbol, find referenced and dependent code, automatic member reordering, rearranging statements and members, to-do browser. Code analysis got suggestions, VB got many of the features previously available only for C#, and XAML made it to the list of supported technologies.

2008, June: ReSharper 4.0
This release introduced support for Visual Studio 2008 and C# 3.0 with vars, extension methods, lambdas, LINQ, object & collection initializers, anonymous types, and partial methods. This alone would be sufficient for a new major release. However, we did more: Solution-Wide Analysis, Code Cleanup, Complete Statement, more refactorings, improved IntelliSense, recent edits and other tools to simplify everyday development tasks.

That is how ReSharper have been evolving in the past. What's next?

2009, March-April: ReSharper 4.5

To be continued...