473,327 Members | 1,919 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,327 software developers and data experts.

#region....

Jim
Are #region a bad thing or are they good?

As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......
Thoughts?

Cheers

Jim
Nov 15 '05 #1
6 12265
personally i find them very cool, but don't use them often...
Most of the time, i find it handy to have a region for each implemented interface of a class...
"Jim" <ssss> wrote in message news:uj*************@TK2MSFTNGP10.phx.gbl...
Are #region a bad thing or are they good?

As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......
Thoughts?

Cheers

Jim

Nov 15 '05 #2
"Jim" <ssss> <"Jim" <ssss>> wrote:
Are #region a bad thing or are they good?

As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......


I would *very* rarely consider using a region *within* a method,
however, regions are great for *grouping* methods, fields etc.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #3
Even inside a function, a long list of repetitive code, like

txts[0] = text0;
txts[1] = text1;
....
txts[30] = text30;

will do great in a region of its own.

"Jim" <ssss> wrote in message news:uj*************@TK2MSFTNGP10.phx.gbl...
Are #region a bad thing or are they good?

As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......
Thoughts?

Cheers

Jim

Nov 15 '05 #4
Jim,
As a number of others have said. Bad use of a region does not make it bad.

Like the others I use it to group code. These groupings tend to include:

- Patterns - all the members for a pattern are in their own region. Seeing
the title of the region indicates to me the class implements that pattern
- Interfaces - all the members implementing an interface are in their own
region. For larger interfaces I will create a number of region groups
- Concepts - I'll create a region for overrides & interfaces that share a
concept. Comparability for example. The IComparable interface & the Equals
override I'll group together in a single region. Formatting is another
concept I will group.
- Static members - If the class has shared/static members that support the
class, as oppose to the intent of the class, I will group them in a region.

Most regions I place at the end of the class, Pattern & static regions tend
to be at the top of the class.

Rarely will I nest a region inside another region. And especially rarely
will all the code in a class be in region. I like to see the 'important'
members outside of a region, I put the less important 'support' members
inside of regions.

Hope this helps
Jay

"Jim" <ssss> wrote in message news:uj*************@TK2MSFTNGP10.phx.gbl...
Are #region a bad thing or are they good?

As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......
Thoughts?

Cheers

Jim

Nov 15 '05 #5
"bad" is an understatement in this case.

"Jim" <ssss> wrote in message news:eS*************@TK2MSFTNGP12.phx.gbl...
Exactly, this is what I mean people hiding bad code inside a #region......


"Jon Skeet" <sk***@pobox.com> wrote in message
news:MP************************@news.microsoft.com ...
Chris Capel <ch***@nowhere.com> wrote:
Even inside a function, a long list of repetitive code, like

txts[0] = text0;
txts[1] = text1;
...
txts[30] = text30;

will do great in a region of its own.


That sounds like the kind of thing that would suggest a refactoring in
itself though, to me...

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


Nov 15 '05 #6
It's a pity this attitude isn't more common in regards to Multiple
Inheritance :P

Niall

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:OX**************@tk2msftngp13.phx.gbl...
Jim,
As a number of others have said. Bad use of a region does not make it bad.

Nov 15 '05 #7

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

Similar topics

11
by: Altramagnus | last post by:
I have a complicated Region object, which I need to draw the outline, but not fill How can I convert the Region object to GraphicsPath object? or How can I draw the outline of the Region object?
4
by: Brian Basquille | last post by:
Hello all, Quick question! How would i keep a point inside a region? For example, the mouse pointer. You should be able to move the mouse around in this region but not anywhere outside it. ...
2
by: Brian Basquille | last post by:
Another question for ye all.. How do i check if a Region has entered another region? Up until now, i've been checking if rectangles (or images converted into Rectangles) have been visible in a...
1
by: Steven T. Hatton | last post by:
All of the following terms are used in some way to describe where and how a name is relevant to a particular location in a program: visible, declarative region, scope, potential scope, valid,...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
1
by: Sagaert Johan | last post by:
i have a control that uses a region to make it non rectangular when i try to to remove the region by calling this.Region.Makeinfinite() the control keeps its non rectangular Region. if i call...
3
by: Grant Edwards | last post by:
I've recently switched from Jed to Emacs for editing python source, and I'm still stumped as to how one indents or dedents a region of code. In Jed it's 'C-c <' or 'C-c >'. Google has found...
1
by: Chris Thomasson | last post by:
This region allocator is not dynamic and can be fed with a buffer residing on the stack of the calling thread. Therefore, you can use this in an environment which does not have a heap; its...
8
by: Chris M. Thomasson | last post by:
Here is the initial crude implmentation which compiles under Comeau with no warnings: ___________________________________________________________________ #include <cassert> #include <cstdlib>...
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...
1
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.