February, 2009 Archives

18
Feb

The tip tip tappeti tap

by Mikael Lundin in Programming, Technicalities

Now when I got your attention, I will tell you about the tip-tip-tappeti-tap.

Women’s shoes are the bane of coding. Every time I hear the [tap] [tap] [tip] [tip] [tappeti] [tap] [tap]* my brain cease to function and I find my mind in a complete limbo. Most often I don’t even notice until the sound stops and I get awaken from my mental coma.

I talked to my office neighbour about it and he seems to have the same problem. We should take action and give away slippers to these high heeled ladies. I wonder how they will interpretate that!? Maybe that “short nerds get nervous of high heels”.

This morning I made huge progress in Mint when I decided to not use the existing XForms format, and instead roll my own. The decision was well thought through, and here are my arguments.

  • XForms is a hard standard to implement in my application and the implementation will feel too hard for its purpose.
  • There are only a few applications supporting XForms. This means that I’m not breaking conventions for not implementing it, opposite to rolling your own data format because you don’t like XML.
  • My application domain will now be easier to change, read and modify. It will also be much easier to write an XML Schema for validation.
  • You ain’t gonna need it, keep it simple stupid

So, I remade 5 hours of work, in only 30 minutes with my new format. Yay me!

17
Feb

Coding as a lifestyle

by Mikael Lundin in Programming

For me, coding is a lifestyle. I think about it in the morning when I wake up, and I code on the train going to work. I spend the whole day working with code, and when I get home, I think about the code. When I go to sleep I dream and solve those problems I couldn’t find a solution for during the day.

Code is my hobby, my call and my greatest of interest. I am proud to be a coder and I take much pride in my work. I want to tend my code like a garden or carefully work it like a carpenter. Unpredictable code is like sheep you have to herd and really fanatic code will haunt your dreams.

When you read some code you can almost taste it. Most of the time it tastes like a color. Sometimes it tastes like a fruit. It’s mostly like reading a good novel and imagine that you’re there, in Paris hunted by detective Bezu Fache.

You can read peoples personalities in the code they write. Just as you read personalities on how people move, talk or behave you may read their personalities in the code.

Today I’ve visited three code bases. The first one was a can of plain soup. Nothing ordinary about it. The second was more like an unpredictable fish bowl. The last one felt safe and green with a taint of blue.

There are still much work to do before tomorrow comes.

16
Feb

CruiseControl with NAnt

by Mikael Lundin in Programming

I thought my latest post was on the more creative criticism verge, but proved to be more of a brain fart. My apologies to those that find themselves offended. At least it seemed to get some balls running and we’re bringing in quality for open discussion again.

CruiseControl.NET is a great way of dealing with continuous integration. It is a server software that will build your source to make sure that it doesn’t fail to build. This is a great thing! It will actually make sure that the code you check into your repository is a complete system and not a broken copy.

To make this possible you add your project to a file called ccnet.config on the server. This file contains the most important aspects of your project

  • Where to find it (subversion url)
  • How to build it
  • Who to contact when it fails (e-mail)

The location of the project and the contact if the build fails is something that is quite static and won’t change very often. How to build the project is quite the opposite a thing that needs to evolve with the project itself. That is why you check this part in as a NAnt script into your version control.

NAnt

NAnt is a build script engine where you specify “how to build a project” in an XML format that is easy to read and easy to manage. By using this you will give the power of setting up the build to the developer that knows best how it is to be done. This is important, so you don’t have to enter CruiseControl server configuration every time you need to change your build.

If you write a NAnt script you also document how this project should be built which is much more important than having “Open Visual Studio and press F5″ as your build process.

Now both you and the build server knows how to build the project and you can sleep easily without any worries about half made solutions checked into the repository.

Extensibility

When you have your build server setup you can extend the functionality that you run on your code. Once the code is checked out on your build server you may get additional benefits like

  • Mark successful builds with a tag in your repository
  • Having CruiseControl to validate your unit tests
  • Keep track of unit test coverage with NCover
  • Run static analysis on the code like FxCop or StyleCop
  • Do heavy analysis on the code with NDepend
  • Create nightly builds as zip-files on an UNC share
  • Deploy the application to a acceptance test environment

Pick all or pick none. It is up to you. Most important is that we tend the code in our garden to make it sweet and easily managed.

10
Feb

[*Star]Cop at your service

by Mikael Lundin in Programming

Have you ever run a tool like StyleCop or FxCop on your source code and gotten something like this?
Stylecop 1000 errors
You are not alone my friend. What good will it do when the result is so overwhelming that you would never consider to sit down and do anything about it. The funny thing about just StyleCop is that it stops looking for rule breaking after about 1000 warnings, because it knows that you will give up.

That means, if you fix 100 of these you still have 1000 more to go.

The point of a static analysis tool is not that you will fix every error the tool might find, but that it will help you to consider what kind of rules you find important. If you don’t care about the ordering of using directives, you may choose to turn of that validation. Then you have made a decision of what does not matter to you.

The most important feature is not massive amount of validation rules, but the ability to make you choose, what validation rule you find important to enforce.

If you combine the static analysis like FxCop and StyleCop with contineous integration, you might enforce a certain quality of coding on a whole team. You start slow by enforcing the most basic of programming rules and later on you might tighten it up when the developers learn to fix the big mistakes.

Most of these tools let you write your own custom validation rules, which could prove very useful.

Last but not least is the NDepend which is the tool of tools for code analysis. This will let you track down cyclomatic complexities, setup watchers for different queries you apply on the code base like “no public method should reference DbHandler directly”. This costs a small amount for any IT company and you should not hesitate to support this project now.

7
Feb

Windows Home Server

by Mikael Lundin in Uncategorized

Fujitsu-Siemens 2205-WHSSo I finally got around and bought me a Fujitsu-Siemens Scaleo Home Server 2205. It was delivered with 2x 1TB disks and since then I’ve plugged in another 500 GB for storage and 750 GB for backups. I’ve become a bit paranoid since my Lacie Big Disk failed on me.

The server looks pretty much like a suitcase and it runs real quiet. Not quiet enough for having under your desk, but sometimes when I open my closet, I wonder if it’s still running.

Installation was pretty much a 1 click install that took under an hour, and it was very easy to get started with the server. Mounting a new drive took about 5 minutes and there were no need for a screwdriver. Even though I thought the price tag a bit high, I am a very pleased customer.

What will I use my home server for?

  • Daily backups – My laptop is getting old and I don’t expect it to survive the daily travels for long. When the hard drive fails, I want to be able to replace it and just keep it running until it is time to buy a new laptop.
  • Centralized storage – It is so easy just filling your computer with junk. Now I have a centralized storage facility where I can dump all the extra stuff and free some space on my working machine.
  • Source repository – I’ve needed a backed up repository for my source for a long time. Local file system based repository just doesn’t cut it anymore. I need the safety of backups.
  • Continuous integration – I will install CC.NET on the server to make sure that all of my source in the repository compiles and that my tests runs green.
  • Acceptance testing – I will use my server to test out Mint, just to fix “works on my machine” related bugs. Hopefully I will be able to automate deployment directly from CC.NET. We’ll see how that plays out.

What would you use a home server for?