A. Dev had just inherited a C# project to finish and maintain. The application was so infested with WTFs that the stench overpowered any working code. The story behind the application was very simple: the customer originally let the CTO's nephew develop the application as a consultant. The nephew then disappeared and upper management got worried. The CTO told management that his plan was to outsource the rest of the development of the application in order to ensure good-quality code.

Once A. Dev discovered blocks like the following, he realized that they had been not assigned with "completing the development of the application" but rather a full rewrite:

public static bool isDaylightSavingTime() {
  DateTime dd = DateTime.Now;
  if (dd <= new DateTime(2012, 10, 27, 23, 59, 59) || dd >= new DateTime(2013, 03, 30, 23, 59, 59)) {
     return true;
  } else {
     return false;
  }
}

Forgetting that:

dd >= new DateTime(2013, 03, 30, 23, 59, 59)

... should probably have been:

dd >= new DateTime(2013, 03, 31, 00, 00, 00)

... one might also consider that DST in other time ranges beyond Winter-2012-2013, as well as other time zones might also need to be handled.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!