Monday, May 18, 2009

Try to do this without LINQ

Today, me and my colleague Cor have been busy pair-programming for most of the day. While doing that we tried to build a dictionary which value is an enumerable collection. I think we found a great example of the power of LINQ that I think is worth sharing.

Consider the class diagram below. ExamSeries represents a examination series consisting of one or more questions. Each series has a language-specific part represented by SeriesDetail. Our goal was to be able to apply a Specification object to a collection of ExamSeries and receive a dictionary of all series matching that specification, including the specific languages. So our intention was to get a IDictionary<ExamSeries, IEnumerable<Language>>.

image

We started hand-writing multiple foreach loops and managed to get what we wanted, but somehow, I got this annoying feeling in the back of my head that this should be easier. After a lot of experimenting, we found the following rather nice example of using LINQ.

image

Not bad eh?

I’ll be speaking at the Microsoft Developer Days 2009

Thanks to the many votes we received on our wildcard proposals from attendees, colleagues and community members, me, Pieter Joost van de Sande and Dennis van de Stelt have won a timeslot on next week’s Microsoft Developer Days. I’ll be talking about Test Driven Development and SOLID on Thursday May 28th at 15:00 in the conference room named Central America.

Many attempts have been made to improve the overall quality of our software development efforts, but if there's one I'd like to put some attention on, it's Test Driven Development. It's design-first, test-first approach has proved significant increases in overall quality. However, TDD is not easy and requires quite some understanding of proper object oriented design. S.O.L.I.D. is one of the better known acronyms referring to a set of very important design principles that both improve your ability to do TDD, but also make sure that your software is highly testable and maintainable.

Stuff I’ll be covering:

  • What is quality?
  • Demonstrating Test Driven Development with a hands-on demo
  • The S.O.L.I.D. principles
  • Phases of unit testing
  • Examples illustrating the advantages of S.O.L.I.D.
  • Guidelines for getting started

Prerequisites: You should be able to understand C# 3.0 and Lambda expressions, and feel at home amongst the principles of OO such as encapsulation, inheritance and polymorphism.

In the mean time, if you like to follow me on my daily activities until the DevDays, my Twitter account is http://twitter.com/dennisdoomen

Thursday, May 07, 2009

About Programmer Lifestyle Dilemmas

image

Yesterday, I attended the second Devnology meeting in Utrecht and I had a really fun evening. Devnology is an initiative started by Pieter Joost van de Sande and Freek Leemhuis and focuses on sharing experiences, insights and knowledge between members of the entire developer community. That means that you'll see not only .NET and Java developers, but also developers using C++, Ruby on Rails, SmallTalk and even functional programming. It felt very refreshing to hear about all those other platforms I simply don't have the time for.

This session was held in one of the very attractive rooms offered by Seats2Meet in Utrecht and focused on the typical dilemmas a programmer has to face in his daily duties. As a kind of preparation we were asked to answer a list of questions related to our habits, interests and so on. I thought it would be nice to share my answers and also mention the things I heard from the others and will read or investigate.

Q: Do you prefer to work as an independent consultant or be on someone’s payroll?
I have always liked to work for a company, either big or small, as long as they can offer enough interesting opportunities. I don't like to find my own customers (at least, not initially) or spend time on administrative tasks. Moreover, working in a company offers my changes for sharing knowledge, experiences and enthusiasm.

Q: Do you prefer to work in pairs or alone?
I definitely stimulate Pair Programming within my teams since I've seen it cause an improvement in the overall level of technical and domain knowledge. But I myself don't always do it, mostly, because I typically have a lot of team leading tasks. The primary reason for me to sit next to another developer is to improve the usage of coding guideline, design principles and other best practices. Obviously, when trying to figure out a complex technical challenge, Pair Programming really excels.

Q: Do you prefer to work in the office or at home?
I prefer to work at the office since it is more fun, and allows me to have interesting discussions with other colleagues.

Q: Can you live with a waterfall methodology or do you insist on Agile?
I have lost faith in a traditional waterfall approach, and strongly believe in many of the aspects of typical Agile methodologies. I'm currently looking into using (elements of) SCRUM for my projects.

Q: Do you try to keep up with all the latest developments, or focus on concepts?
I always try to stay in shape by reading blogs, books and by having discussions with other members of the community. However, I'm starting to become aware of the fact that I can't keep up that pace for a very long time. As a matter of fact, I'm already pushing some of the newer technologies that are not yet necessary for my current tasks aside as long as possible.

Q: Specializing or generalizing
I focus my attention on the stuff that helps me the most at my current job, but I do have a particular interest in Test Driven Development, design and architecture. However, I always keep an overview of all the products and technologies the Microsoft platforms offers. So, I'm both :-)

Q: What are your three favorite blogs?

Q: What are your three favorite Podcasts?
I've never done that, but looking at the popularity of these during this meeting, I'm going to look into them.

Q: Name three books that had a lot of impact

  1. Applying Domain Driven Design and Patterns - Jimmy Nillson
  2. Domain Driven Design: Tackling Complexity in the Heart of Software - Eric Evans
  3. Scrum and XP from the Trenches - Henrik Kniberg

Q: What tools do you use to find knowledge?
I primarily use Google Reader to stay up to date with a whole bunch of blogs. I don't understand why Microsoft's Live site does not provide something like this.

Q: What events do you visit regularly?
PDC or Teched, Microsoft Developer Days, Software Developer Event / Conference, CodeCamp, DotNed, Devnology, OpenSpace

Q: What are you going to read or investigate as a result of this second Devnology meeting?