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

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

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

 

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

 -Статистика

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


Coded Smorgasbord: What You Don't See

Вторник, 06 Сентября 2016 г. 14:30 + в цитатник

Many times, when we get a submission of bad code, were left wondering, what else is going on here? Sometimes, you think, if only I knew more, this would make sense. More often, you think, if I knew more, Id be depressed, because the code is so clearly bad.

For example, Devan inherited a report, built using SQL Servers Reporting Services Report Builder tool. Now, this tool is not intended as much as a developer tool, as a if you can use Excel, you can make a report! It uses Excel-style functions for everything, which means if you want to have branching conditional logic, you need to use the IIF function.

Just dont use it like this.

IIf(Location_Id='01111','Location 1',
  ......
IIf(Location_Id='99999','Location Help Me','This was the Easy one')))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) )))))))))) ))))))))

Now, theres a lot missing here, but we can infer what was skipped, simply by counting the brackets. Even LISP would be embarrassed by those parentheses.

In a different example, Phillip E. was reviewing the days check-ins, when he noticed this particular bit of VB.NET code:

Public Class UserSession
  Inherits UserSession(Of UserSession)
...
End Class

Honestly, Im not 100% sure if this is a problem with the code, or the fact that the language lets you abuse names so badly. Then again, the Of UserSession is a type parameter, so I think we can still blame the developer who wrote this.

Angela A wants us to know that misleadingly named constants to replace magic numbers will always be a thing.

const float ZERO = 0.01f;

Taking all of these examples together, Jack S provides a perfect summary of how I feel about this code, this fragment coming from Classic ASP.

function die(s)
[Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!

http://thedailywtf.com/articles/what-you-don-t-see

Метки:  

 

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

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

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

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