Articles Tagged ‘developing with C#’...You're It.

As I was pondering a new topic to blog, I stumbled into one this morning. I was running some ideas by a few Headspringers, and they provided several options. I decided to go with a hybrid of their suggestions. What I originally planned to blog was a way to test Enumeration subclasses of the Enumeration class from Tarantino. What I ended up with was an even better way to test them. This is not an unusual happenstance at Headspring. If you talk to other Headspringers, you’re going to learn something new. It never ceases to amaze me how often I’m learning something. I like to think I’m doing some teaching, too, but I’m confident that I’m currently learning more than teaching.

In case it isn’t clear by the title, part of becoming a Headspringer is to learn from the great people you get to work with every day. So, if you’d like the opportunity to work with talented, passionate people, we are hiring!

Now let’s get to the original idea of testing the Enumeration subclasses. I will walk through my original code, then what Mr. Brandon Barry showed me, and why it’s an improvement. Read the rest of this entry »


Finding Closure

March 9th, 2012 by

When writing software, we constantly create abstractions. The goal each time is to present a simple interface in front of something more complex, hiding the gory details from us so we can focus on other things. The problem is, abstractions leak. Even when you go to great effort to create a really exellent abstraction, some unfortunate implementation detail manages to rear its ugly head. This even happens with things so fundamental that we take them for granted. Take the ‘foreach’ keyword in C#: Read the rest of this entry »


Do you find yourself writing the same methods over and over in different classes? Say your project needs both a “Dog” class and a “Cat” class — do you end up writing a “sleep” method for both? What if, in two months, the client needs you to add a “possum” to the system? Do you end up going in and retyping “sleep” instructions yet again? When you’re modeling a system with many similar parts, it takes way too much time and effort to keep duplicating code for each class. Imagine how hard it would be to maintain a large project with thousands of classes! Besides, it violates the DRY principle of good programming: Don’t Repeat Yourself! There must be a better way. Read the rest of this entry »