A lot of ideas look really good on paper but end up working really bad in reality. It takes a really special idea to look really bad on paper and actually turn out to work really good -- and today is just not a special enough day to feature one of those ideas. Instead, we'll get to see what usually happens when a really bad idea is implemented.

The story is cliché by now -- highly-paid consultants come in, build a system, bill well over their estimate, and leave a half-working mess for the employees to clean up. One of the more interesting bad ideas the consultants had was to use only integers to store all non-textual data. The "Dollars" column, despite it's name, really stored pennies and the "Sale Date" column really stored the year number multiplied by 10,000 plus the month number multiplied by 100 plus the day number (e.g. today would be 20,060,426). This, as you might imagine, leads to incredibly obnoxious code required for nearly every operation, such as the addition of a fifteen percent fee on a "dollar" amount ...

ALTER FUNCTION [calculate_15pct_fee] (@amount AS INT) RETURNS INT
AS BEGIN
  DECLARE @retvalue AS INT

  IF CAST(@amount AS FLOAT) * (1 + CAST(15 AS FLOAT)/100) > 
     CAST(CAST(@amount AS FLOAT) * (1 + CAST(15 AS FLOAT)/100) AS INT)
    SET @retvalue = CAST(CAST(@amount AS FLOAT) * (1 + CAST(15 AS FLOAT)/100) AS INT) + 1
  ELSE 
    SET @retvalue = CAST(CAST(@amount AS FLOAT) * (1 + CAST(15 AS FLOAT)/100) AS INT)

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