"I was recently hired as an enterprise architect," Chris writes, "and my first task was to assess how far off the 'silo developed' applications were from the newly-implemented, company-wide standard."

"While I could submit a WTF for every hour I worked on this task, following is what I found in a lone WPF application containing a single screen with 1,890 lines of code.

private void btn_Export_Click(object sender, RoutedEventArgs e)
{
    Cursor = Cursors.Wait;

    ValidateFinalTab.Content = "";
    PBar.Visibility = Visibility.Visible;
    PBar.InvalidateVisual();
    Activate();
    Activate();
    Activate();
    Activate();
    Activate();
    Activate();
    Activate();
    Activate();

    Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
        new DelExportReport(delegate
        {
            var cbx_PDF = (CheckBox)FindName("checkBoxPDF");
            var cbx_HTML = (CheckBox)FindName("checkBoxHTML");
            saveReport();
            ValidateFinalTab.Content =
                xFile.ExportReport(cbx_HTML.IsChecked.Value,
                cbx_PDF.IsChecked.Value, file,
                shortfile, stylesheet);
            Activate();
            PBar.Visibility = Visibility.Hidden;
            Activate();
            Activate();
            Activate();
            Cursor = Cursors.Arrow;
            Activate();
            Activate();
            Activate();
        }));
}

Chris continues, "I can only imagine the thought process behind this. While the entire block of code violates every single standard we have made, the method Activate() being called 8 times is just totally mind blowing."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!