Archive

Archive for the ‘Never Do That’ Category

Compromise in code

July 27th, 2010 No comments

Today I encountered another wild animal while surfing in the jungle. Pretty much nothing to comment 🙂

if (visiblePath == null)
{
     visiblePath = new DispatcherTimer();
     visiblePath.Tick -= new EventHandler(visiblePath_Tick);
     visiblePath.Tick += new EventHandler(visiblePath_Tick);
     visiblePath.Interval = TimeSpan.FromSeconds(500);
}
else
{
     visiblePath.Tick -= new EventHandler(visiblePath_Tick);
     visiblePath.Tick += new EventHandler(visiblePath_Tick);
}
visiblePath.Stop();
visiblePath.Start();

Code Duplication

September 24th, 2009 No comments

Today at the office I encountered another nightmare. It seems like the author of the code above was doing the development late at night, he sleep in the middle and unintentionally pushed Ctrl-V button.

DuplicationHell
Read more…

Scope Nightmare

September 9th, 2009 2 comments

Today at the workplace I came across a very weird chunk of code. An enormous block of code was wrapped in 25-30 levels of brackets. On a a standard resolution screen (1280×1024) the code was completely out of screen. After spending some time on refactoring it and eliminating annoying scopes I decided to take a screenshot and post it here.
NestedScopes

Below I will describe reasons that can lead to such kind of issues and possible solutions.
Read more…

Attached Files: