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

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

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

 

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

 -Статистика

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


CodeSOD: Enterprise GUID

Вторник, 07 Октября 2014 г. 14:15 + в цитатник

Jonathon recently got a new co-worker who is an enterprise systems developer, with an emphasis on enterprise. For an enterprise-level WTF, todays code is short, but it packs itself up with everything it could do wrong.

using System;

namespace Business.Common.Services
{
    /// 
    /// Guid service.
    /// 
    public class GuidService : IGuidService
    {
        /// 
        /// Initializes a new instance of the System.Guid structure.
        /// 
        /// A new GUID object.
        public Guid NewGuid()
        {
            return Guid.NewGuid();
        }
    }
}

You might say, wheres the WTF? To which I reply, everywhere! The number of things this developer did to annoy me, in such a tiny space, is amazing.

Lets start with the comments. Look at those comments. They provide no information. Why should they? The class provides no functionality, either! Itd be one thing if this service was an attempt to patch the fact that JavaScript has no native GUID functionality, but this code isnt called by JavaScript- its consumed by other services in Business.Common .

Speaking of: Business.Common. Business.Common. For some reason, enterprise developers think this is an acceptable naming convention for their enterprise code. I suppose once youve adopted an n-tier architecture, it doesnt really matter whats in those tiers any more.

Theres a psychological effect where, if you say the same word over and over again, your brain stops thinking about it as a word and it just becomes a meaningless jumble of noise. Try saying this aloud: The GuidService implements the IGuidService contract, and contains a method NewGuid which returns a Guid generated by the static NewGuid method on the Guid class.


For the Pittsburgh readers, Remy's "Technical Storytelling" workshop is less than two weeks away, and seats are filling up fast. He's teamed up with master storyteller Kevin Allison. Learn how storytelling, combined with a technical perspective, can make you better at your job and advance your career. For a taste of what we'll discuss, check out these essays: Characters and Personification, Failing Upwards, Driving Change, and Detail Oriented.

http://thedailywtf.com/articles/Enterprise-GUID

Метки:  

 

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

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

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

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