tags:

views:

92

answers:

2

I'm using a ORM and ran across a database table named Class. I've been naming the domain objects the same as their table name. So is Class a valid name for this object? I know it will compile but it doesn't seem like a good practice.

The table is refering to a versioned C# class.

+4  A: 

Its not good practice, and personally I would not do it, it compiles because in c# class != Class (its case sensitive)

class and all variations of class should be considered reserved words.

zadeveloper
I would use it as a property name without blinking an eye however.
NickLarsen
:) something to really confuse the VB developers ... hehehehe
zadeveloper
Aye, but the question is tagged C#
NickLarsen
I agree it would be very confusing... however.. I am having a hard time thinking of a good alternative for the person asking the question. What would everyone suggest?
Nick
So all tables have domain objects with their names except Class?
Will
I would possibly call it DomainClass - simple and descriptive
zadeveloper
I like it, though it seems semi repetitive DomainObjects.DomainClass .
Will
+1  A: 

It'll compile, but personally I'd choose a different name to avoid any potential issues or confusion. Assuming you are talking about classes in the domain of education, maybe "Course" would be a good substitute?

Eric Petroelje
What would be a different name without losing the integrity of the naming schema itself?
Will
Its actually refering to a C# class.
Will
Or ClassType if it's a lookup.
Josh Kodroff
ClassType would seem to imply the type of class? rather than which class.
Will
@Will - a database table of C# classes? It hurts my head to think about such meta-programming :)
Eric Petroelje
Just a index and version of a class. Its for auditing what class acutally built the data that went into the database. So if at a later date we improve the class we can rebuild the information with the new version of the class.
Will