473,320 Members | 1,829 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.

Best practice w/ naming of enums?

I have a class A which contains an arraylist of another class, B, which is
rarely used separately. So I nested B within A.

I also have an enum of the values of one of the items within B. Call it C.

Right now C is also nested directly within A.

So A.C is the type and A.B.C is a variable of that type.

I fear this will provoke confusion. What is a better way to handle the
naming? I have something parallel going on in another class I need to
define.

Should C be right out on top, not nested in anything, and named something
like ABC? Then ABC would be the type and A.B.C would be the variable.

Jul 30 '06 #1
3 2557
Michael,
If you have something parallel going on in another class then it makes sense
to define the enum directly off the namespace, rather than inside one of the
classes.
In this manner, either class can refer to the enum as: namespace.enumName
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Michael A. Covington" wrote:
I have a class A which contains an arraylist of another class, B, which is
rarely used separately. So I nested B within A.

I also have an enum of the values of one of the items within B. Call it C.

Right now C is also nested directly within A.

So A.C is the type and A.B.C is a variable of that type.

I fear this will provoke confusion. What is a better way to handle the
naming? I have something parallel going on in another class I need to
define.

Should C be right out on top, not nested in anything, and named something
like ABC? Then ABC would be the type and A.B.C would be the variable.

Jul 30 '06 #2

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:37**********************************@microsof t.com...
Michael,
If you have something parallel going on in another class then it makes
sense
to define the enum directly off the namespace, rather than inside one of
the
classes.
In this manner, either class can refer to the enum as: namespace.enumName
Peter
Something parallel -- not the same thing.

I ended up using names that end in Enum for the enums, e.g.
Blah.Blither.GraphEnum for the type and Blah.Blither.Graph for the variable.
Some people say not to end the names in Enum, but in this case it made sense
to do so.
Jul 31 '06 #3
OK,
we appear to be tuned to different stations here. What I meant was to
declare the enum as if it were another class, so that you could type
NamespaceName.EnumName.
Regarding using Enum in the name, not expected good coding practice. Better
to use a descriptive term such as MyNamespace.GraphType
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Michael A. Covington" wrote:
>
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:37**********************************@microsof t.com...
Michael,
If you have something parallel going on in another class then it makes
sense
to define the enum directly off the namespace, rather than inside one of
the
classes.
In this manner, either class can refer to the enum as: namespace.enumName
Peter

Something parallel -- not the same thing.

I ended up using names that end in Enum for the enums, e.g.
Blah.Blither.GraphEnum for the type and Blah.Blither.Graph for the variable.
Some people say not to end the names in Enum, but in this case it made sense
to do so.
Jul 31 '06 #4

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

Similar topics

7
by: DEX | last post by:
Main page of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.main.html Rules of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.rules.html Comments are welcome. ...
1
by: Jack Addington | last post by:
I am just looking for some advice on naming my methods - I am getting confused as to what some of them mean now I have the following scenario - A Visual Data Object and a Logical Data Object. ...
11
by: orekinbck | last post by:
Hi There What convention do you use when naming an enumeration and variables that use the enumeration? I like plural/singular, for example: public class Example { public enum VehicleTypes...
14
by: 42 | last post by:
Hi, Stupid question: I keep bumping into the desire to create classes and properties with the same name and the current favored naming conventions aren't automatically differentiating them......
10
by: Ren | last post by:
Hi All, I'm still rather new at vb.net and would like to know the proper way to access private varibables in a class. Do I access the variable directly or do I use the public property? ...
13
by: PromisedOyster | last post by:
Many in our development team have came from a C++ background and are in the practice of prefixing private class variables with an underscore to improve readability and avoid naming collisions with...
6
by: Robinson | last post by:
Hi, I have a vauge recollection that setting a "MAX" member of an enumeration is bad practice. I can't for the life of me remember or think why this might be so and would appreciate your...
20
by: Joe | last post by:
Is any one charting packing considered to be the "best"? We've used ChartFX but wasn't too happy about the way data had to be populated along with some other issues which slip my mind right now and...
5
by: =?GB2312?B?17/HvyBaaHVvLCBRaWFuZw==?= | last post by:
Hi, I would like to have someone comments on what's the best practice defining error codes in C. Here's what I think: solution A: using enum pros: type safe. better for debug (some debugger...
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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....

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.