Regions == Evil(weblogs.asp.net)
submitted by rimsystems(6119) 4 years, 6 months ago
Bil Simser argues against using regions in your code.
11 comments |category: Visual Studio |Views: 28 Tweet
tags: VisualStudio another
Add a live kick counter to your blog >>
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:
Simply copy and paste this HTML into your blog post.
posted by cdjaco(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 jamesewelch(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 :)
posted by yesthatmcgurk(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.
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.
posted by drugarce(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 :)
posted by bladefist(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
posted by senfo(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.
posted by rauchy(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...
posted by brianjlowry(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.
posted by aquinas(20) 4 years, 6 months ago 0
? Regions == Evil False Maybe he meant to assign Evil to Regions, rather than comparing them? =)
posted by foobar(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.
All tags Your tags
Suggest a new category
dpeterson(1273)
Telerik(409)
fdub(381)
amit.jain(273)
BlackWasp(259)
RobertTheGrey(259)
jalpesh(252)
bsenoff(240)
KodefuGuru(227)
KMillerr(226)