Visual Studio


Visual Studio can be quite viral in my life. When I am “into” something or having to pick up a new technology or methodology, it is where I reside. This Sunday morning; it is a comfortable place to be!

The new project I am working on and the Entity Framework, in particular, are the objects of my latest bout of obsession.

I have had a particularly good week; for the first time in my current role, I am writing tests prior to code. Logging in on the weekend when there is nothing that has to be done is a very good indication of my happiness in work.

Scoping a task in tests is one of my favorite elements of TDD (and software development as a whole.) The effort to make the test suite be the best documentation of the elements they test is one that makes perfect sense to me. Developers will write document business rules which will be validated each time the test suite is run. In addition, I like writing tests; they increase my understanding of what I am doing.

Out of the box, Microsoft’s new code analysis tool (Style Cop) did not play with the firmly entrenched ReSharper in my Visual Studio IDE. However, a quick dash to CodePlex yielded a plug-in for ReSharper that had me back in business in minutes.

My first take on Style Cop was that it was a great deal of commenting and a new place for my using directives. Feeling a little affronted by the 199 warnings my ASP.NET MVC spike project generated on the first scan, I changed Studio to treat warnings and errors, made a cup of coffee and set about it.

I am pedantic. My wife is a saint as she lives with me and has yet to seriously hurt me and to my knowledge not on purpose, yet. This trait is either a symptom of my trade or a cause. There is a small amount of shame welling in me as I try to convey to you how much I adored the code I produced in the next couple of hours. It did not do anything different functionally (well some tiny bits) but it looked shiny. It was the type of code that I wish to encounter in projects that I work upon.

Style Cop is a winner with me! I heartily recommend trying it; if you have not already.

The senior technical lead in my department, Barry, has instructed me to add it to our build process. The way he put it, and I paraphrase was “I don’t agree with everything it suggests; but I’ll accept it for the standard of code it enforces others to produce.” I must concur!

My last little while has been spent getting my EeePC configured just as I want it. Being a C# developer, I wanted to make sure there was nothing I would not be able to “try out” on the train journey to and from work. (or any spare 30 minutes or so to be perfectly honest!) That meant I needed Visual Studio 2008, SQL Server and a source control solution.

I have never been a masochist so I waited until I had upgraded the RAM in the EeePC to 2Gb; although SharpDevelop performed admirably with the previous 512 Mb incarnation, the lack of ASP.NET hampered it’s usefulness to me. After adding a 6Gb SD card I was ready to start.

Firstly, XP with all the updates to the solid state hard drive. You must make sure to use NTFS as you will need to mount the SD card to an empty directory inside this drive. Then install VS 2008 as usual with the target as inside the SD cards mounted directory. I then un-installed SQL Server Express and installed it with advanced services to get the Management Studio. I then installed svn1click and presto … my Developer EeePC.

I have been using my EeePC for everything at home this week, including using Terminal Services into work. It has performed wondrously and I have had the opportunity to sit in the living room with my gorgeous wife whilst still getting my geek face on!

If you are Martin Fowler and the crew at ThoughtWorks, Continuous Integration is a non-event. A weekend seems hardly enough time to promote myself to the guru rank that Mr. Fowler garners; so I set a slightly more realistic set of goals for the weekend.

Goals

  • Integration with VSTS Source Control
  • Tests to be run at build time (using MSTest)
  • Build Failure upon test failure

The raging hippie in me found it hard to refrain from adding Lava Lamp support to my list of goals! Maybe I can convince the team to look at this down the road.

I had a phenomenal day today. With a few pointers from a couple of my colleagues (Thanks Tom and Isiah), I wrote some of the best code I have ever written.

Whilst working on some Test Utility Methods, I noticed I had a few methods that were basically duplicate code with the exception of their return type and the type they used inside the method (the same type.) Previously I had only used generics in enumerating collections; Tom mentioned if I could get the conceptual “Penny to drop”, this was another example that lent itself to using generics.

My refactored code looked something similar to this:

public T SomeMethod<T>()
{
T myObject = AnotherMethod(typeof(T));
return myObject;
}

I had a paranoia moment … could I, in a pinch, use PGP to encrypt/decrypt some more sensitive text bits and bobs. So I went looking; or more correctly I set Google about searching for a solution. The net result (*snigger) is Bouncy Castle. I love open source projects!

I found a useful couple of regular expressions for cursory validation of email addresses and URLs. Hopefully someone finds them useful.
(more…)

Next Page »