Regions: Love or Hate
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I like them in my code, I find them irritating in the code of others
-
GuyThiebaut wrote:
they also hide the code within a region from the find dialogue box :mad:
Check the 'search hidden text' box in the Find dialog.
Software Zen:
delete this;
Thank you :)
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I like regions to a point. I think they would be more useful if we could set their background color to something other than the white space color.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Thank you :)
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
In your defense, I didn't find it for a while. I think the box in the Find dialog should be labelled "search within collapsed regions", or something like that.
Software Zen:
delete this;
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I tend to only use them if there is a lot happening on the code, and when i do use them, it is for the purpose of grouping like things together e.g. all button click methods together all menu.... all toolbar.... all statusbar.... all public properties together all private fields together like everything else though, each to there own, unless of course you are working to agreed coding guidelines as a group.
Dave Find Me On: Web|Facebook|Twitter|LinkedIn
Folding Stats: Team CodeProject
-
I have a love hate relationship with them - they can hide what I don't need to see when I am looking at significant code :) they also hide the code within a region from the find dialogue box :mad:
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
-
In your defense, I didn't find it for a while. I think the box in the Find dialog should be labelled "search within collapsed regions", or something like that.
Software Zen:
delete this;
.Net is my hobby - I think if I was doing this for a living then it would be rather more embarrassing - thanks for your help :)
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
Try remembering the following and you should be ok. (of course these may be different based on your settings)
Ctrl + M, M - Toggle Outlining expansion
Ctrl + M, L - Toggle all outlining
Ctrl + M, P - Stop outlining
Ctrl + M, Ctrl + U - stop hiding current
Ctrl + M, O - Collapse to definitionsToo much of heaven can bring you underground Heaven can always turn around Too much of heaven, our life is all hell bound Heaven, the kill that makes no sound
-
I wasn't sure until I started using them to group related items in the same file: Fields Properties Constructors Event handlers Public properties Private properties Now I find it reduces the clutter, and lets you see what you are interested in, without being distracted by irrelevancies. So much so that I modified the VS default class (and so forth) files to include them as standard. There is a Tip/Trick about it here: Adding your items to Visual Studio default files[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
Used to like, now dislike: Used to like and used them to tidy up "sections" of classes (e.g. fields, properties, methods) now I've come round to the opinion that is just hides code. Too often they hide incorrect class structure and poor general design. The worst offenders in this case are inside methods where a region is used to hide what should be refactored into private methods in some poorly written god-method. I've seeen them used to hide Data Access stuff in an object model which should have been a whole different architectural layer and entire "classes" within a god-class.
Sort of a cross between Lawrence of Arabia and Dilbert.[^]
-Or-
A Dead ringer for Kate Winslett[^] -
I wasn't sure until I started using them to group related items in the same file: Fields Properties Constructors Event handlers Public properties Private properties Now I find it reduces the clutter, and lets you see what you are interested in, without being distracted by irrelevancies. So much so that I modified the VS default class (and so forth) files to include them as standard. There is a Tip/Trick about it here: Adding your items to Visual Studio default files[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I like them ... used judiciously. best, Bill
"Is it a fact - or have I dreamt it - that, by means of electricity, the world of matter has become a great nerve, vibrating thousands of miles in a breathless point of time? Rather, the round globe is a vast head, a brain, instinct with intelligence!" - Nathanial Hawthorne, House of the Seven Gables
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
Like anything in code their use needs to be part of your coding standards. What I'd like to see is a way to colour the entire background of a region (specifically, green or yellow). I use them like
#region Public Methods ----------------------------------------------
and having the entire line highlighted would make them so increidbly valuable as markers. And I know: If your files are short enough you never need something like this... cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
Region is the opiate of the people! Ooops. I read that wrong. Never mind
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
Like anything in code their use needs to be part of your coding standards. What I'd like to see is a way to colour the entire background of a region (specifically, green or yellow). I use them like
#region Public Methods ----------------------------------------------
and having the entire line highlighted would make them so increidbly valuable as markers. And I know: If your files are short enough you never need something like this... cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Devexpress has something similar to that. Regions can be colored in a differant colour but not the entire region background unfortunately. There is a line indicating the start and end of the region and the option to have the name of the region both at the start and end. I find that it helps but could still be improved on. By the way something seems to be wrong with your sig. Don't see the line seperating your message and sig and there is html in it. This is what I get:
And I know: If your files are short enough you never need something like this...
cheers,
Chris MaunderThe Code Project | Co-founder
Microsoft C++ MVP -
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I like them as long as used sensibly. They're also great when working with a section of controls events, I put all the events of a group of controls together and stick them in a region, makes it much easier to read.
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
If regions are being used to hide code then they are being used incorrectly. When someone "hides" something that means they don't want you to see it. Sweeping a mess under the carpet does not eliminate it, now you have a lumpy rug that someone will trip on. I absolutely agree with using them to group related items, I especially likes Griff’s list above. The ability to change the background to have them stand out would be nice.
It was broke, so I fixed it.
-
I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...
I use an editor[^] that supports real code folding. [^]. Why would I need "regions"? :-\