This is why I hate regions

I just loaded up a default from Microsoft built into the Visual Studio 2010 extensibility and was greeted with this:

image

If someone could tell me what this region is actually adding to the code-base then I would love to know! Personally, it’s just a pointless layer of abstraction.

If your interested in what is happening within the region, well it gets worse. This is the code:

image

Instantly, I notice the following problems:

1) The comment to code ratio is very high. This makes seeing the code harder.

2) The attribute to code ratio is very high. This makes seeing the code harder, however it does have some useful information.

3) The class name is not at all related to the file name. This can cause real confusion when attempting to navigate and understand a code-base. Please, don’t do it.

What would happen if we wrote code like this:

image

The true intent of the code is now very clear without having to read anything! Stop hiding code and just show us the true aim.

Ideally I would also want to remove editorAdornmentLayer however MEF uses this, as such I need to leave it.