Thursday, November 26, 2009

Code katas

I just finished my first code kata :) I did FizzBuzz, a very easy one just to get started. I wrote the last code-bit for the last test to past in a quarter of an hour. Therefore, I continued with "stage 2" of the kata.
I wanted to make it easy to extend and got lost half the way :( There was a point where I refactored too much without unit testing. This was bad because the bigger the steps the more likely it is you have to go a step backwards.
Luckily, I got my act together and accomplished my plan. The rest was fine and all tests passed.
On a second try, my goal is to don't use the debugger anymore (I needed it twice) and take baby steps.

Wednesday, November 18, 2009

PDC 2009

It's PDC again! Yesterday, I watched the opening-keynote. They spoke about the cloud and the new Visual Studio and how they can interact. A database store, codename Dallas, was shown which tries to unite data from all over the world - surely nice to play around with.
About half the time, when talking about the cloud, they showed this list:

1970s: Mainframe
1980s: Client-Server
1990s: Web
2000s: SOA
2010+: Cloud

We're just working on to get to the 90s, great...

One new feature of VS2010 is intelliTrace, which is a history of the program running via the debugger. I hope we switch to VS2010 soon, because that sounds interesting.

Last year, a lot of sessions were recorded and put online. I hope they'll do it this year alike. Nevertheless, don't forget to watch the second keynote today (17:30 CET) at the website with Scott Guthrie.

--------------------------------------------------------------------

The second keynote was great! Silverlight 4 beta available now! With trusted mode!! File system access!!! *download*

Monday, November 16, 2009

Test-Driving

The plan is to do a 2-week-bootcamp right before christmas to learn / get experience with test driven development (TDD). I already tried to practice it and I must say that it's hard. Though writing tests before you implement feels natural (I somewhere read "developing without testing is like driving a car without fastening your seatbelt"), it is so much contradictory to what I'm used to develop (test last development; if tests at all). Because of that I looked for some help in books.

From the first one I only read two chapters online: Test Driven: Practical TDD and Acceptance TDD for Java Developers by Lasse Koskela. You can find the chapters here. As I'm a .NET-developer, a Java-book is not worth purchasing, I think. However, I mention this book because these two chapters are really good. The first one is about beginning TDD. This is the usual stuff about red, green, refactor by example. The second chapter is the one that enlightend me. It talks about how to integrate the testing in the development-process (eXtreme Programming, that is) with acceptance TDD. The following picture is from Lasse's book and opened my eyes. Never before was the test-integration so clear to me. This is the only way how a developer will write good tests: write an acceptance test and make it green via several unit test driven development-cycles.
The other chapters sound interesting - maybe I'll find this book in a library.

Test-Driven Development in Microsoft .NET by James W. Newkirk and Alexei A. Vorontsov is the other book I recently read. I got this book from my good friend Uwe (*winkeWinke*). This book has a foreword by Kent Beck - so this has to be good, I thought. But actually: it isn't :( The first three chapters are OK - the standard-introduction section. Then, the book tries to write a whole example-application with TDD. I must admit, this is courageous - but it fails. I don't think that someone will work through all this code in order to understand how to test a database, a web-service, a web-client, etc. At the end, all tests are more or less the same. I think it is more helpful to learn TDD with your own little project than with this book. By the way, the technology used (ADO.NET instead of Entitiy Framework, ASP.NET Web Service instead of WCF, ASP.NET instead of Silverlight!?) is old...

Tuesday, November 3, 2009

2 agile books and one IOException

I just finished 2 books about agile development: User Stories Applied by Mike Cohn and Scrum and XP from the trenches by Henrik Kniberg.



Mike Cohn covers all about user stories. As we're just beginning Scrum with a new project, we will be doing a story writing workshop with some business people. So, User Stories Applied is probably the right book for that.
After not much blabla and good tips, page 49 describes what to do in such a workshop. He suggests to find the top epic stories and break each down. Page 182pp shows the place of a workshop within the path to begin programming:

1) Perform user role modeling
2) Trawl for high-level user stories <-- Start workshop
3) Prioritize stories
4) Refine high- and medium-priority stories
5) Organize stories into groups
6) Create a paper prototype <-- great if we'll reach that in the workshop
7) Refine the prototype
8) Start programming

I think the hardest thing is to gather the top 25 epics. This will be difficult with people discussing each and every detail don't focusing at the higher level. But as this will be the first workshop, we can still learn if things go astray :)

Here's a passage I liked (about 'why user stories'):
"Humans used to have such a marvelous oral tradition; myths and history were passed orally from one generation to the next. Until an Athenian ruler started writing down Homer's The Iliad so that it would not be forgotten, stories like Homer's were told, not read. Our memories must have been a lot better back then and must have started to fade sometime in the 1970s because by then we could no longer remember even short statements like "The system shall prompt the user for a login name and password." So, we started writing them down." (cf. IEEE 830)

So, good book, nice to read and great for looking up user-story-things.



The second book I finished is Scrum and XP from the trenches which is a war story on doing scrum. Lots of hands-ons and lessons-learned stuff. Some parts are interesting like how to handle multiple scrum teams but the most part I heard or read already. If you're new to scrum and agile methods, this is amusing to read (like how to negotiate with the PO). If not, you can scroll over it (as I read it as a free eBook).

And now for the IOException. I made some debug-sessions lately and now and then I came across an IOException just reading "the file exists" when calling GetTempFileName. I loaded old, already released code and even with this *cough* high-quality-code the exception will be thrown. Luckily I found this blog-post dealing with the same problem. Just delete some temp-files (approx. 100,000) and everything works fine now :)