DevDisasters

Developer Fail: Epoch Billing System

Everybody in the IT department was quite happy -- even a little surprised -- with how well the outsourced project to replace the legacy billing system was progressing.

Well, actually, the project managers weren't all that surprised. Over the past four months, they'd pumped out reams of specs and design documents, often boasting that their level of planning hadn't been seen since the Apollo missions. So, for them, the fact that everything was turning out as designed spoke volumes about the success of their planning and processes.

New Billing Code
Jeff and the other developers who were stuck supporting the existing billing system until the big cutover (still a few months away) wanted to see what this super system looked like under the hood. After all, because they were expected to support the new system once it came online, shouldn't they at least have an understanding of how the underlying code worked?

The developers made their case for months before the project managers gave up on their "it's not done yet" rhetoric and reluctantly handed over a few modules that they'd deemed bug-free.

When Jeff got his hands on the code, one line in particular caught his eye:

```int strElapsedDays = (convertDate(intDay1,
intMonth1, intYr1) - convertDate(intDay2,
intMonth2, intYr2)) / DAY;
```

Unusual Process
Knowing that C# had built-in functions to easily determine the span of days between two dates, Jeff thought the approach was a little strange. Once he tracked down convertDate, things got even weirder:

```public const int DAY = 86400;
public const int WEEK = 604800;
public const int YEAR = 31449600;

private static int convertDate
(int day, int month, int year)
{

int[] months = new int[] {0,31,59,90,120,151,
181,212,243,273,304,334};

return (((year - 1970) * DAY * 365) + (((year
- 1970)/4) * DAY) + (months[month - 1]
* DAY) + ((day-1) * DAY));
}```

Caught off guard, Jeff just stared at the function for a good 10 minutes, trying to figure it out. When he did, it hit him like a ton of bricks. Rather than using the built-in C# date functions, the developer had opted to convert a date into its Unix Epoch -- the number of seconds elapsed since Jan. 1, 1970 -- and work from there.

Jeff had to admit, the solution was a little bit genius. Unfortunately, it wasn't a fit because the new system was running on a Windows server. So Jeff did his duty and raised the matter with the project management team so it could be added to the bug-fix queue for the offshore team.

Weeks later, Jeff followed up with one of the members of the project management team, just out of curiosity, to see if the fix had been made. To his surprise, it hadn't been addressed -- nor would it be any time soon. Apparently the "bug" was downgraded to a feature request because -- in the eyes of the project managers -- if an application functioned as it was designed, there wasn't a need to go back in and change it.

Mark Bowytz is a contributor to the popular Web site The Daily WTF. He has more than a decade of IT experience and is currently a systems analyst for PPG Industries.

• Death of the Dev Machine?

Here's a takeaway from this week's Ignite 2020 event: An advanced Azure cloud portends the death of the traditional, high-powered dev machine packed with computing, memory and storage components.

• COVID-19 Is Ignite 2020's Elephant in the Room: 'Frankly, It Sucks'

As in all things of our new reality, there was no escaping the drastic changes in routine caused by the COVID-19 pandemic during Microsoft's big Ignite 2020 developer/IT pro conference, this week shifted to an online-only event after drawing tens of thousands of in-person attendees in years past.

• Visual Studio 2019 v16.8 Preview Update Adds Codespaces

To coincide with the Microsoft Ignite 2020 IT pro/developer event, the Visual Studio dev team shipped a new update, Visual Studio 2019 v16.8 Preview 3.1, with the main attraction being support for cloud-hosted Codespaces, now in a limited beta.

• New for Blazor: Azure Static Web Apps Support

With Blazor taking the .NET web development world by storm, one of the first announcements during Microsoft's Ignite 2020 developer/IT event was its new support in Azure Static Web Apps.

• Entity Framework Core 5 RC1 Is Feature Complete, Ready for Production

The first release candidate for Entity Framework 5 -- Microsoft's object-database mapper for .NET -- has shipped with a go live license, ready for production.

Upcoming Events