Войти в систему

Home
    - Создать дневник
    - Написать в дневник
       - Подробный режим

LJ.Rossia.org
    - Новости сайта
    - Общие настройки
    - Sitemap
    - Оплата
    - ljr-fif

Редактировать...
    - Настройки
    - Список друзей
    - Дневник
    - Картинки
    - Пароль
    - Вид дневника

Сообщества

Настроить S2

Помощь
    - Забыли пароль?
    - FAQ
    - Тех. поддержка



Пишет The Daily WTF ([info]syn_thedailywtf)
@ 2024-12-19 06:30:00


Previous Entry  Add to memories!  Tell a Friend!  Next Entry
CodeSOD: Zero Competence

Michael had a co-worker who was new to the team. As such, there was definitely an expected ramp-up time. But this new developer got that ramp up time, and still wasn't performing. Worse, they ended up dragging down the entire team, as they'd go off, write a bunch of code, end up in a situation that they couldn't understand why nothing was working, and then beg for help.

For example, this dev was tasked with adding timestamps to a set of logging messages. The logs had started as simple "print" debugging messages, but had grown in complexity and it was time to treat them like real logging.

This stumped them, as the following C# code only ever printed out a zero:

DateTime d = new DateTime();
int timestamp = d.Minute + d.Second + d.Millisecond;
Console.WriteLine(timestamp + message);

On one hand, this is a clear example of not understanding operator overloading- clearly, they understood that + could be used for string concatenation, but they seem to have forgotten that it could also be used for arithmetic.

I don't think this actually only ever printed out a zero. It certainly didn't print out a timestamp, but it also didn't print out a zero. So not only is the code bad, but the understanding of how it's bad is also bad. It's bad. Bad. Bad.

[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.


(Читать комментарии) (Добавить комментарий)