#Google Analytic Tracker

Pages

May 28, 2010

My 1st Code Rush Experience – Can I Code Without ReSharper?

I have been a big fan of ReSharper (R#). I started using R# probably about four years ago.  Back then, this tool was magical to me, I didn’t know why MS VS wouldn’t have R# features.

C# 4.0 and Visual Studio 10 are already out.  I notice Code Rush (CR) is gaining popularity.  I tried CR probably about 3 years ago, but I felt CR wasn’t the right tool for me, especially I was heavily relaying on R# code analysis refactoring features. CR may had some code analysis and refactoring tool back then, but I can’t seem to remember much.

About a couple month ago, one of my colleagues came back from the MIX10 and he was impressed by Devexpress demo. He actually got one free license for CR + Refactor Pro. Since I was not in MIX10, I can’t say much about the demo. From words I heard, some guy code a lot faster when using CR while another guy still haven’t finish playing his guitar.  My colleague would like me to try out CR + Refactor Pro.

I was still using R# 4.5, and 5.0 is out. It is about time to see if I should upgrade to 5.0, or try a new tool.  My development team has finished the development phrase, and has moved into the QA phrase. Ideally in this period, we no longer code any new functionalities, other than testing and fixing issues. I think this would be a good time to try a new code aiding tool like CR.

Btw, we try to be as agile as possible. We tested new features in each iteration.  However, our QA team still have to do many regression tests because we don’t have enough automation tests. The QA team is very good at finding issue where developers didn’t thought about. As a result we still have a QA phrase.

What I Want to Talk About

Please assure that I am NOT suggesting either one of the tools (CR or R#) is better than the other. I believe CR and R# have their strong and weakness.  What I like to talk about is my experience of switching from R# to CR.

Why Trying CR

As I said before, I have been a big fan of ReSharper. However, using ReSharper comes in a price.  Here are the issues that I have using R#

  • Averagely I has to restart VS once a day due to OutOfMemoryException
  • R# slows down VS when it tries to analysis large classes

Basically these are the only issues I have with R#. Please don’t get me wrong here, R# is an awesome tool. However it needs a lot of resources to do the code analysis so that you don’t have to keep recompiling to discover your mistake. Unless you are a programming god, who make no mistaking in coding, otherwise you would find R# save you time from recompiling.

I was actually hoping that CR + Refactor Pro would somewhat provide me similar features that I use in R#, and it would also speed up my Visual Studio.

About 3 years ago, my development team were using VS 2005 coding with C# 2.0.  I tried to convince my team member to use R#.  The result… I failed miserably.  R# was very slow. Even now I still try to get my team to use R#, but they refused to use it because they worry it will destabilize VS. This is the same for CR.

Also, I won’t dare to install both CR and C# together. It would be nice to have the best from both products.  However, the last thing I want is a messed up IDE with shortcut key clashing. 

Installing Code Rush

The first time I downloaded the DXperience Product installer, I was confused at first of what I needed to download. I want to download CR with Refactor Pro, but instead, I downloaded the DXperience Product installer, which actually includes all the DX product. I think this is a very nice integrated products installation setup.

Before I start installing, I shut down VS, just like installing R#. Unfortunately the first thing I saw is the following:

1

Not sure why it complains why MS Visual Studio .NET is still running. I checked the Task Manager and found nothing running that may be related to VS (devenv.exe).  I wasn’t too impress. So I had to  log out and log in into Windows. That seems to fixed the issue.

During the installation, I like how it takes ask for your experience level. I saw a number of posts complaining R# has too much dialogue boxes when performing refactoring. I think R# should have a similar feature, that allow beginner to learn the tool though dialogue boxes, and no dialogue boxes display for expert users.

 2

First Thing I See in CR

Great, the installation was successful, let see how this work. What is this red line on the left of my code?

3At first, I wasn’t too sure the meaning of this, but soon I realized it means there are errors in the code. It was confusing because I can’t understand why the entire piece of code are errors.  My solution compiles. I wasn’t too impress about seeing the red line.

In the above example, It is nice that it point out the “issue”, but I don’t really understand what it means by “Complex member”. I think it needs to have a link for me to learn more about what it means.

Incorrect Analysis?

I started getting more confused because CR can’t seem to analysis the solution I was working with.  For example, why would Data.EmployeeName is an Undeclared element in the following screenshot? One possible reason I guess is that CR failed to analysis this data class. This class is a code generated ADO dataset definition. The generated definition is huge, more than 100,000 line of code, I think. From a design perspective, I want to get rid of this class and try other technology like the Entity Framework, but it is too hard to get rid of legacy code!

Anyways, I was disappointed that CR not able to analysis this class properly, but I understand if CR need to analysis this class, it will slow down VS. However, seeing the error indicators on your code while there isn’t any errors really bugs me. That makes the analysis useless because I can’t really tell what is working and what isn’t working. I would rather not see any code analysis.

Btw, R# usually takes about 3 minutes to analysis this data class (if I accidentally navigated to class designer file). So, better remember to add exception file to R# option so that it won’t do code analysis.  Also, if I keep the designer file open for too long, I may run into OutofMemoryException. However, the bottom line is that R# has no problem of analysis the designer code or code that uses the class.

4

Another thing that I didn’t like to see is the following “Member is not implemented” warning. It is true that I didn’t implement anything in this method. However, I have to implement this because the class implemented an interface that requires the following method. I wonder if there an option I can mute this warning.

9 - Cant check the interface

Undisposed Variable Detection

CR can detect if I remember to dispose a IDisposable object. I think R# should have this feature. Good job to CR.

5 - Disposable check

No Linq or Extension Method Supports

It starts hurting my eyes when CR keeps giving me incorrect analysis. Linq and extension method is out for quiet some time, so I was disappointed of not seeing the correct analysis.

11 - Linq not supported

Testing Tools

One of the most use features in R# is the testing tool.  I can’t live without an integrated testing tool in a test-driven development.  With R# 4.5, it even supports native NUnit framework, which I greatly embraced.  In the older version, some of my NUnit doesn’t work because I was using new NUnit feature that R# doesn’t support. With R#, I don’t even need to install TestDriven.

I was also hoping CR would have something similar. Unfortunately I wasn’t too impress when some of the working tests failed to run correctly. Also, why CR would have the “Run test(s)” option when I right click on a private method. The code wasn’t even in a test suite. That’s confusing.

6 - Incorrect Test detection

Alt + F12 Reference Search

Another set of features that I used a lot in R# is search and navigation tool. I know that CR may not be as powerful as R#. When I tried to use the normal Alt + F12 reference search feature, CR failed to find reference call by interface.  Maybe there is an option to turn on search by interface, but I couldn’t find one.

Also, the CR search result does not look appearing with my IDE color schema (screenshot bolow). Maybe that’s why R# would rather has its own search result tab, instead of integrating the IDE color schema in the search result.

7 - busy screen and find all reference is werid

I have to admit that I am so used R# navigation and search tools that I will have to find an exact replace before I can give up on R#. Being an expert user in one tool makes it a lot harder to switch to another tool.

One thing that I find annoying is CR can’t find interface reference call. In R# it can do searches on both search using interface or concert reference call.

Learning from Shortcuts

So, one way to learn how to use a new tool is from reading it shortcut. Like R#, so I printed out an CR shortcuts reference and sticks it on my wall. Of course the list of shortcuts can only help me so much, so I tried to discover new feature from the option menu. Whoa…

8 - complicated screen

I didn’t realized you can customize how your shortcut key can execute. You can decide how an shortcut work if your cursor is at the beginning of a word, in the middle, after and many more.

I am guessing this is for the advance users. You can customize the way that you want your IDE to work. However, I have to debate that is this feature best for the users. I think having this many options can be overwhelming, and it is too powerful. It may cause key clashing with other VS shortcuts. If you didn’t backup your sophisticated shortcut settings and lose it, you can get very upset.

Refactoring

One of the big selling feature of CR + Refactor Pro is that it has many refactoring tools you can use.  From what I heard, you can do a lot more refactoring using CR then R#. However, since I only do C# development, I can’t see much benefit for me, like refactoring HTML.

Another thing I find that weird is the following: Can you consider “line-up parameters” refactoring? I would have considered this is a matter of code formatting. I use R# code reformatting tool a lot.

10 - Formatting vs Refactoring

CR also has code clean extension. One thing I heard a lot from CR fan is the power of the DXperience extension framework.  It has a strong community and it provides many free extension. However, I haven’t realized this power during my CR experience.

Conclusion

So, for the CR fans who happen to be reading this post, you may notice that I have been complain CR and rarely talk about CR advantage.  In the beginning of this post I have mentioned that I am not here to say which product is better or not. I merely want to share my experience. 

I believe CR has many good features for developers. At from what I read online, if you can master CR, you can be a very fast coder. 

For me, I don’t need to be a faster coder, but I do good code analysis tool. R# code analysis, search and navigations feature helps me a lot. In the end, you need to pick the right tool that suit your need.

It may also be a bad time for me to try CR since I was in the QA phrase. It may have been better if I use CR for new development, then I may see more benefits in CR. I have only tried CR for 3 days. So I can’t really do feature by feature comparisons.

The only reason that I was considering switching from the beginning was because of R# performance.  The good news is that these frequent OutOfMemoryException that I got from R# has NOT been crashing the entire VS since version 4.5. I can live with it. Resharper exception can be reported back to JetBrains. That’s pretty cool.

image

As a result, I stick with R# for now.

1 comment:

Mark said...

> ...I can’t understand why the entire piece of code are errors.
> My solution compiles.

Complex member is a member with a metric (such as Cyclomatic Complexity or Maintenance Complexity) higher than a given threshhold.

> In the above example, It is nice that it point out
> the “issue”, but I don’t really understand what it
> means by “Complex member”.

If you hover the mouse over the issue "Complex Member", a hint will appear providing more information.

With regard to the false positive reported on the Data.EmployeeName issue, our devs are looking into that now. If you have additional details that can help us reproduce, please send them to support@devexpress.com.

> Another thing that I didn’t like to see is the following
> “Member is not implemented” warning.... I wonder if there
> an option I can mute this warning.

Yes, there is an option to suppress issues. Just click the "..." link at the end of each issue for options to suppress the issue.

Other comments...

CodeRush *does* support Linq and Extension Methods, and has since these language features were introduced. So if you're seeing a false positive with either of these please contact support@devexpress.com with details on how we can reproduce.

With regard to your test runner experience, please send more detail of working tests failing to run correctly. In general the feedback we've received on the Test Runner is that it rocks, so if you're having a less than ideal experience we want to know about it.

You can change the highlight color in the References window by right-clicking and choosing Reference Highlight Color...

I suggest you try CodeRush one more time and also try out support@devexpress.com to see how quickly we respond to your issues and get you feeling comfortable inside CodeRush. Also, there are many powerful features of CodeRush you haven't mentioned, so if this is all you tried then you're only seeing a small portion of the product, and you won't know how great it is if you don't really get in and try it. For example, the CodeRush Training window (DevExpress | Tool Windows | CodeRush) can teach you how to use the product, and how to exploit the power of templates. Also, the TDD experience is smooth and efficient. And the source code Color Picker is pretty cool, too. If you decide to give this another try send me an email at markm at the DevExpress domain. I am interested in making sure your next experience with CodeRush is amazing.