My preliminary NDC 2009 agenda

Torbjørn Marø over at kjempekjekt.no has posted his personal agenda for NDC 2009, and thought it was a great idea. And like all great ideas, they are copied relentlessly.

Day 1

I have some favorites here, but some sessions have stronger competition than others.

10:15 Michael Feathers Seven Blind Alleys in Software Design
11:30 Michael Feathers Working Effectively with the Legacy Code: Taming the Wild Code Base
13:30 Jeremy D. Miller Lessons Learned from a Long Lived Codebase
14:45 Udi Dahan Designing High Performance, Persistent Domain Models
16:00 Udi Dahan Intentions and Interfaces – Making Patterns Complete
17:15 Michael Feathers Design Sense Deep Lessons in Software Design

Day 2

I have intentionally left a couple of spots blank, ‘cause I can’t make up my mind. And unfortunately it has more to do with lack of topics in those particular slots than the opposite.

09:10 Peter Provost The Butterfly Effect
10:15    
11:30 Ted Neward Extend the Customization Possibilities of your .NET App with Script
13:30 Robert C. Martin Clean Code: Functions
14:45 Ayende Rahien Object Relational Mapping +=2: More than just Data <-> Object
16:00    
17:15 Robert C. Martin Clean Practice: Agility and Craftsmanship

Day 3

Even though this has some of the most interesting talks, I can live with seeing them later on video. I just don’t want to miss an opportunity to sharpen my saw with Scott Bellware.

Concluding thoughts

Moltke said “No battle plan survives contact with the enemy”. If I rephrase it just a little to “No plan survives contact with reality”, it will properly relay my feelings about my plan on this occasion.

There will probably changes in the official agenda, and I might be infatuated with a speaker or two during the conference. Looking at my list, I sway in the direction of technology-agnostic topics. That sounds about right.

But more important: I’ll see YOU there, won’t I?

1 Comment

I Have a Dream

The usual suspects

Whenever I’m presenting anything, I try to start off showing the “Top 20 replies from a programmer when their programs doesn’t work”. In case you’ve never seen it, here it is:

  1. It works on my machine.
  2. Where were you when the program blew up?
  3. Why do you want to do it that way?
  4. You can’t use that version on your system.
  5. Even though it doesn’t work, how does it feel?
  6. Did you check for a virus on your system?
  7. Somebody must have changed my code.
  8. It works, but it hasn’t been tested.
  9. THIS can’t be the source of THAT.
  10. I can’t test everything!
  11. It’s just some unlucky coincidence.
  12. You must have the wrong version.
  13. I haven’t touched that module in weeks!
  14. There is something funky in your data.
  15. What did you type in wrong to get it to crash?
  16. It must be a hardware problem.
  17. How is that possible?
  18. It worked yesterday.
  19. It’s never done that before.
  20. That’s weird…

I’m not quite sure who wrote it originally, but I was given a paper copy several years ago. I must admit I had a good laugh at the time, as I could relate to most of the replies.

So whenever I’m presenting this list, there’s a giggle and a great deal of nodding and smiling going on in the audience. Then I go on to present something that will alleviate one or more items in this list.

But it’s not a laughing matter! It’s the sad state of our beloved profession we’re laughing at. It’s not supposed to be like this.

The Dream

When I’m presenting the list in 10 years from now, there’s not a giggle. Not a smile. Just silent shame of times past or loud laughter at good ol’ days. Hopefully no one doesn’t even recognize the items on the list.

I might have a different kind of list. But not this one. We have made progress.

What to do next

So I propose this list as the metric for how mature your development organization is. Same rules apply as in the wtf code review metric. Less is better. Drop the Joel test. Drop the Nokia test. Drop test X. Use this. Now!

The worst part of this is that most of these are solved problems. Test Driven Development, Continuous Integration, and Pair Programming have existed a decade. Their poorer, but still useful cousins, Unit Testing, Automatic Builds, and Code Reviews have been around the block even longer. Iterative and Incremental development, Miniature Milestones, and Review and Adapt has been grown ups for a while as well.

So there is no excuse. The answers are at your doorstep. But it takes discipline. And time.

But you’re not alone. I’m off trying to do my part. Our mission is clear. Will you do yours?

No Comments

Happy New Year & 2008 in the Rear-view Mirror

A bit late but hopefully still good, a Happy New Year to you all! Resetting the DayOfYear-count always makes for a good time to look at what happened throughout the previous year. Here’s how 2007 went, and here is my 2008 timeline:

January

We encounter our first huge slowdown in the project as one person quits and another is coming aboard. We’re still as a collective fumbling with regards to TDD and unit testing in general, especially when it comes to non-domain code aspects.

I’m getting more involved in company wide issues by the day, and I’m contributing to a couple of offers.

I turn 30 with no real fuzz. Just the way I wanted. I’m getting old, and I can spot a grey hair occasionally!

February

We’ve just ramped up a fourth developer when he slips away for other duties, and another one is coming on board on the project. Good thing we have a zero-friction developer install for our solution. We present the project for the whole division at our yearly kick-off.

We’re moving offices at work, moving across the street. At the same time we’re rearranging how we’re situated, and are now grouped by roles and projects rather than section.

I attend Software 2008, and I think it’s good!

March

The project at work marches on, nothing spectacular happens.

Enjoying a nice week off during Easter.

April

Starting coordination work with another application vendor we’re integrating with our application. Integrations always seems to be a pain point, and it’s good to start early.

I’m summoned as a witness in a trial between an ex-colleague and ex-employer, and I’m clear and concise in my statements on the stand. It was certainly not a nice experience. The ex-colleague wins the case, which later has been anonymously cited nation-wide for it’s precedence in overtime payment.

My oldest son turns 4, how time flies…

May

A really quiet month, I guess I was incredibly productive :-)

Oh, and I start this years outside maintenance and upgrading of the house.

June

The biggest thing this month was definitively Norwegian Developer Conference. Two full days of great content, and it really catapulted me into the .NET community at another level.

July

I’m taking a 4 weeks back-to-back vacation for the first time ever. It was great, and I got to read a lot of great development books on the beach.

August

Getting into the nitty-gritty details on the integration in our project. Reality is messy by nature.

Reflector is now in the hands of Red Gate. I great addition to their already awesome portfolio.

My youngest son celebrates his 2nd birthday.

September

The whole division at work travels to Rome for an extended weekend. I’ve never been there before, so it’s a great experience. Must return some day.

I’m kicking off internal presentations of techniques, practices, technology, and anything really developer related at work. We’ve arranged 7 meetings to date and have touched topics from Silverlight via F# to Design Patterns and Continuous Integration. A definitive success.

I’m attending an MSDN Live event in Oslo with Steve Ballmer.

October

Smidig 2008 is arranged, and I’m there. I sometimes wonder how far fetched my thoughts are about the intersection between the agile and the .NET community being Ø… Come on, it’s enough agile to go around for everyone. Great lightning talks and even better open spaces. I especially enjoyed one on clean code, and another with technical debt. Thanks to the participants!

November

More people are starting to touch our fully integrated test installation of our new product, and we find some strange bugs.

Our team has been using ReSharper a long time, and after a presentation of its capabilities to the division we’re overwhelmed with the interest. The end result is that we invest in another 20 licenses of this great product.

I’m attending a breakfast seminar with Bob Martin on FitNesse. I’m not completely sold on the idea though.

My better half turns 31. She’s still in the lead.

December

I’m attending a CSM course with Jeff Sutherland and become a Certified Scrum Master. It’s supposed to be a Next Step course, but I think there was a flawed filtering process as most did not have any experience doing Scrum. Some value was extracted however, in particular in the Q&A sections.

We have an all around crappy Christmas, being ill most of the time.

No Comments

Mystery Code I – Demystified

Either no one reads my blog or I didn’t present the problem good enough. The first is probably the safest bet. But here’s the answer anyway.

I made a small hint about it was run on a terminal (meaning I’m logged in as a user on a Windows Server with Terminal Services running (just to be clear)).

The Smells

So lets look at what possible smells we can find in the code:

image

That application specific GUID sure seems like it can be trouble.

image

Hmm, the GUID is now used as the name for this Mutex. And now the last piece of the puzzle:

image

Ok, this sure works when I’m sitting alone on my computer with my application, but what happens when multiple users on a terminal server tries to start the same application?

The Problem

Multiple NamedPipeServerStreams with the same identifier will be tried made, and then you will get: “IOException:  All pipe instances are busy.” But shouldn’t it stop at the Mutex before it tries to make the server? After all, the named Mutex is using the same GUID as identifier as well.

image

It seems that the assumption that the Mutex and the named pipe operated on the same system level are flat out wrong. They don’t!

Mutexes defaults to session locality when run on terminal services and named pipes does not!

You can prefix your mutex identifier with Global\ to ensure a system wide lock even on a terminal services system, but this isn’t really what we want in this situation. We would really like all users to get a single instance each.

The Solution

With the problem identified, the solution was easy. We just incorporated the logged in username into the identifier, and everything was humming along.

Until next mystery, go solve some yourselves.

No Comments

Mystery Code I

There are a lot of ways to make sure your .NET Windows application just has one instance running, and we picked the one described here. It was working flawlessly until someone tried running it on a terminal where it crashed mysteriously.

What happened? Can you spot the error?

No Comments

ReSharper messes up your Visual Studio shortcuts

I must start stating I’m a huge fan of JetBrains’ ReSharper for Visual Studio, it certainly makes me more productive in my day-to-day coding tasks.

None the less, today I was just a little bit frustrated when upgrading from 4.0 to 4.1. I have a couple of custom shortcuts which I don’t mind retaining. But ReSharper happily overwrites it all with default settings, which was quite annoying. The least I’d expect would be a message telling me it would (or didn’t I read the setup correctly?) do it, and I’d happily save my settings and restore them after the upgrade.

I see that others have complained as well, and you will find JetBrains official statement here. MS & JetBrains should really figure this out.

So if you’re upgrading ReSharper these days, please back up your VS-settings first!

No Comments

Beware of the IEnumerables

Some time ago I wrote about the difference between List and Collection, and how you should use them. Usually you want to keep the details away from the users of your class, and an even tighter way to encapsulate a list of something is to expose IEnumerable<T>. Note that both IList<T> and ICollection<T> inherits this interface, so IEnumerable<T> exposes even less details to the user. Another benefit is now you can use yield behind the scenes to create your “list” on the fly.

But this also its pitfall. What do you think will be the output of this code?

   10   static void Main(string[] args)

   11   {

   12       var ola = new Pupil(){Name="Ola", IsMate = false};

   13       var trond = new Pupil() {Name = "Trond", IsMate = true};

   14       var pupils = new List<Pupil>(){ola,trond};

   15 

   16       IEnumerable<string> names = ClassMateNames(pupils);

   17 

   18       foreach (string name in names)

   19       {

   20           Console.WriteLine(name);

   21       }

   22   }

   23 

   24   private static IEnumerable<string> ClassMateNames(IEnumerable<Pupil> pupils)

   25   {

   26       foreach (Pupil pupil in pupils)

   27       {

   28           if (pupil.IsMate)

   29               yield return pupil.Name;

   30       }

   31   }

 

Yes, you’re right, the output is my only friend “Trond”:

image

But when are we really finding out who my friends are? The most natural thing is that I find them when I call ClassMateNames, as it is called first. That’s what I’d think anyway. But what if got in a fight with “Trond” between when I sort out my friends and list them to the console?

   35   private static void FightWith(Pupil pupil)

   36   {

   37       pupil.IsMate = false;

   38   }

   16   IEnumerable<string> names = ClassMateNames(pupils);

   17 

   18   FightWith(trond);

   19 

   20   foreach (string name in names)

   21   {

   22       Console.WriteLine(name);

   23   }

This gives me these friends:

image

How about that! The information that I no longer is friends with “Trond” has changed the list I thought I retrieved with the call to ClassMateNames. What is happening is called deferred execution, which delays the actual execution of the internals in the ClassMateNames to when I iterate it. This is exactly how LINQ to [insert TLA here] operate as well, so nothing is actually fetched until you need it.

In my case this was an advantage, because at the time I was listing my friends, I didn’t actually have any!

And the problem is?

The problem starts when you before and/or after the call to ClassMateNames set up and tear down a session, connection, or anything that the inside of the iterator rely on. Any fetching of IEnumerables inside using-blocks should also be considered smells in this regard. If you should clear the list of pupils right after you have sent it to ClassMateNames (you don’t need it anymore right?), you have introduced a very subtle bug as the list is empty at execution.

The advice are thus: IEnumerables and yield is definitively great tools, but be aware of the inherent difficulties and quirks of deferred execution and use them with caution both as producer and consumer!

No Comments

MSDN Live with Steve Ballmer keynote

ballmerMSDN Live has toured Norway this fall, with a handful of presentations for .NET developers. I attended the last one in Oslo on Tuesday, where Steve Ballmer made the keynote!

Most developers have seen the developers, developers, developers talk, and we had high expectations for this keynote. He was quite enthusiastic in Oslo as well, telling us about things he thinks will influence our industry in the foreseeable future. This search at Youtube seems to find the whole show.

The rest of the day I attended the main track, starting out with a Silverlight 2 presentation from Gøran Hansen. While Silverlight 1 was mostly about animations and media, I didn’t give much attention. But the second version looks promising, with the CLR and a subset of the .NET libraries present. What I miss though, is maybe some background about the fact that running .NET WinForms applications in IE in object-tags has been possible a long time (without the automatic deployment of the framework). Props however to MS for finally supporting more than Windows & IE only! Gøran did a great job presenting, I really enjoyed his presence on stage.

Next up was another presentation from Gøran, which gave the audience an introduction to ASP.NET Dynamic Data. For those of us who attended NDC2008 and Scott Hanselmans keynote there, it was plain repetition. The only difference might be that this was showing the final bits released with SP1 of the framework, and Scott showing us some earlier version. It seems like a great technology to get you up and running very quick, but I wonder how many pages you end up with in the CustomPage directory after a while. Even though the topic didn’t tickle my fancy, Gøran did a great job on this one as well.

Then it was time for lunch, rather late according to my stomach. But it tasted good, and there seemed to be enough to fill up all us starving geeks. As always during the breaks, old colleagues and friends sneak up on you and says hello. Which I really do appreciate!

After the break, Anders Norås gave a talk about SOA. More specifically about how we should start thinking along the lines of enterprise service buses and leave our old crusty webservices in the dust. I really do concur with a lot his ideas, and I’m always happy to see code with binsor-love. I also liked his onion-architecture, which resembles my standard layered architecture (no, not the "standard standard"). Hmmm, looks like another blog post (again).

"Debugging your debugging habits" was up next with Rune Zakariassen from Microsoft. He showed us some tips & tricks for your debugging needs in Visual Studio, and presented a step-by-step recipe on how you best can find bugs in your code. I thought it was a nice presentation, even though my only real takeaway was the tracepoint functionality in VS. I’ve been a sucker for Debug.Writeline when I don’t want to impact the run of things stepping through, but this gives me an even less intrusive way keeping track of how the program executes.

Finally, Gøran entered the stage for the last time this day. He showed us how WPF databinding can be used with a variant of Model-View-Presenter called Presentation Model. The emphasis was really on this pattern, and how it helps attain SoC. He also mentioned DIP with the short version "Program to an interface, not an implementation". A good thing can’t be said enough so here is the original:

High level modules should not depend upon low level modules. Both should depend upon abstractions.

Abstractions should not depend upon details. Details should depend upon abstractions.

All things considered, yet another great talk from Gøran, keep up the good work and preach on about those design patterns and OO principles!

Yet again, great work by Rune @ Microsoft arranging this event. Until next time, I’m on twitter at http://twitter.com/haugern.

1 Comment

Late to the Twitter-game

I’ve finally caved in and created a Twitter-account today, you can follow me at http://twitter.com/haugern!

No Comments

Introducing my Bookshelf

I have for a long time been very up front with everything I was aware of I didn’t know much about. As a countermeasure and a late follow up to Sources of Software Development learning (About Me), I’ve listed some books I’ve got in my bookshelf in my home office.

Let it be your starting point into the great resource of reading books. Blogs are great, but books really are in a different league when it comes to polish, hard facts, and references. I really find it a lot easier to get immersed in a topic when reading from a book than from my screen, and of course you have the added bonus of being offline while reading.

Amazon is your allied (especially now when the $ is really cheap for us Norwegians); go make your book order today!

No Comments