Aug 31, 2009

Alt.Net Lightning Talks at Tech.Ed Australia 09

This just in:

Your Birds of a Feather Session Proposal, BOF003 "Alt.Net Lightning Talks" has been approved and will run at lunchtime (1245-1345) on Thursday 10 September in Meeting Room 7

So, we’ve got an hour to fill with fun and giggles.  If we take a few minutes for setup and so forth we'll have enough time for 4 sessions and some Q&A.

With that in mind, I’m looking for session proposals so either jump on to the mailing list and post a proposal if you’re going and would like to do a talk, or just ping me on twitter or send me an email. Remember, talks will be for 10 minutes MAX.

Aug 25, 2009

Some “Developers” Just Can’t Develop

I’ve been interviewing candidates for developer positions for over a decade now.  In my early years I was very much hit and miss in terms of finding the right people and it wasn’t until a horror hire that I realised what I was doing wrong.

Previously, and like so many other people I’ve seen, I would interview candidates by looking at their resumes, asking questions about their history and experience and basically trying to get a feel for the person and how they’d fit in the team assuming that if they could talk about programming reasonably well then they must be able to do it as well.  Then, assuming that conversation left me with a positive feeling, I would do the reference checks and make a go/no-go decision.

This resulted in a success rate of maybe 60%, though I may be flattering myself here. But 60% isn’t great especially when you consider the costs of a bad hire.  Even so, the bad hires I made I wouldn’t call shockingly bad, it’s just that they weren’t up to the standard I was aiming for.  At least that’s what I thought until I made a really, really bad hire.

This guy was special.  He was listed as being a .NET team lead, he talked about his history and skills really well, he was engaging and confident, and his references came back glowing with praise so I decided to offer him the job.  This he duly accepted and started shortly thereafter.  Now one of the things I was doing with new hires at the time was getting them to work on bugs – it helped me knock down the backlog and gave them exposure to a variety of areas across the system.  I also gave them plenty of time early on to learn the ropes and get up to speed and it would typically take a few days to get through the first few bugs and start having some ah-ha! moments with the codebase.

So anyway, this particular person starts and is given his first bug.  Quite a simple bug too and yet it took well over a week for him to get it done and even then he needed plenty of help and prodding along the way.  I was also getting complaints from the other developers that this guy was hopeless and a really bad developer which I couldn’t quite believe so I decided to take some time, sit down next to him and do some pairing.

What a shock I got.  It soon became all to apparent that the guy couldn’t program to save himself.  He… literally… couldn’t… code.  At one point I was breaking down the task to fix the bug into very, very small steps and asked him to put in a simple for loop and he just stared at the screen completely blank.  So I asked him what the syntax was for the for loop thinking he was stuck thinking about the larger problem or that he was freaking out with me being next to him growing ever more frustrated.  He couldn’t do it.  He simply couldn’t tell me the syntax.  Not even when intellisense was doing it for him.  How about a while loop?  Nope.  An if statement?  Only just. It was absolutely frightening. How could I get it so wrong?!  I couldn’t believe I’d made such a monumental screw up as to hire this guy.  I also couldn’t believe that the references about him were so great.

Then the slow realisation dawned on me that I’d been lied to. I know – I’m quick off the mark aren’t I? :-)  Imagine someone lying on their resume! The shock of it! Imagine someone getting their friends to pretend to be their former employer and giving them great references. Silly me.

So what was I to do? I remember an article I read around that time from Joel Spolsky that made me slap my forehead.  It basically says if you want to hire a developer, get them to do some code in the interview!  I couldn’t believe I’d been so short sighted as to not do this before.  Gah! Sure, people can lie on their resumes and get their friends to lie for them as well but when you see someone write code, there’s nowhere to hide.  You can either develop or you can’t.

So from that point on I got people to do a debugging exercise.  I figured if the code was there, then all I’m really doing is getting them to read code, understand it and make a few changes.  Pretty much like normal development :-) So I got one of my team to devise a small program that had a number of bugs in it.  You would fix one, uncover another, that sort of thing until you got it working; and all in about 30 lines of code.  When I was given with the code I debugged it first time in a matter of minutes and then used the time it took as a guide to estimate the skill level of the people I was interviewing (with judgement applied based on how nervous they were).  I’ve been using this same test, with various amendments for language changes and so forth for quite a few years now and it’s been a fantastic aid at helping me weed out those who can code and those who can’t.

So just recently I was asked to help another company vet some candidates for a role that didn’t need as high a calibre of person as I normally look for, just a competent one instead, so I figured my debug exercise might prove a little too challenging for the level I was looking for.  I figured that as a change I’d use something simpler try out a variation of Jeff Atwoods FizzBuzz test.  I figured that if the candidate got through that quickly enough then I could always whip out the debug exercise and see how they went with something a little tougher.  Unfortunately I never got past the FizzBuzz exercise since by the time they finished it they’d killed all the time I’d set aside for it (and maybe a little more).  Was I surprised at this? After all it is a pretty simple coding exercise. Well, as it turns out, No. Not really.

If you have a look at Atwood’s post and even the earlier Reg Braithwaite post then in them you’ll see that they both quote this statement “I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.”.

How very true.

By doing the fizzbuzz exercise for real, I merely confirmed what I already knew from my experiences with the debugging exercise. So, what’s the lesson here? I think it’s simple. Get your candidates to write some code during the interview.  You don’t need any special tools to do it either – just use a whiteboard and pseudo code if you want to.  But whatever you do, make sure they prove to you that they can actually do the job, not just talk the job.

Remember: There are plenty of developers that just simply can’t develop.  Avoid my mistakes and do what you can to avoid hiring the wrong people.

Aug 19, 2009

How to Install TFS 2008 on SQL 2008 SP1

As you may be aware, if you want to install TFS 2008 on SQL 2008 you have to slipstream the TFS install media with SP1 so that the installer will talk to the SQL database correctly. There’s info in the install guide if you need instructions on how to do this.

The problem is that install instructions only work if you are using the SQL 2008 RTM version.  If you try following the instructions and then installing against an SP1 install then you will be informed by the installer that the database version is incorrect and things won’t work.

To fix it, you’ll need to do some manual editing of the hcpackage.xml file in the slipstreamed install folder.  See the Microsoft KB entry for all the ugly details and instructions.

Aug 12, 2009

Be The Change You Want To See

I get to work with a lot of developers as part of what I do, and in far too many cases I find myself asking questions when I look at their code and see how they develop.  That question is usually Why?

  • Why do you write code without any tests?  Why?!
  • Why is there Hungarian notation for variable names?  Why?!!
  • Why do you have source control with no shared checkouts (or no source control at all)? Why?!!!
  • Why are you doing deployment from a developers machine?  Why?!!!!
  • Why do you have comments in your code like: "DateUpdatedValue returns the date updated DateTime"? Why?!!!!!
  • Why are there methods in classes which have more than 200 lines?  WHY?!!!!!!
  • Why for the love of all that is beautiful is there so much rubbish code here?! WHY?!!!!!!!!!

The thing that I really struggle with and that gets me really frustrated is that these developers will try and abdicate themselves of any personal responsibility for writing code the way they have.  The excuses are typically along these lines

  • Everyone else writes it that way.
  • The code was already a mess when I got here.
  • I don’t get given time to write it properly
  • The company doesn’t care about me so I don’t care about the code
  • Management wants it that way
  • It’s not part of my job description

And my response to that?

What… A… Load… Of… Rubbish!!

We’re developers aren’t we? And aren’t developers meant to be highly paid, intelligent and logical individuals who can think and act for themselves?

At the same time, many of the developers making these excuses have the same frustrations I do but just don’t know what to do about, so they sit there and try not to rock the boat, suffering in silence until they become numb to the pain and just accept things the way they are.  How sad.

So seriously, people!  Stop making excuses or accepting mediocrity and start making some changes to improve things!

Do Something About It

Now here’s some news for you - no one else is going to make the changes that are needed for your situation to improve.   If they were then things wouldn’t be in the state they are now.  It’s time admit that you’ve spent long enough waiting for someone else to do it – it’s now time for you to be the change to want to see.

So here’s some things to consider if you’ve lived in frustration long enough and want to make improvements.

Change Starts With You.  You have to start with yourself.  Check your attitudes. Take ownership and responsibility for what you do. Improve yourself until you can take pride in your work.  Start learning again.  Never stop learning once you do. Be committed to change.

Encourage Others To Change.  I hate to sound cliché but I can’t express it any better.  Change is a journey.  There I said it.  Anyway, as you learn and improve in what you do you should try and encourage others to do the same and take that journey with you.  Show them what you learn and how you learned it.  If they follow and improve as well, then that’s a great thing. If they don’t then that’s OK, just don’t let that be an excuse for you to stop doing what needs to be done.  By the way, don’t be a pain in the butt when trying to get others to change – it’s much easier to get people to change through having a positive approach than it is by shouting and complaining and generally being a angry or sullen little developer.

Change Requires Courage.  Have the courage to challenge the status quo. Courage to ask the questions about why things are done the way they are. Courage to suggest that things need improving and courage to suggest the changes that are needed.  Courage to pressure your management to improve and change.  Courage to be a visible agent of change.

Learn From People Outside Of Your Company.  Most change in our lives comes from external sources (it’s an inertia thing) so if you haven’t talked with a developer outside of your company about how they develop then you should get yourself along to a user group or conference at some point.  If your time is precious don’t sweat it, there are a number of virtual user groups that are starting to spring up around the place that you can attend without leaving the comfort of your own home, and failing that you can just increase the number and variety of blogs you read.  Regardless of how, you need to talk to and learn from people outside of your day-to-day to get fresh ideas.

Change Your Company or Change Your Company.  I can’t remember where I first heard this one, but it’s apt.  If you start to improve yourself and change how you do things then one of two things is going to happen.  You’ll either encourage others around you to change, thus improving and changing the company you work for or you’ll grow frustrated and annoyed with where you work.  If the second one should happen then you’ve got a choice to make – stay where you are and be confined and constricted, eventually growing to despise what you do, or you can take your newly improved self and find a new job and a more suitable team to work in.  Regardless of the economic climate, good people are ALWAYS in demand.  Have the courage to make that decision if that time comes.

You might also want to have a glance at this blog post on how to change the world.

So, what are you waiting for?  Go start changing things, and start today. No more excuses.

Aug 3, 2009

A Release Notes Report for TFS

One of the things people often ask me when talking about Team Foundation Server is how they can easily get a Release Notes report from it. Unfortunately there isn’t anything out of the box that does it and various searches on the net haven’t returned anything useful.

So this report idea has been on my backlog of things to do for a while and Aaron prompted me about it the other day and even provided me a bit of SQL to help push me along :-)

Anyway here’s what the report looks like:

image

Nothing too fancy – it just prompts you for the date and then a path from which to pick up changes.

“Why the path?” I hear you ask. Well, if you’re like most people you will have a source tree that is configured for branching your code and I assume you don’t really want a release notes report that shows changes in the other branches :-). The report is set to only pick up changes made to files at or below the path specified so that you have a way to only report on changes relevant to you.

Installation

Installation is pretty simple:

  1. Upload the report to SSRS
  2. Change the Shared DataSource to point to your TFSReportDS
  3. Change the ExplicitReport parameter to not prompt for user input (as shown)
  4. View the report

image

If you have any problems with the report feel free to drop me a line or leave a comment.

Feel free to take this report and customise and improve it as much as you like. Of course I’d appreciate updates and patches for any bugs you find or improvements you make to it.

The SQL in the report itself is somewhat ugly as I had to work around some limitations in what is stored in the TFS data warehouse and some other strange behaviours, but it at least works.

I hope it helps!

Note: The report was built and tested against TFS2008 running on a SQL2005 database so it should be OK for both SQL2005 and SQL2008 users.

Download the report definition here

Windows 7 Virtual Machines and Host Networking

Let’s assume you’ve got a Windows 7 Virtual Machine and you want to do networking between the Host and the Guest operating systems with it.

I’m going to give you a run through of how I set this up on my laptop using the loopback adapter.  There may be other ways, but this works quite well for my needs.

1. Install the Loopback Adapter

Go to device manager (in Control Panel) and select the Add Legacy Hardware option

image

In the ensuing wizard select: Install manually –> Network Adapters –> Microsoft Loopback Adapter

image

2. Setup the Loopback Adapter

Once the installation is complete we need to configure the loopback adapter.  My preference is to use fixed IP addresses for this so that I can use machine names to identify the VM easily, just make sure you pick an address range that isn’t used :-)

So go to the Networking and Sharing Center and select “Change Adapter Settings” on the left. You should see something like this:

image

Now go to the Loopback Adapters properties and then go to the properties of the IPv4 TCP/IP settings:

image

Simply set the IP address you wish to use for communicating with the VM.  I normally use a 10.x.x.x address range with the Class C subnet to minimise conflicts with other networks I may be connected to.

Not that I normally disable the IPv6 settings on the loopback adapter to make the configuration simpler.

3. Configure the Virtual Machine Networking

Assuming you already have a virtual machine configured you now need to go to your virtual machines settings and set up the networking as follows:

image

Set adapter 1 to be the loopback adapter and adapter 2 to be your physical network adapter so that I can access the internet and other networks from the VM should I need to.

4. Configure the VM’s Operating System

Now we need to start the VM and change some settings in the networking to use the fixed IP for the loopback adapter in much the same way as we did for the Host Operating System.

image

You may notice that in the network adapters it’s hard to tell which adapter is which since they are all the same type (i.e. the virtualised network).  The trick is to remember which network adapter is which in the VM settings – Adapter 1 is “Local Area Connection”, Adapter 2 is “Local Area Connection 2”, etc.

5. Don’t Forget Your Firewalls

So if we were to try pinging the Host OS from the VM we would probably find we don’t get a response, and the same would happen if we did it the other way around.  If that’s the case you probably forgot to adjust your firewall settings.

Here’s how it’s done in Windows 7 on the Host:

Go to Control Panel –> Windows Firewall then choose “Advanced Settings”

Select the Inbound Rules from the left side and then choose the New Rule action from the right.

image

Choose “Custom” in the dialog and then in the scope step add the IP address for the VM in the Remote settings area (as shown).  For extra security you should also ensure that the local address is set to the IP address of the loopback adapter on the host (10.2.1.1 in my case).

image

Allow all connections through on that rule and don’t forget to give it a meaningful name such as “Windows VM Loopback” or something like that.

You’ll also need to do that same in your guest operating system (assuming it also has a firewall enabled).

Once that’s done you should then be able to ping the Host from the VM as shown and do the same in the reverse direction.

image

6. One Last Step

Trying to use IP addresses can be somewhat of a pain, especially if something you’re accessing is wanting you to use host names instead.  The way to improve this situation is to edit the HOSTS file and add entries for the remote machines in both the Host OS and also in the Guest OS (the VM).

On Windows 7 start Notepad as Administrator since you need Administrator privileges to edit the HOSTS file.  The Hosts file can be found in C:\Windows\System32\drivers\etc.  Note that there is no extension on the Hosts file so you may have to change the filter in the Open File dialog to show all files before you’ll see it.

Once you have it open add an entry at the end of the file on a new line in the format of <ip address> <machine name>.  For example I use:
10.2.1.2    tfs2008-vm

Save the file and check that things are working by opening up a command prompt and pinging the virtual machine using the name you just gave it:

image

Don’t forget to do the same on the Guest OS in the Virtual Machine.

Once that’s done you should be all set to go and your Windows 7 Host and you Virtual Machine should now be able to talk to each other without a problem.

Enjoy!