blog.vi-kan.net One thought after another

Norwegian Developers Conference 2009

So, for three days now, I have been attending #ndc09. One thing that I really like about it, is that it’s not owned by any single platform vendor or any thing like that. This is not Microsoft trying to sell their tools or technology. It’s just some cool gays (and a couple of ladies) putting together some of the worlds best speakers and inviting all of Norway to come listening. It’s not like you want see any Microsoft banners at all, and most of the technology spoken of is MS specific, though. It’s hard to change the fact that most developers tend to use MS technology already, so that’s what they would want to hear about.

Now, you can read more about #ndc09 at http://ndc2009.no/, and you can also find information about last years event there. We have been promised that all sessions will be published on that site as soon as possible. I’m looking forward to that. There where quite a few sessions that I would love to see, but obviously you have to make some choices. So when the sessions get available online, I can catch up with all the sessions that I missed. I will also take a second look at some of the sessions that I did attend. It’s easy to forget things after eight hours in uncomfortable chairs…

1st day

Keynote: “Are You a Professional?” with Robert C. Martin

The keynote will always be the grand opening of the ball. It will set the context for the rest of the conference. The agenda. R. Martin, or Uncle Bob as he calls him self, started out with the question ‘Are you a professional?’. He followed up with a set of criteria’s, or principles, that he thinks you have to fulfill to give an positive answer.

I really liked this session, and found it very inspiring. It was a given as an challenge to start act as an professional. To take both your paid work and your profession seriously, even after paid hours. He finished it off with the sentence “I’m a doctor; I don’t have time for washing hands.” as a clear parallel to developers not taking the time to do tests.

“Deep Tour of .NET 4” with Scott Hanselman

I have to admit, that I partly choose this session because it was held by Hanselman. Of all the speakers, he was the one that I knew most about. I’m a regular reader of his blog, and an occasional listener to his podcasts. I like his style, and couldn’t wait to experience him live.

“Making Your Blog Suck Less: Social Networking and Your Personal Brand Online” with Scott Hanselman

The next session that I attended was also a Hanselman-show. This time he shared some of his own experience with blogging and becoming ‘a brand’. Actually, the talk was mostly a repetition of a post he did to his blog back in 2007, but hearing it live with the opportunity to ask question is still valuable. One of the things he said, was that you probably would just be writing for your self a couple of years. No one will be reading your blog, until you suddenly blog a topic that some way manage to show up on google. Hopefully this one post will pull some more readers to your other posts – if they’re interesting enough.

“Declarative UI Programming with XAML: Windows Presentation Foundation, Silverlight & Surface” with Tim Huckaby

For the third lesson, I choose to move over to the WPF-track to see what was going on there. I find WPF quite fascinating, and wanted to pick up some tips. There is not much to say about this lesson. It was obviously that I had chosen wrongly when leaving track 2, and missing out on Phil Haack and the MVC-ninja-thing. Actually there was two other sessions at the same time that I would love to see. Both Michael Feathers and Robert C. Martin was talking at the time, and according to twitter-messages there was a lot more going on there than where I was. As soon as it finished, I went back where I came from.

“ASP.NET MVC AJAX = meant for each other” with Phil Haack

I have been curious on the ASP.NET MVC framework, but I have never taken the time to look at it. Phil Haack gave a interesting session that, even though it focused on using AJAX with MVC, gave some shallow insight into what MVC looks like. I’m not a web developer, so it’s not that relevant for me. It made me curious, though. It seems to a more tidy way of doing asp.net then what I have seen before.

“The Haacked and Hanselman Show” with Phil Haack & Scott Hanselman

Now, this session scared me a little bit. Scott made some simple web sites, and Phil showed how to exploit some of the weaknesses that he found; Calling javascript and posting values from other sites, making use of  javascript injection. Scott showed how he could secure his site from Phils attacks, but how do you know before you have experienced such an attack? I think I would felt uncomfortable doing web development, but I guess you get confident with whatever you do after some time.

I ended up buying the ASP.NET MVC-book, though, and I’m looking forward to read it.

“How to scare C# developers with Ruby” with Scott Bellware

This session was announced the same day as the conference started. I have been reading a little about Ruby, and find it very interesting. Scott Bellware jumped right to the scary parts. Creating new classes at runtime, filling it with members, instantiate it, adding more members to the new instance – yes, I guess this could scare both C# and other developers. It’s not easy to follow, but seen some of the things that you can do with it, makes it well worth I guess.

2nd day

“Understanding Test Driven Development” with Roy Osherove

This was the first of many TDD-related sessions for this day, and he started by defining TDD. For developers that want to start with TDD, but lacked experience with unit testing, he suggested to start out with writing tests for code that is already written, and then switching to tests first-development when you had gotten used to writing tests. Finally you will come to a stage where you write tests first, and let the tests drive the design, and you have reached Test Driven Design.

“Unit Testing Best Practices” with Roy Osherove

Now that we hade a fundamental knowledge of what TDD is, he went further and showed us some dos and don’ts. Only one assert in each test method. Only break one test at a time. Give good names to the test methods; He suggest a MethodName_StateUnderTest_ExpectedBehavior – naming convention.

“Beautiful Teams” with Roy Osherove

After a couple of TDD-sessions, Roy took a step aside to talk about ‘Beautiful Teams’. I chose to follow him, and got a interesting talk about what factors Roy thinks makes a good team. I was surprised how much he valued efficient use of tools. I was also surprised that he wanted the team to work together in the same room. I have always valued my four walls, and find it very distractive to work with others in the same room. Instead of helping each other out with problems, there will soon be talking about last nights game and things like that.

Everything could be summarized down to automation. You have to be on a continuous lookout for things stopping the productivity, and then look for ways of optimize that bottleneck away. Learn keyboard shortcuts. Stop using the mouse. Get a automated build-system. No long and wasteful design meetings.

“Test Driven Development: Using Mock Objects” with Roy Osherove

And then we where back to TDD, and this time Roy told us about mock objects and some mocking frameworks. He stressed the difference between a mock object and a stub. Both mocks and stubs are fake. What makes it a mock, is when you assert on it. If you test against a fake object, it’s a mock. If you just have a fake object to get rid of dependencies, it’s a stub.

“Mocking on the Edge – isolation at the System Level” with Roy Osherove

After looking at mocking in general, Roy presented how Typemock Isolator can help getting rid of dependencies. Isolator is using the .NET framework profiler API, and this makes it possible to stub out any method call at runtime. Every time a method get called, Isolator is notified and decides if the real method should get called, or if a mocked value should be returned. It makes it possible to unit test things like WPF and Silverlight. Quite impressive, actually.

3th day

“Good Test, Better Code Workshop” with Scott Bellware

This was a full-day workshop with Scott Bellware. Usually, he does this workshop with about 20 people, but this day he put a limit at 80 people. I guess there was about 100 people present when we started out by configuring our machines with the necessary tools: Visual Studio 2008, Subversion TortoiseSVN, ReSharper, TestDriven.NET and AutoHotKey.

He had created a userstory about discount rules in a salessystem, and showed how he directly converted the story into unittests, or ‘machine specifications’, and then wrote code to satisfy the specs. We used a framework called Machine.Specifications, or mSpec, witch has its origin in Rubys rSpecs and Bellwares own SpecUnit. The goal of this framework, is to make the code as readable as possible.

With the help from named delegates and anonymous functions, a specification like this:

[Description]
public class Transferring_between_from_account_and_to_account
{
  static Account fromAccount;
  static Account toAccount;

  Context before_each =()=>
  {
    fromAccount = new Account {Balance = 1m};
    toAccount = new Account {Balance = 1m};
  };

  When the_transfer_is_made =()=>
  {
    fromAccount.Transfer(1m, toAccount);
  };

  It should_debit_the_from_account_by_the_amount_transferred =()=>
  {
    fromAccount.Balance.ShouldEqual(0m);
  };

  It should_credit_the_to_account_by_the_amount_transferred =()=>
  {
    toAccount.Balance.ShouldEqual(2m);
  };
}

turns into this report when run:

------ Test started: Assembly: Machine.Specifications.Example.dll ------

Transferring between from account and to account
  When the transfer is made
    * It should debit the from account by the amount transferred
    * It should credit the to account by the amount transferred

It clearly shows that code can be readable, doesn’t it?

So that sums up my experiences from ndc09. It really was a exiting and inspiring experience, and I’m looking forward to next years happening.

comments powered by Disqus