-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0


CodeSOD: Hitting Your Skill Ceiling

Среда, 07 Ноября 2018 г. 14:30 + в цитатник

Clia was handed a pile of legacy code and told to upgrade it, but with a very important rule attached: the functionality couldn't change. Any change could break someone's workflow, and thus in the upgraded system, even the bugs had to be reproduced.

Unlike most "legacy" code, this wasn't all that old- it was written in C#. Then again, C# is old enough to drive, so maybe it is old. Regardless, C# has utility methods, like, say, a ceil function. At no point in C#'s history has it lacked this basic functionality.

That, of course, doesn't stop people from reimplementing it badly.


nToken = (nArea / 12).ToString(12).Tokenize("", ",", sToken);
nValue = sToken[0].ToNumber();
nDezimals = ("0," + sToken[1]).ToNumber();
if (nDezimals > 0.0001m){
nValue = nValue + 1;
}

Note, this isn't a function. This representative snippet is the pattern that was copy/pasted, with modification, anywhere someone needed the ceiling of a value. Clia dutifully replicated its behavior, unchanged.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.

https://thedailywtf.com/articles/hitting-your-skill-ceiling

Метки:  

 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку