Is TDD Dead?

I have been watching the Google Hangout’s debate between Martin Fowler, Kent Beck and David Heinemeier Hansson concerning Test Driven Development and why we do it? The debate is titled ‘Is TDD Dead?’ a rather emotive title, guaranteed to grab attention! It worked with me. I’ve been using TDD for a number of years now and I must admit I’d rather use it than not. For me un-tested code is potentially full of bugs and very prone to becoming bloated and ‘smelly’. A good test harness helps prevent this, and it should also aid in understanding and documenting the code.

In the debate David HH takes the anti-TDD stance, not because he’s against testing code but he’s arguing against the ‘cargo cult’ that seems to have grown up around TDD. There is a danger with TDD in taking it too far. One of the comments many people make when first using TDD is that the code ends up in lots of little classes, so instead of searching throughout a large file for the relevant piece of code you end up searching through lots of files. 

In the debates the person I’ve enjoyed listening to and the one I’ve admired the most is Kent Beck. He argues from a pragmatic, common-sense point of view. One thing I particularly liked was his emphasis on design. Kent Beck uses TDD to give him confidence in the code but he doesn’t use it to force a design on the code. I think that might be the crux of David HH’s argument.

Anyway tonight I’m going to attend a talk about ‘Is TDD dead?’ at XP Manchester. It will be interesting to know what others think.

Advertisements

TeamCity cannot start

We use TeamCity at work as our Continuous Integration server. It’s a very useful tool. This morning it wasn’t running because of a sys admin change. Most of our servers are virtual machines and the change was to do with configuring the SCSI. I’m not quite certain why the change was made but it involved a re-start to the servers.

Now, as far as I’m concerned a re-start to the server shouldn’t have caused problems but of course sometimes it does. One of the reasons why is that settings are altered every so often and re-starting a server causes some of these changes to be re-set or for default settings to start.

I access TeamCity via a URL and when I found I couldn’t my first thoughts were that the service wasn’t running on the server. I logged onto the server but the services were running. Checking the log files for TeamCity told me that ‘something’ was using port 80, which TeamCity needed to use. I also checked the firewalls just in case any of the them had reset and were now blocking access. TeamCity accesses a remote database.

The steps we took at work to solve this were as follows.

  1. We read the logs this told us that it TeamCity could not use port 80.
  2. We looked at Task Manager, then Resource Monitor (the server is Windows 2008 R2) where we could see that ‘something’ with process ID 4 was using port 80.
  3. We downloaded ProcessExplorer to find that it was the ‘NT Kernel & System’ that was using port 80, although we could have used Task Manager to tell us this, we just needed to altered the view to show process ids.
  4. We then read this really good article about “NT Kernel & System using Port 80” this told us that we needed to disable the Web Deployment Agent Service. This was the culprit using port 80.

Note, I say we since Richard at work helped me a lot to solve this. I’m a touch disappointed with myself since I guessed what had happened, the server restart had caused something to reset but I hadn’t found what had done it. I sometimes have a blinked approach where I stare at one thing wondering why I can’t find what is wrong. What is often needed is to step back and look again with fresh eyes.

All this is experience though and I’m writing it down so I’ve got something to refer back to. Hope this helps someone else too.

This is the article that Luke Browning wrote that helped me.

NT Kernel & System using Port 80
I had been trying to set up Internet Information Services (IIS) under Windows 7 to use PHP and MySQL to save myself the trouble of having both IIS and XAMPP installed. After a short time I managed to get it running rather easily using the Web Platform Installer. This was great apart from a couple of small annoyances when developing PHP applications. After a few weeks of use, I decided it was about time to switch back to XAMPP as it removed all of the annoyances I had encountered – here, I ran into a couple of problems!

IIS Removal
I began by uninstalling IIS from the “Turn Windows features on or off” dialog in “Programs and Features”. This seemed to go fine and about a minute later I was rebooting my system.

Once my system had rebooted, I began the installation of XAMPP and got right to the end where it mentioned apache could not start. I thought this must be due to having some other peice of software bound to port 80, e.g. IIS didn’t uninstall correctly or Skype was running – neither of which were the case. I downloaded a tool called TCPView which allows me to see all of the connections from my machine and which application they originate from. I found the http protocal that was listening on the local port (being port 80) belonged to System (PID 4).

Upon looking up this process in Task Manager, I found it to be the “NT Kernel & System” which immedietly made me assume it was an incomplete removal of IIS. I tried reinstalling and removing IIS, uninstalling all of the related web tools such as the Web Platform Installer, IIS Redirects and finally rebooting the system a couple of times. None of these methods fixed the problem and Google searches were not finding any useful information.

The Solution
It appears there are a couple of different applications that can cause this same problem;

1.IIS is still running.
2.SQL Server Reporting Services is running.
3.Web Deployment Agent Service is running (this was my problem).
To fix my issue (number 3), I followed the following procedure:

1.Open up the services screen (Right click “Computer” from either your desktop or start menu, then “Manage”. Once the window has opened, expand “Services and Applications” and select “Services”).
2.On the services screen there should be one called “Web Deployment Agent Service”, if this is running, double click it and stop the service.
3.Finally, change the startup type to “Disabled”.
Now if you try to run apache on port 80, it should start fine!

Duncton Wood by William Horwood

Another book that I re-read recently was Duncton Wood by William Horwood. I seem to remember reading my Nan’s copy soon after reading Watership Down and enjoying it. Now, reading it many years later my view is somewhat changed. Not necessarily for the worse but I can find more faults in it.

The first fault is the length. It seems as though William Horwood was adding in extra things just to delay getting to the end. The Lord of the Rings is a much longer book and so is ‘The Tale of Genji’ but both of them felt more complete. Duncton Wood could have finished quite nicely after 500 pages. The principle characters in the book Rebecca and Bracken after a great deal of travelling and separation finally get to be together but their end is downright peculiar. It just doesn’t make sense to me at all.

There are though some very good points to this book, the first is William Horwood’s description, and obvious love, of the British countryside. It is no surprise that he was able to write the sequels to the Wind in the Willows. It’s a great strength and thoroughly enables the reader to be next to the characters feeling the wind in their fur, smelling the damp leaves under the trees. The other strength are the characters, they are believable and their actions by and large feel right.

Duncton Wood begins very well and the plot for the first part of the book is very good. It’s just that towards the end it all felt a bit too drawn out. In the early stages I devoured chapters eagerly but towards the end I was getting tired. Especially after Bracken and Rebecca’s end. I think the telling thing was I picked up the sequel, which pretty much picks up where Duncton Wood finishes but after the first few pages put it down. I’ve not felt any desire to pick it back up.

Would I recommend Duncton Wood? It’s hard to say. I do remember enjoying it when I was younger, and again re-reading it was good fun for the most part. There are further five books in the series so evidently many people have read them and enjoyed them. I just found the end too much.

The Foundation Trilogy by Isaac Asimov

For a number of years I’ve had books in three locations and slowly but surely I’m getting them altogether in one place. In some cases I’ve gone through my shelves sorting out those books I intend keeping and parting with those books which I know realistically I will never read again.

In my mother’s loft there are a number of boxes containing my books and recently I brought a few boxes back home, unpacked them and re-discovered the Foundation Trilogy by Isaac Asimov. Now, I’ve never read a lot of science fiction, nor for that matter a lot of fantasy, but I do remember the Foundation Trilogy and I do remember how impressed by it I was. Only the other month I recommended it to a colleague. I can imagine a few people dismissing the books because of its genre but I feel they are missing out. These are great books.

I re-read all my Isaac Asimov books, the first three and then the subsequent sequels written many years later. I must admit that whilst I enjoyed the last two: Foundation’s Edge and Foundation and Earth they cannot compare to the first three. The first three are superb stories: tight plots with great characters, the last two unfortunately are a bit too full of the sort of stuff that turn people of science fiction, a lot of arguing over minor details and a lot of techie info-dumps rescued though by a good imagination and clever thinking. Perhaps you can’t have one without the other, but if you read the first three I would argue that you can. Maybe the first three books benefited from being written as short stories for magazines and maybe the last two suffered because the author was given free rein.

 

SQL Server Enterprise Manager Gotcha

A fairly routine task today became a bit of an ordeal, made worse by remembering the symptoms but not the solution. So, I’m documenting this to try and prevent future occurrences.

All I wanted to do was set up a Foreign Key / Primary Key relationship. This should have been relatively straight-forward but wasn’t. The error message from Enterprise Manager told me that it couldn’t create the relationship but didn’t tell why.

Now, I remembered this problem happening before but for the life of me could not remember reasons for it happening. Eventually after getting other people’s views I found the reason, which is that the two columns didn’t have a relationship. I was making too many assumptions.

In future the best way to prevent this error are to follow these two steps.

1.) Make sure column names are fully descriptive. This way the links between should be obvious. See Step 2.

2.) Try and do a join between the two tables. The error I was getting was me trying to link two columns that could not be linked. It might be useful if SQL could tell me that, but it didn’t and perhaps can’t. The confusion arose from there being two IDs, and I was referring to the wrong one. Now, there should only ever be one ID but at the moment with some of my database tables, one ID points to a SharePoint List Item, and the other to a row in the database. The work I’m doing at the moment is to try and get rid of the links between SharePoint and the database so normality can resume.

 

What do you think?

Does this image say “Romance” or “Transaction”? I know what I’m thinking, and I suspect I know what he’s thinking too!

SpiritOfRomance

 

Isn’t the joy of falling in love the complete exhilaration of it all, being swept of your feet? Not leaving anything to chance, smacks a bit of being calculating and cold. Where’s the romance in a perfectly manufactured marriage? There’s also the exclusivity. I’m sticking to my own kind, not poor people or some hard-working nurse. No, sod them, I want to breed with aggressive go-getters and create lots more little CEOs just like me. After all, it will make the world a better place, or should I have said a bitter place?