Once you go for lambdas, lazy computations and other functional techniques in programming, you may want your code to be mostly immutable. With ReSharper 4 we didn't do much about data analysis, like do not detect immutable objects or methods. However, one analysis is already available to you: highlight mutable local variables. Open Tools menu, select Options, browse for Fonts and Colors under Environment group. In the Display items find ReSharper Mutable Local Variable and change the appearance as you like. I use Bold font. ReSharper will now highlight every variable that changes its value after the value has been already used.
Try it, and tell us what do you think!
26 May 2008
21 May 2008
ReSharper 4 Beta
Did you use one of the nightly builds we publish for several months already? If you thought it is dangerous for you to run early development bits, today we present you ReSharper 4 Beta, which we optimized, stabilized and verified to be of better quality than ordinary nightlies. It is not complete product yet, we have some more work to do in various areas of product, but otherwise this build is pretty stable and usable.
C# 3.0
This major language update was not an easy thing to support. It was tough to make it right, when tool knows the code inside out and understands every detail of what is written. There are many little things that you probably will not even notice, but which were well thought out and implemented to provide flawless code editing, navigating and refactoring experience.
I'd like to highlight some features: global completion for extension methods, which inserts required namespace imports; optional parameter info in form of lambda, like "IEnumerable<string> => string" instead of Func<IEnumerable<string>,string>; refactorings specific to new language features, like creating named type from anonymous one or converting static method to extension method and updating usages.
.NET Framework Annotations
Since version 2.5 we have "Null Reference Analysis", which is capable to warn developer about potential NullReferenceException in the code. To aid this analysis, developers can annotate methods with NotNull or CanBeNull attributes, which ReSharper then uses to initialize variable states. That's cool enough by itself, but there are thousands of methods you can't annotate in source: the .NET Framework assemblies. We took up a challenge and implemented the way to annotate libraries with external annotations. And we made second step, too. We annotated most of .NET Framework (56 assemblies!), so that you can get potential NullReferenceException warning on the code like (SomeStruct)Marshal.PtrToStructure(...);
Completion-on-steroids
That's something I like most. No, wait, I love new refactorings, recent edits window, to-do browser understanding of NotImplementedException, and all other features mentioned on the official site.
Two things: "CamelHumps Completion" and "Complete Statement" bring my coding speed to a new level. I don't know what it would be called in Jedi hierarchy, but it seems to me that I can create code withlightning teleportation speed.
ASP.NET speed-up
The last, but not least thing I'd like to mention is our raid against ASP.NET problems. It is something that had speed and memory problems through all versions of ReSharper, and we finally managed to identify them, and fix. Now, if you develop ASP.NET web sites, go try ReSharper 4 Beta.
Download
In this release we bring you the single installer for both Visual Studio 2005 and 2008, as well as all editions we have. Download, install, select "Free Evaluation", choose edition - and you are ready to be productive.
C# 3.0
This major language update was not an easy thing to support. It was tough to make it right, when tool knows the code inside out and understands every detail of what is written. There are many little things that you probably will not even notice, but which were well thought out and implemented to provide flawless code editing, navigating and refactoring experience.
I'd like to highlight some features: global completion for extension methods, which inserts required namespace imports; optional parameter info in form of lambda, like "IEnumerable<string> => string" instead of Func<IEnumerable<string>,string>; refactorings specific to new language features, like creating named type from anonymous one or converting static method to extension method and updating usages.
.NET Framework Annotations
Since version 2.5 we have "Null Reference Analysis", which is capable to warn developer about potential NullReferenceException in the code. To aid this analysis, developers can annotate methods with NotNull or CanBeNull attributes, which ReSharper then uses to initialize variable states. That's cool enough by itself, but there are thousands of methods you can't annotate in source: the .NET Framework assemblies. We took up a challenge and implemented the way to annotate libraries with external annotations. And we made second step, too. We annotated most of .NET Framework (56 assemblies!), so that you can get potential NullReferenceException warning on the code like (SomeStruct)Marshal.PtrToStructure(...);
Completion-on-steroids
That's something I like most. No, wait, I love new refactorings, recent edits window, to-do browser understanding of NotImplementedException, and all other features mentioned on the official site.
Two things: "CamelHumps Completion" and "Complete Statement" bring my coding speed to a new level. I don't know what it would be called in Jedi hierarchy, but it seems to me that I can create code with
if(CVM.I.SV(SCV.FU <Ctrl-Shift-Enter>When I hit keys like above, it is completed into:
if (CodeViewManager.Instance.SupportsView(StandardCodeViews.FindUsages))And caret is inside braces for me to type in the body of the "if" statement.
{
}
ASP.NET speed-up
The last, but not least thing I'd like to mention is our raid against ASP.NET problems. It is something that had speed and memory problems through all versions of ReSharper, and we finally managed to identify them, and fix. Now, if you develop ASP.NET web sites, go try ReSharper 4 Beta.
Download
In this release we bring you the single installer for both Visual Studio 2005 and 2008, as well as all editions we have. Download, install, select "Free Evaluation", choose edition - and you are ready to be productive.
08 April 2008
Extending the Extension -- ReSharper Plug-Ins
ReSharper, the ultimate productivity tool for Visual Studio, is not just pre-packaged set of features. ReSharper provides rich platform for intelligent extensions, which can read and modify code and provide even more productivity features to you. I thought I would compile list of known public plugins.
ReSharper PowerToys - cyclomatic complexity analysis, explore type interface, find text, generate ToString, csUnit support. Open Source.
RGreatEx - resource refactoring and string manipulation. Commercial.
MbUnit - support for MbUnit tests in ReSharper Unit Testing subsystem. Open Source
xUnit - support for xUnit tests in ReSharper Unit Testing subsystem. Open Source
NSpecify - support for NSpecify in ReSharper Unit Testing subsystem. Open Source
Agent Smith - naming convention validation, spell checking, xml-comments validation, smart paste. Open Source
Agent Johnson - documents exceptions, batch-annotate with NotNull/CanBeNull, favorite files. Open Source
ARP - log4net and NHibernate support. Open Source
Stefan Lieser’s NHibernate plugin - NHibernate support. Free
Scout - navigate to .NET Framework Reference Source. Open Source
If you know any other public plugins to ReSharper, let us know!
ReSharper PowerToys - cyclomatic complexity analysis, explore type interface, find text, generate ToString, csUnit support. Open Source.
RGreatEx - resource refactoring and string manipulation. Commercial.
MbUnit - support for MbUnit tests in ReSharper Unit Testing subsystem. Open Source
xUnit - support for xUnit tests in ReSharper Unit Testing subsystem. Open Source
NSpecify - support for NSpecify in ReSharper Unit Testing subsystem. Open Source
Agent Smith - naming convention validation, spell checking, xml-comments validation, smart paste. Open Source
Agent Johnson - documents exceptions, batch-annotate with NotNull/CanBeNull, favorite files. Open Source
ARP - log4net and NHibernate support. Open Source
Stefan Lieser’s NHibernate plugin - NHibernate support. Free
Scout - navigate to .NET Framework Reference Source. Open Source
If you know any other public plugins to ReSharper, let us know!
02 April 2008
We Read You, Anonymous
9 minutes ago I've received the following from anonymous user of our uninstall feedback form:
Thank you, Anonymous, I will pass this to our administrators so they can decide which server to route information to :)
I am uninstalling ReSharper because my licencse is only for C# :)
Reinstall is waiting for me, so i can't lose my time typing some unuseful text that won't be read anyway.
Have a good time, JetBrains Server!
Thank you, Anonymous, I will pass this to our administrators so they can decide which server to route information to :)
24 March 2008
MbUnit for ReSharper 4
Albert Weinert ported MbUnit plugin to ReSharper 4 API, so you can try it with latest ReSharper 4 nightly builds. Read more and download Beta 7.
04 March 2008
Varification -- Using Implicitly Typed Locals
With the ReSharper 4 nightly builds available, some people are complaining about numerious suggestions to convert explicit type to "var" keyword. Of course, you can hide this suggestion by using Options / Code Inspection / Inspection Severity, or by using Alt-Enter and selecting "Change severity" option. But what's the deal with implicitly typed locals, anyway? Using var keyword can significantly improve your code, not just save you some typing. However, it may require discipline to apply good practices when using implicitly typed variables. Here is my list:
To summarize the list above, by actively using var keyword and refactoring your code as needed you improve the way your code speaks for itself.
PS: Visit ReSharper at Visual Studio Gallery!
- It is required to express variables of anonymous type. This is pretty obvious - you cannot declare local variable of anonymous type without using var.
- It induces better naming for local variables. When you read local variable declaration with explicit type, you have more information at that moment and something like "IUnitTestElement current" makes sense. However, when this local variable is used later, you read "current" which takes some time to figure out the meaning. Using "var currentElement" makes it easier to read at any place.
- It induces better API. When you let compiler deduce type from method return type or property type, you have to have good types in the first place. When you don't have explicit type in the initialization expression, you have to have best names for members.
- It induces variable initialization. It is generally a good practice to initialize variable in the declaration, and compiler needs initializer to infer type for local variable declared with "var" keyword.
- It removes code noise. There are a lot of cases, when implicitly typed local will reduce amount of text developer needs to read, or rather skip. Declaring local variable from new object expression or cast expression requires specifying type twice, if we don't use "var". With generics it can lead to a lot of otherwise redundant code. Another example would be iteration variable in foreach over Dictionary<TKey,TValue>.
- It doesn't require using directive. With var, you don't have explicit reference to type, as compiler infers type for you, so you don't need to import namespace when you need a temporary variable.
To summarize the list above, by actively using var keyword and refactoring your code as needed you improve the way your code speaks for itself.
PS: Visit ReSharper at Visual Studio Gallery!
20 February 2008
Visual Studio 2005 and ReSharper 4 Nightly Builds
ReSharper 4 should work with Visual Studio 2005, and it will support C# 2.0 language features. If you happen to participate in our early access program, and you are using Visual Studio 2005, please note that you have to have .NET Framework 3.5 installed.
Also, we would be happy if you were reporting any features that belong to C# 3.0 but appear in Visual Studio 2005, like suggestions for lambdas or var. Please read information about our issue tracker beforehand.
Thank you.
Also, we would be happy if you were reporting any features that belong to C# 3.0 but appear in Visual Studio 2005, like suggestions for lambdas or var. Please read information about our issue tracker beforehand.
Thank you.
18 February 2008
Better Development Tools -- Building Together
Dear early adopters!
We thank you kindly for your participation in ReSharper 4 early access program. It is going to be wonderful release for everyone, because of you. This time we receive the best response ever, and we are so excited about it!
Many brave developers, who are trying ReSharper 4 early builds with Visual Studio 2008, registered in our issue tracker and provided us with detailed, specific and very important information. This is really great, because we were able to reproduce many issues that were lurking around our code base for some time now. It is very important that you registered and provide us with non-anonymous feedback: bidirectional communication is at least 16 times more effective than one way exception submitting. One sample solution which manifests the problem is 256 times better than 1024 exceptions without a comment. And it is invaluable when you submit instructions to reproduce the problem (well, at least var value = int.MaxValue).
Thank you very much, we really appreciate your effort! With that kind of feedback we receive today, I believe we can build the best release of ReSharper, ever. Everybody wants better tools, right? ;)
Sincerely Yours, Ilya.
We thank you kindly for your participation in ReSharper 4 early access program. It is going to be wonderful release for everyone, because of you. This time we receive the best response ever, and we are so excited about it!
Many brave developers, who are trying ReSharper 4 early builds with Visual Studio 2008, registered in our issue tracker and provided us with detailed, specific and very important information. This is really great, because we were able to reproduce many issues that were lurking around our code base for some time now. It is very important that you registered and provide us with non-anonymous feedback: bidirectional communication is at least 16 times more effective than one way exception submitting. One sample solution which manifests the problem is 256 times better than 1024 exceptions without a comment. And it is invaluable when you submit instructions to reproduce the problem (well, at least var value = int.MaxValue).
Thank you very much, we really appreciate your effort! With that kind of feedback we receive today, I believe we can build the best release of ReSharper, ever. Everybody wants better tools, right? ;)
Sincerely Yours, Ilya.
14 February 2008
ReSharper 4 Nightly Builds - Are You Geek Enough?
-- When ReSharper 4 will be ready?
-- It is ready when it is ready!
We in ReSharper team want to make sure that C# 3.0 language is fully supported by the product. We spend a lot of time on features and look deep into details of every language quirk. You know, compilers and language standards may have very strange relationships, sometimes very weird. Still, we want to ensure maximum pleasure developing in C# 3.0 when ReSharper is ready. And it is not ready yet.
However, due to the popular demand amongst professional developers using ReSharper and C# 3.0, we are going to open nightly builds to the public. That is, not fully fledged tool, but rather our current development bits. Which could be very well broken, buggy, hanging, slow and useless at times. We will not take any responsibility if the tool wipes out all your source code! But you have a version control system in place, don't you?
So, are you geek enough to take the pill and try ReSharper 4 early builds? Read the ReSharper 4 EAP notes before you decide!
If you feel you can survive pre-release build, you can go to ReSharper 4 Nightly Builds and download your copy of ReSharper development bits.
Good luck!
04 February 2008
Compiler Optimizations May Be Dangerous
Consider the following code:
This code doesn't use System.Linq extensions methods to do LINQ, and instead declares own Select and Where methods, which are rather crazy. This code compiles, but what is the type of "lengths" variable? It should be IEnumerable<int>, because that is what Select method returns. But if you look at actual compilation output, it turns out that compiler decided "select hashCode" to be very simple (actually, transforms into identity lambda hashCode => hashCode). And it removes the call to Select() method. And breaks my code. One can have some hard time understanding why their code doesn't work, or even doesn't compile.
I can force compiler to call my Select() method by surrounding hashCode in select clause with parenthesis:
It is not trivial to compiler anymore, and thus it emits correct code.
UPDATE: This behaviour is by design. See 7.15.2.5 Select clauses:
I still find this very error prone...
static class Test
{
public static IEnumerable<int> Select<T>(this IEnumerable<T> list, Func<int, int> f)
{
foreach (var item in list)
yield return f(item.GetHashCode());
}
public static IEnumerable<bool> Where<T>(this IEnumerable<T> list, Func<int, bool> f)
{
foreach (var item in list)
yield return f(item.GetHashCode());
}
static void Foo(IList<string> list, IList<string> list2)
{
var lengths = from hashCode in list
where hashCode * 2 > 10
select hashCode;
}
}
This code doesn't use System.Linq extensions methods to do LINQ, and instead declares own Select and Where methods, which are rather crazy. This code compiles, but what is the type of "lengths" variable? It should be IEnumerable<int>, because that is what Select method returns. But if you look at actual compilation output, it turns out that compiler decided "select hashCode" to be very simple (actually, transforms into identity lambda hashCode => hashCode). And it removes the call to Select() method. And breaks my code. One can have some hard time understanding why their code doesn't work, or even doesn't compile.
I can force compiler to call my Select() method by surrounding hashCode in select clause with parenthesis:
var lengths = from hashCode in list
where hashCode * 2 > 10
select (hashCode);
It is not trivial to compiler anymore, and thus it emits correct code.
UPDATE: This behaviour is by design. See 7.15.2.5 Select clauses:
A query expression of the form
from x in e select v
is translated into
( e ) . Select ( x => v )
except when v is the identifier x, the translation is simply
( e )
I still find this very error prone...
Subscribe to:
Posts (Atom)
