Regions == Evil(weblogs.asp.net)

submitted by rimsystemsrimsystems(6119) 4 years, 6 months ago

Bil Simser argues against using regions in your code.

11 comments |category: |Views: 28

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by cdjacocdjaco(5) 4 years, 6 months ago 0

Summary: "regions are evil since you can find stuff if you use ReSharper."

For those of us not willing (or able) to fork out $199 for an individual license, here's my advice: "go ahead and use regions. Like everything else, it can be abused. Use them wisely and apply corrective measures to junior developers who go region-happy."

Reply

posted by jamesewelchjamesewelch(2275) 4 years, 6 months ago 0

You can also use Regionerate (VS add on) and have predefined XML files that manages how you create your class's regions, so your code's regions are uniformly named and uniformly contains the same items (or so that you can enforce standards of how to use regions, etc.). Regionerate also allows you to put your new methods/properties/fields anywhere and just click Regionerate and it will move it to the correct spot - best of all its free.

Sorry for the plug, Regionerate is one of my favorite VS add ons :)

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 6 months ago 0

I use Regionerate, which is high praise since the goddamn thing keeps throwing up an exception when VS loads, and sometimes leaves tons of unmatched #endregions at the end of the file. Other than that, its completely worth it.

Reply

posted by jamesewelchjamesewelch(2275) 4 years, 6 months ago 0

That (throwing exceptions on VS load) happened to me a few times, but then it stopped doing that a while ago. Did you check to make sure you have the newest version? I can't remember what I did to make it stop, but maybe I didn't do anything.

Reply

posted by drugarcedrugarce(610) 4 years, 6 months ago 0

The title cracks me... Applying the same logic we could say Airbags == Evil, you don't need them if you drive a military tank :)

Reply

posted by bladefistbladefist(471) 4 years, 6 months ago 0

i feel like these blog entries are just to plug products and get adsense hits. This particular blog doesnt appear to have adsense, but all the same, terrible article. Regions, like any other thing in the world, should be used in moderation. I got more information from the comments before me. thx

Reply

posted by senfosenfo(881) 4 years, 6 months ago 0

This is one of the most ridiculous posts that I have ever seen on this site. It's nothing more than a pointless rant.

What I do to circumvent this issue is wait until I'm [near] complete with my code before adding regions. If later, I have to add a new method or something, it's really not a big deal to cut and paste the code and put it into the correct region.

Reply

posted by rauchyrauchy(455) 4 years, 6 months ago 0

@yesthatmcgurk:

Regionerate is still in beta, so I guess these kind of things cannot be avoided. Are you using the latest version?
If you are using the latest version, how about sending a bug report in the project website? could help...

Reply

posted by brianjlowrybrianjlowry(640) 4 years, 6 months ago 0

I use ReSharper and I still think regions are important. I am working with an app handed off by a consultant and the only thing I would say i don't like about regioning is when one region is used to encapsulate the entire class... seems rather pointless; but what do you expect from a consultant?

If you use standard properties { return _value; } { _blah = value; }; put all the properites in a region and keep it closed... i can look at the private vars for reference.

Reply

posted by aquinasaquinas(20) 4 years, 6 months ago 0

? Regions == Evil
False

Maybe he meant to assign Evil to Regions, rather than comparing them? =)

Reply

posted by foobarfoobar(0) 4 years, 6 months ago 0

Simser also boasts how him and his team like to refactor their deliverables the day before they're due. I guess that's being super-agile or something.

Reply

information Login or create an account to comment on this story