March 2007 Entries

Going dark

Justice pinged me as soon as I got home today to point out what has happened to Kathy Sierra.  Take the time to read the whole of Kathy's post.  If you're not a subscriber to her blog, read the comments and you'll see how passionate the community is for her knowledge and personality. I usually don't read the comments on blogs because you inevitably (at least on the A-List ones) get the run-off-at-the-mouth commenters who have nothing to add to the conversation, but feel that they want to be heard.  Taking it the level that Kathy has received is going...

Coding with (or without) whitespace

Jonathan Cogley posted on how he believes that whitespace in your code is a code smell.  Thinking about this concept, I can't agree fully one way or the other.  I think that there are some situations where whitespace is most definitely a code smell and I think that there are other situations where whitespace is nothing more than a tool to reduce the strain on your eyes.  For me, whitespace used for the logical breaking of code within a single function is a sign to me that there may be opportunities for method extraction.  It's a lot like using...

Another Mocking Template for ReSharper

I spent some time today writing ordered mock tests and realized that I needed a nice quick template for the using statement.  You can download it here.  After importing it you'll be able to use it by highlighting the mock expectations clicking Ctrl-Alt-J and choosing 'om' (ordered mock).  Voila.  Just to note that this is tied to the mock test File Template that I posted here.  If you use something other than Rhino Mocks or you're not using the same mockery variable name, you will need to tweak the Surround With template to work for you.

Refactoring approaches

I'm working on a fairly large codebase right now.  Unfortunately it has significant problems.  Right now we have the time to work through some of these problems, so we are.  What does that mean?  Refactor, refactor, refactor. An unfortunate addition to our poor codebase is the lack of unit tests for huge portions of it.  Not the perfect situation when you're starting a major refactoring exercise.  So what is the best way to handle major refactorings which lack suitable test coverage? After a couple of weeks working on refactoring I think I've managed to screw up a couple of things well enough...

Visual Studio "Orcas" Code Metrics

I spent a little time this afternoon looking at the new Code Metrics functionality that has appeared in Visual Studio "Orcas".  I think that there are a number of different things that need to be said about this feature.  The first is that the list of metrics available is short.  Don't expect to be wowed and inundated with this like you will be by using nDepend.  No matter, the integration in the IDE is sweet.  Top that off with the intuitive treeview drill down of the elements being measured and you'll be in eye candy heaven.  Some...

C# 3.0 and the var type, Part 2

I didn't cover this off in my previous post on the topic, but while I was working on my last post to see if I could get the new constructor syntax to break, I started to wonder if I could use the var keyword to define properties, public fields and return values for methods. The answers?  The keyword var can only appear within a local variable declaration.  So nothing publicly exposed can have the type var.  This also includes parameters in methods and constructors. This reinforces with me that the keyword var will not be able to become another...

Constructors in C# 3.0 followup

In my previous post on Constructors in C# 3.0 I stated that I didn't understand the reasoning behind compilation creating two Employee objects in the way that it does. Richard left the following comment. I guess the second employee assignment is so the creation of the Employee seems atomic. If the assignment of FirstName threw an exception (for example), you'd never have a reference to the "incomplete" object. I got to thinking that this didn't make any sense.  If you look at the disassembled code, an error on any of the property setter calls will throw an exception...

The Contracting Game

In a week or so I will have been contracting for about 6 months.  I made a move away from the employee world because of two major factors.  The first was the fact that employee status wasn't allowing me to take advantage of the upward movement that rates were making in our local market.  The second reason is that I was feeling more and more constrained by the schedules that employers were asking me to make. The money reason was the least of the two reasons in the end.  The restrictive feeling that I was feeling around my schedule has turned...

ReSharper Live Templates

One of the nicest features in ReSharper is Live Templates.  At work during the last week I was writing a lot of mock tests and I was getting tired of tapping out the same thing over and over.  I was already using a Mock Test File Template that I'd written to speed up my use of Rhino Mocks, but it didn't help any with the repeated creation of mock objects.  I wrote this one liner that requires you to only enter the mock type and the name (which even provides a pre-determined list of names).  Making it work: ...

ReSharper Withdrawals

After a weekend spent coding in the March CTP of Visual Studio 'Orcas', I can safely say that I've seen another sign that ReSharper makes developers junkies.  The Orcas CTP is provided as a VPC image and I didn't bother installing ReSharper onto it because I didn't know how the two would play together.  As a result I was constantly hitting ReSharper shortcuts and either getting no response or being surprised with some odd reaction from the IDE.  In the end I was stumbling around in the IDE with jitters and shakes....a sure sign of withdrawal.

Constructors in C# 3.0

Another of the new features in C# 3.0 (part of Visual Studio Orcas) is the ability to do initialize objects inline and without the need for special constructors.  As you can see in the image below, this is done by initializing an object with curly braces and a "Property = <value>, Property = <value>, ..." syntax.  Also note that you don't have to use all the properties in when filling in the constructor. Here's what you see when you look at the disassembled code when I only initialize one Employee object.  When I first looked at this I...

C# 3.0 and the var type

Back in the good old days when I was programming in VB6 we had this data type called variant.  Basically we could use it for anything we wanted to as long as we were comfortable with weak typing.  Some people liked this a little more than others as I recall.  In one instance I inherited an application where variant was the only variable type that was used.  Thankfully variant disappeared from the world with the inception of the .NET framework.  Since .NET 1.1 we've been living in a strong type world that provides us with wonderful compile time validation of our...

Changing the way we code

One of the things that I noticed in the last couple of years is that a significant number of .NET developers (including myself) are doing nothing more than procedural programming while using objects.  The more I've worked on large projects, the more I've noticed that this approach imposes a large set of restrictions on what you can do with your code.  The main project that I'm working on right now is fairly large and has some interesting complexities in both the business rules that we need to program for as well as the architectural paradigm that we work within. After spending some...

Orcas and it's framework

For all the RTM versions of Visual Studio that have been produced by Microsoft since the inception of the .NET framework, each has only worked with it's own version of the .NET framework.  Visual Studio .NET (2002) worked with .NET 1.0, Visual Studio .NET 2003 worked only with .NET 1.1 and Visual Studio 2005 worked solely with .NET 2.0.  You can say that VS 2005 supports both .NET 2.0 and 3.0, but .NET 3.0, no matter how badly named, is nothing more than an extension of .NET 2.0.  Orcas is setting a breaking precedence in this realm. When you go into...

Getting work done

I've decided that my company (who employs one lousy, but good looking programmer) is going to help me get more work done.  I find that when I'm working at home I get distracted easily by things like Gears of War.  Because of this I tend to have a very large backlog of things I've been meaning to get to. To work at getting through this stack of geekdom the board of directors has decided that I'm entitled to one working weekend a month where they will located me somewhere without distractions.  This weekend I'm heading south to Calgary.  My experience...

Velocity and having your tires shot out

A while back I posted about Velocity being more than just speed.  This week I saw an entire project management team decide to shut the door on velocity.  I'm not going to pretend to understand the reasons behind their choice, but I can talk for a bit on the ramifications. In the last couple of weeks, the development team that I'm working with has achieved our first real sense of velocity (well, 0 is still a velocity, but we weren't getting anywhere fast with that).  I was starting to get a feel for the heart beat of the team.  We...

Edmug with Bristowe

We Edmontonians were out in fairly large numbers tonight to see John Bristowe, of DNIC and Plumbers fame, talk about stuff.  Sure it wasn't just stuff, but there was a lot of stuff to be talking about.  The ever ambitious man that he is, John tackled not one, not two, but three major topics in one presentation.  We heard about Visual Studio Team Systems for Database Professionals, which John suggested we call VSTS for DB Pros because 'it rolls off the tongue better'.  I hate to disagree with the man, but Data Dude is even slicker.  Alas, the marketing guys...

EViL v1.0.4 release

We pushed out a new release of EViL last night.  Looks like we added the following features for this release: Support for validating all types of properties (public, private, etc.) Support for validating all types of fields

Hey ReSharper...Shake your heads!

Maybe it's the 3 NeoCitroen's that I've had in the last hour.  Maybe it's the Tylenols too.  Heck, maybe it's the combination of the two with this craptacular illness as a side dish.  Any way you look at it I'm irked.  Well, I'll actually be brash and say I'm more than a little peeved. Dear Mr/Mrs JetBrains, Resharper is a fantastic product.  My productivity has gone up immensely since I started working with your software.  I love how I can Ctrl-Alt-V my way to a new variable, or the way I can Ctrl-Insert and Ctrl-Enter my way to a plethora...