473,320 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Survey: Regions

1) How often do you put regions into your code?

a) very often
b) occasionally
c) infrequently
d) never

2) If you didn't answer (d), what do you use regions for?

a) hiding ugly code
b) separating code into logical, collapsible blocks
c) both
d) other:
__________________________________________________ _

3) If you did answer (d), why don't you use them?

__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
__________________________________________________ ____
Nov 16 '05 #1
6 1835

"C# Learner" <cs****@learner.here> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
1) How often do you put regions into your code? d
2) If you didn't answer (d), what do you use regions for? N/A
3) If you did answer (d), why don't you use them?


It annoys me to have to use the mouse to edit a piece of code; I also don't
care to try to remember more key combonations(outside of the debugging keys,
edit keys, ctrl-space and ctrl-k ctrl-f to format code, I can't remember
combonations for the life of me). So, every region in code slows me down.

Also, due to the way I write code, there is often little easy use for
regions. Outside of constructors, I group by functionality instead of by
accessibility, much of the time. It isn't uncommon to see a private field
near a property, or a public method, a protected Impl\Core method, and
several protected or private helper methods in the same area when all of
those private methods relate only to the public method. As such, I would be
making regions for every public method in some situations..which is silly,
IMHO.
Nov 16 '05 #2
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
Also, due to the way I write code, there is often little easy use for
regions. Outside of constructors, I group by functionality instead of by
accessibility, much of the time. It isn't uncommon to see a private field
near a property, or a public method, a protected Impl\Core method, and
several protected or private helper methods in the same area when all of
those private methods relate only to the public method. As such, I would be
making regions for every public method in some situations..which is silly,
IMHO.


I write code in the same way - but that's a reason *for* using regions,
IMO.

For instance, if I write one public method and 5 private helper
methods, I can lump all of that together in one region, and I'll only
see that code if I'm actually interested in that public method.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
Also, due to the way I write code, there is often little easy use for
regions. Outside of constructors, I group by functionality instead of by
accessibility, much of the time. It isn't uncommon to see a private field
near a property, or a public method, a protected Impl\Core method, and
several protected or private helper methods in the same area when all of
those private methods relate only to the public method. As such, I would
be
making regions for every public method in some situations..which is
silly,
IMHO.
I write code in the same way - but that's a reason *for* using regions,
IMO.

For instance, if I write one public method and 5 private helper
methods, I can lump all of that together in one region, and I'll only
see that code if I'm actually interested in that public method.


You've got a point, I should have related it to the first reason, ;). It
would mean I'd have to take my hands off the keyboard even more often. I
guess I really should learn the shortcuts to expand and collapse a region,
that would make my arguments pretty moot I suppose.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #4
C# Learner wrote:
1) How often do you put regions into your code?

a) very often
b) occasionally
c) infrequently
d) never
a)
2) If you didn't answer (d), what do you use regions for?

a) hiding ugly code
b) separating code into logical, collapsible blocks
c) both
d) other:


C)

Although I agree with Daniel that there should be a keyboard shortcut to
expand/collaps a region, I still find them very useful. I even wrote macros
to create member region's property regions or a region with the name you
specify in a dialog. I hide winforms control definitions with a region too
(hence 'c' instead of b :)) however the winforms designer is too dumb to
understand them and almost always dumps new controls in the wrong region. :(

I don't put interface specific implementations in a separate region like the
interface stubber does, because IMHO that would create too much region clutter

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #5
Frans Bouma [C# MVP] <pe******************@xs4all.nl> wrote:
Although I agree with Daniel that there should be a keyboard shortcut to
expand/collaps a region


There is - Ctrl-M Ctrl-M. That actually collapses or expands any
outline, not just the current region, but it's still better than
nothing :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
C# Learner wrote:

<snip>

Personally, I never put regions into my code (although I leave in the
ones added by MS VS.NET to hide the ugly "designer generated code") with
one exception -- like Frans, I hide form _control_ declarations in a region.

The reasons I don't use regions are that, as Daniel said, they make
browsing code a bit more effort. However, I wanted to ask anyway to get
people's input as I'm thinking about using them a bit more.

Actually, an idea just sprung to mind -- I suppose they would come in
handy when making a class which uses the Singleton pattern. They could
be used to hide the static member and the interface which exposes this
member.

Anyway, thanks for your replies.
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: GTF | last post by:
PHP Web Survey Idea.. I have been given an opportunity to create a web based survey. This is a fairly lengthy survey of 60 pages on paper (various multiple choice and free form). These are...
8
by: S.Marion | last post by:
Hello, We are interested in programmers' experiences of programming languages supported by managed runtimes (including but not limited to Java, C#, etc). In particular, we are interested in bugs...
0
by: Kenzo Fong | last post by:
Hi everyone, Sorry to fill up this newsgroup with this request, but for coursework at Erasmus University (the Netherlands) I need to conduct a survey regarding the use of certain open source...
1
by: Nico Baumgarten | last post by:
Dear Madam/Sir, You are invited to participate in an international research study. This research project is headed and led by Cambridge student Nico Baumgarten. What is it all about? It is a...
6
by: Ikke | last post by:
Hi everybody, Can somebody tell me how to disable regions in Visual Studio 2005? I've already told VS not to collapse code to regions in the settings, but each time I open a new (existing)...
8
by: Spleenwort | last post by:
With regard to XML comments in c#. I think that #regions should be self-documenting relative to XML comments or that a <region> tag should be defined and auto-inserted when you type #region...
0
by: Janet93 | last post by:
If you are involved in the development of scientific computing software, you are invited to participate in a survey on developing this kind of software. If you have already received this request, I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.