Blogging when you’re angry is a great way to get things off your chest. The writing flows and you don’t have to think too hard about what you’re going to say. Today I had one of those moments where I got a little annoyed, hence this post which I thought was also a good opportunity to use the title of the Frankie Goes To Hollywood song from the 80s as it accurately describes the way I felt as I was getting ready to leave work. It also amused my colleagues. As they laughed at my rage which to be fair for me is showing a level of interest just above indifference, they said “You can write about it on your blog, ha ha!” so I am doing. And now I’m going to explain why it wound me up.
Can you get angry about something as simple as a data type? Well, I can. Sad I know but nevertheless I did. I’m still relatively new to the place where I work and still discovering the hidden “gems” buried within. The whole of the business revolves around a CRM system built by, so I’m told, a billion dollar company about 2 years ago that heavily
basterdised customised it for us. It has quite a few issues and one of them bit me today.
There’s a project underway to integrate a new customer into this system, and the aforementioned billion dollar company has some work to do including delivering two new tables that I need to read data from, create some messages and put them on a queue which will then be delivered some time later by a web service, something I’m in the middle of writing about as the way we are using NServiceBus. Today I got the scripts for the tables and on one of these tables is a column called IsComplete. From the name, I’m sure you won’t be shocked to learn that it will hold the value true or false. Or so you’d think. As the database is SQL Server my immediate thought is that this column’s data type is Bit and will hold 0 or 1. From a .Net point of view this is nice as it will map to a C# bool. But no, it’s actually a smallint and it causes the awesome Micro-ORM that I’m using (Dapper) to blow up because my DTO has an IsComplete property which any right-minded C# dev would declare as a bool.
The stupid thing is that the billion dollar company won’t change their end because it will deviate from their “standard”. And their standard is to use -1 for true! Oh except for one other place where zero is true. Go figure.
What’s the big deal, you say? Why not just change the IsComplete property on the DTO to be an Int16? Well, if I can’t get them to change it then I won’t have a choice but that’s not really the issue. The crux of the problem is that we have multiple applications built around this database and that rediculous design decision has leaked into every one of them meaning every current and future developer now and forever has to know about it and work around it. It’s an unnecessary burden and one more piece of accidental complexity that adds to the rot and entropy of software.
Yeah, I’ll get over it but people should realise the costs associated with such poor decisions. In my opinion, we shouldn’t have to build our software to match the so-called “standards” of others. It’s also one more reason why integrating at the database level (especially when you don’t own the database) is an out-dated pattern. Messaging and eventual consistency provide a much looser coupling between systems and gives us an opportunity to put some distance between our applications and the legacy software à la Anti-corruption Layer (Evans). We just need to get the (conceptual) message across to the business.
And breathe out… phew!