Thursday 24 July 2008

Regions

Does anyone use regions in their code?

Like many of the features in the .NET world that are not available in the Java world I’ve had to spend some time getting my head round them.

I think things like lambda expressions:

Html.ActionLink(c => c.Index())

and the single line getters & setters:

public string Name { get; set; }

are great language features. They, make our code neater, mean we can write less code and in the case of the lambda’s our code far easier and safer to refactor.

However, regions, I don’t get. To me they add zero value to the code we write, they are comments that allow our editors to arrange our code. Even one of the features of my much loved resharper will arrange code automatically putting it into regions… it’s one of the features I’m going to have to disable.

Anyway I read this blog entry earlier on and it hits the nail on the head for me.

http://www.codinghorror.com/blog/archives/001147.html

No comments: