Brendan Enrick

Daily Software Development

Flags Over Objects

If you didn’t notice it, our “flag” month was the same month as Independence Day in the United States. We celebrate that day with flags, fireworks, and a lot of cookouts. Notice anything in the picture? Yep. We’re missing the fireworks. Anyway, the topic of Flags Over Objects is an important one.

Flags Over Objects is the Software Craftsmanship Calendar’s anti-pattern topic in July 2014. As a developer, I am sure that you’ve come across code where boolean values (flags) were used far too much. This is often a misuse of state. Plenty of times there is a better, simpler way of handling the state of objects.

Flags_Over_Objects_July_2014

In this image, you might notice (looking carefully) a few obvious (and common) issues with using flags. First, you’ve got a whole list of checkboxes even though some of those can only ever be one at a time. You might also notice that there are a lot of repeats of the same checkbox.

Are you using this anti-pattern anywhere?

Loading
Brendan Enrick | .NET 3.5 is Open Source

Brendan Enrick

Daily Software Development

.NET 3.5 is Open Source

Some very surprising news has come from Scott Guthrie in a recent blog post he has made. Visual Studio 2008 and .NET 3.5 will be shipping with the source for the base class libraries. As with a lot of the recent technology coming from Microsoft, the source code is open and not hidden away.

In the past, tools like Reflector have allowed developers to see what is going on within those libraries. These tools will no longer be as necessary. This source code is being released under the Microsoft Reference License (MS-RL). It seems Microsoft has started a new trend for itself in releasing its source code.

Debugging will now become much much easier with this code being open source. In the past developers have not been able to step into any of the base class libraries. Now that the source is open for everyone to see, people are able to go in and step through this code. This should make debugging much easier and better.

I think this is great that Microsoft is releasing more source code to the general public.

Happy coding.

Loading