Viking Law #1

Today, while reading this old post from Emil Gustafsson about the Viking Laws and how they can be projected into the software development context, I just can’t stop thinking that his first law interpretation is missing one of the most important, if not not the most important, commandment.

Law #1 is all about bravery and aggressiveness, and according to Emil it can be projected into software development as:

  • Be direct
  • Grab all opportunities
  • Use varying methods of attack
  • Be versatile and agile
  • Attack one target at a time
  • Don’t plan everything in detail
  • Use top quality weapons

I totally agree with all these commandments but one is missing and I think it should be the first:

  • Choose your targets wisely

Never attack a target when you know you’re not enough skilled to win. Sometimes the greatest bravery you can show is to recognize you’re not ready.

Enum types, FlagsAttribute & Zero value – Part 2

In my previous post I wrote about why you should pay attention when using enum value Zero.
After reading that post you are probably thinking like Benjamin Roux: Why don’t you start the enum values at 0x1?
Well I could, but doing that I lose the ability to have Sync and Async mutually exclusive by design. Take a look at the following enum types:

[Flags]
public enum OperationMode1
{
    Async = 0x1,
    Sync = 0x2,
    Parent = 0x4
}

[Flags]
public enum OperationMode2
{
    Async = 0x0,
    Sync = 0x1,
    Parent = 0x2
}

read more