Article 6MYZD CodeSOD: Regional Variation

CodeSOD: Regional Variation

by
Remy Porter
from The Daily WTF on (#6MYZD)

Visual Studio and the .NET languages support a feature known as "regions". Enclosing a block of code between #region SomeName and #endregion creates collapsible regions in the text editor.

It can, in principle, help you organize your code. It does, in practice, make code like this, from Mark, possible.

omg_screen1.png

"What do you mean, 'single responsibility principle?' This has one job! ADD A CLAIM. How can it get simpler than that?"

The upshot of this, is that it's easier to see how one might refactor this function into multiple functions which collaborate. The downside is that this code has been like this for years. As a very bureaucratic insurance company, any refactoring efforts need to be budgeted for, you can't just refactor while working on other tickets- that's "misusing the budget".

Instead, we get to enjoy the idea of simple functions, without actually having simple functions.

otter-icon.png [Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments