CodeSOD: We All Expire
Code, like anything else, ages with time. Each minor change we make to a piece of already-in-use software speeds up that process. And while a piece of software can be running for decades unchanged, its utility will still decline over time, as its user interface becomes more distant from common practices, as the requirements drift from their intent, and people forget what the original purpose of certain features even was.
Code ages, but some code is born with an expiration date.
For example, at Jose's company, each year is assigned a letter label. The reasons are obscure, and rooted in somebody's project planning process, but the year 2000 was "A". The year 2001 was "B", and so on. 2025 would be "Z", and then 2026 would roll back over to "A".
At least, that's what the requirement was. What was implemented was a bit different.
if DateTime.Today.year = 2010 then year = "K"else if DateTime.Today.year = 2011 then year = "L"else if DateTime.Today.year = 2012 then year = "M"else if DateTime.Today.year = 2013 then year = "N"else if DateTime.Today.year = 2014 then year = "O"else if DateTime.Today.year = 2015 then year = "P"else if DateTime.Today.year = 2016 then year = "Q"else if DateTime.Today.year = 2017 then year = "R"else if DateTime.Today.year = 2018 then year = "S"else if DateTime.Today.year = 2019 then year = "T"else if DateTime.Today.year = 2020 then year = "U"else if DateTime.Today.year = 2021 then year = "V"else if DateTime.Today.year = 2022 then year = "W"else if DateTime.Today.year = 2023 then year = "X"else if DateTime.Today.year = 2024 then year = "Y"else year = "Z"end if
For want of a mod, 2026 was lost. But hey, this code was clearly written in 2010, which means it will work just fine for a decade and a half. We should all be so lucky.
[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!