GSOC 2015 : From NRefactory 6 to RefactoringEssentials

0

Hey guys,

In spirit of my withdraw from the Google Summer of Code program this summer, I thought I’d do a piece of the project I successfully completed last summer. So what brought me to the program last year ? I spent a few weeks on working on a new thing in .NET called Roslyn. For my internship, I had to develop design semantic rules that my senior programmer was giving me. The first one I had to do was detect when developers were using “synchronization primitives” such Mutex, Monitor or Semaphore. Internally, they had developed something else to help better avoid dead/live locks. Acting this way, they could refactor previous projects and make sure to use their internal structures.

That one took me a while because there weren’t any useful (in my opinion) links that I could find on the subject (Winter 2015). The one I am most fond of was one where my senior found out that they were many times developers were making syntactically and orthographic errors. My job was to develop an algorithm which could pinpoint those mistakes in either variables/members/parameter/method names or even in comments. Part of my algorithm to match the errors was to used a dictionary having all the possible errors for a word as values and the correct word as the key. Doing so, I had part of the solution to develop the refactoring in case my code analyzer picked up anything.

So, back to the GSoC 2015 program. I saw the Mono Project project, NRefactory. The NRefactory library defined code issues and code actions which are basically code analyzer and code fix providers in Roslyn. The library was implemented using FxCop. But there were more traction at the time towards Roslyn. The idea behind the project was to port NRefactory 5 to version 6 using the Roslyn API. Code issues were define and the task was to reimplement them in code analyzers and define a proper code fix provider. Here’s below a non-exhaustive list of what I’ve implemented over the course the summer.

  • Rewrite if return to a simple return
  • Remove redundant code : invoking ToCharArray on a string
  • Remove redundant code : empty finally blocks
  • Remove redundant code : useless parameters in a method declaration
  • Making a member static once I’ve seen that value is never changed

So here’s a link to my GitHub repo.

Kevin out.

 

 

Advertisements

Integrated Development Environment (IDE)

0

I can assure you, this is the last post I’m writting before you’ll finally be able to dive into programming. On the plus side, this post is meant to help you with coding. To be able to program any software, a programmer needs an integrated development environment (IDE).

Before, .NET applications were only able to be used on the Windows operating system. But since a great event that happened a few days ago, .NET became an open source project! Hearing this was a source of great joy for us, .NET developers. This means that now you’re not force to have the Windows operating system on your machine, you can now have it on either Linux or Mac OS X.

You have a great selection of IDE to create a software using .NET. Below, you’ll be able to find a small list of IDEs you could use.

  • Visual Studio
  • Xamarin
  • ReSharper
  • SharpDevelop

For my case, I’ll be mostly using Visual Studio, the Community Edition. Some IDEs can be expensive to buy, but this edition is not only free, but gives you the ability to create various kind of apps like :

  • Video games
  • Mobile application
  • Web application

You’ll be able to find the Visual Studio Community Edition here : http://www.visualstudio.com/news/vs2013-community-vs.  Now, we are all set to be able to create awesome stuff!

Kevin