Friday with Filip – Dealing with Code Complexity

Posted by Filip Ekberg on October 12 2012 2 Comments

Welcome to this week’s Friday with Filip!

Yet another interesting week has passed with lots of things to discuss. Before we dig into this week’s subject, I just want to take a brief moment to share something interesting that I found (it was recommended by someone I know from IRC). There’s a hosting company called EDIS based in Austria that is now providing a very neat service; Raspberry Pi Colocation! As soon as I saw this I shared it with HackerNews and got a response from EDIS on twitter:

It’s worth just thinking about this for a second, let’s say that 1000 RPi’s could host some websites, instead of 1000 1U rack servers; imagine the power that would be saved (and the space).

Now to this week’s subject!

Last week we discussed how we could join new projects and do that efficiently and I got some great tips & tricks from a lot of you (in different channels). This week we are going to follow in those footsteps and see how we can actually find complex code in our applications. While finding complex code is important for all different programming environments; we’re going to look at this by using C#, Visual Studio 2012 and NDepend.

It’s a little bit different this week..

I recently recorded the first episode of a webinar series with Patrick Smacchia, the founder of NDepend and who better to talk about Code Quality and Code Complexity than with him? So this week, I’m happy to announce that you can watch the first video in this webinar series!

It’s a 30 minute webinar where Patrick and I talk about Code Quality, Code Complexity (CyclomaticComplexity) and other things around this subject.

After watching the video, please tell me and Patrick what you thought about the video and tell me what your tips are to find complexity in your code or projects!

P.S. Today is the last day to get a 35%
discount on C# Smorgasbord!

Vote on HN

Roslyn CTP v2 Released

Posted by Filip Ekberg on June 5 2012 Leave a Comment

You can now download and install a new version of the Roslyn CTP. The Roslyn CTP is now compatible with Visual Studio 2012 RC for this you will need to download and install Microsoft Visual Studio 2012 RC SDK!

Installing Visual Studio 2012 RC SDK

Installing Roslyn CTP v2

Testing Roslyn in Visual Studio 2012 RC
When the installation has finished, you can start Visual Studio 2012 and create a Roslyn Console Application:

Then we can create a simple ScriptEngine that just executes a snippet:

var engine = new ScriptEngine();
var result = engine.Execute<bool>("var x = 10; x == 0");

Console.WriteLine(result);

I tried upgrading the code from the my previous post on “Hosted code execution” and it seems to only be minor changes that are needed. These were the only errors:

  • The constructor for CompilationOptions takes less parameters ( no longer a lot of optional parameters )
  • ParseOptions no longer has a constructor defined, use CompilationOptions.Default
  • ObjectFormatter no longer has a constructor defined, use ObjectFormatter.Instance

There are most likely a lot of other changes made, but these are the ones that broke the build of “Hosted code execution“.

See a list of API Changes here. The post also lists the new language features implemented since CTP1 (C#):

  • Anonymous Types
  • Attributes (full support)
  • Base call support
  • Checked and unchecked expressions and blocks
  • Events
  • Finalizers
  • Generic constraints
  • Implicitly-typed arrays
  • Indexers
  • Iterators
  • Lock statements
  • Named and optional parameters
  • Param array parameters
  • Partial methods
  • Operator overloading
  • Query expressions
  • Switch statements
  • User-defined conversions
  • Using statements
  • Volative fields

Vote on HN

Microsoft Visual Studio 2012 RC Released!

Posted by Filip Ekberg on May 31 2012 Leave a Comment

I just wanted to make a short post about some very exciting news, Visual Studio 2012!

Visual Studio 2012 RC was just released and can be downloaded together with .NET 4.5!

So it seems the name changed from the “code name” Visual Studio 11 to Visual Studio 2012, not too surprising.

Let the installation begin!

Here are some screenshots from the installation process:

Once Visual Studio 2012 RC is installed, you can fire it up and start coding! It will require at least one reboot during the installation process.

Below are some screenshots from Visual Studio 2012 and as you can see, they’ve listed to the public and added at least some color to the icons.

Start screen of Visual Studio 2012

New project window

Running a Windows 8 Metro Applicaiton in the simulator

I am currently running Visual Studio 2012 RC in the Windows 8 Release Preview which was released at the same time as Visual Studio 2012 RC.

Vote on HN