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

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

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

 

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

 -Статистика

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


CodeSOD: Simulated Congealing

Вторник, 14 Июня 2016 г. 13:30 + в цитатник

Simulated Annealing is a class of algorithms from moving through a search space to find a solution, balancing good enough results against a computational budget.

John L has a co-worker that has taken this logic and applied it to writing code. Whenever code needs to change, he randomly changes the function in small increments until it works. The result is code that looks like this:

        private void handleDoubleClickTreeNode(object sender, FormTreeNodeArgs e)
        {
            if ( e.FormTreeNode.FormElement != null)
            {
                AddScoreElement(e.FormTreeNode.FormElement);
            }
            else if (e.FormTreeNode.FormElement == null)
            {
                if (e.FormTreeNode != null)
                {
                    if (!string.IsNullOrEmpty(e.FormTreeNode.Name))
                    {
                        AddScoreElement(e.FormTreeNode.Name);
                    }
                }
            }
        }

This code does work, but some of the conditionals make it clear that it works more through an accident than any intentional design.

[Advertisement] Infrastructure as Code built from the start with first-class Windows functionality and an intuitive, visual user interface. Download Otter today!

http://thedailywtf.com/articles/simulated-congealing

Метки:  

 

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

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

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

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