This is more of a style question, but it is something I am currently pondering for a project of mine.

Assume that you're creating an application which is modeling a school. So there are entities like Student, School, etc. Now this is all fine and intuitive until you get down to Class, as (in most languages) Class is a reserved word. So, given that Class is a reserved keyword, what would you call such an entity that models a school class?

  • 19
    SchoolClass???? Mar 1, 2012 at 4:43
  • 5
    You could try a synonym thesaurus.com/browse/class Mar 1, 2012 at 4:49
  • @MatthewFlynn, that did indeed cross my mind. In fact, it was my first though... Mar 1, 2012 at 5:39
  • 1
    I've reopened the question. Answers that re-iterate other answers or are snarky one-liners will be deleted, same for off topic comments.
    – yannis
    Mar 5, 2012 at 14:40
  • 1
    It's a completely legitimate question: "What do you do when your domain-specific term clashes with a term in your chosen programming language". It was just couched in the terms of a specific example, which is fine. Mar 7, 2012 at 0:07

8 Answers 8


I'd pick another term because the word Class can be ambiguous.

Does class refer to:

  1. The group of students taking a course?
  2. The whole course for this semester?
  3. The abstract course taught in multiple semesters?
  4. The group of students expected to graduate at a specific time?
  5. Some other classification of students, i.e. Advanced Class, Special Needs class.
  6. A specific lecture

And that's without even leaving the academic realm. Chances are you can find a better word to fit whatever you are trying to model. Class will only lead to some confusion.

  • Ah, yes... very good points. This is the type of discussion I was looking for. I did, in fact, mean "A group of student taking a specific course taught by a specific teacher at a specific time for a single school term (year, semester, etc)"... if that makes any sense. Or, in other words, "I am taking Biology II with Mr. Smith @ 2pm Mondays, Wednesdays, Fridays." Mar 1, 2012 at 5:46
  • The general problem of established domain terms clashing with language keywords does remain though...
    – tdammers
    Mar 1, 2012 at 6:30
  • In some institutions that's called a Stream. (Which has its own name clash issues :)) Mar 7, 2012 at 0:01

You could name it a "Course," or a "Subject," or a "Lecture" if it is a specific class. You could also use "Section," etc.

Winston Ewert really highlighted the questions you would have to ask yourself.

  • +1 for Section. This seems to be what @JasonWhitehorn had in mind, based on his response to Winston Ewert's answer
    – sq33G
    Mar 1, 2012 at 9:13

Finding a synonym is a good idea, e.g "Course."

However, the need to reuse the word class is common (often for a local variable of type Class), and the conventional replacements for class include klass, clazz, and cls.

  • "klass" means you are German (or Dutch), "clazz" is more like "jazz" and "cls", oh, wasn't this used for "CLearScreen" ? Mar 1, 2012 at 13:01

It depends, in some languages class is the reserved word, not Class.

  • 4
    I did, however, say "...given that Class is a reserved keyword...", plus, wouldn't you say that two items differing only by case is a horrible idea? Mar 1, 2012 at 5:38
  • Doesn't mean you should use it. Any more than you should use If, Else or Goto in a language where the lower-case versions of these are reserved. Mar 1, 2012 at 5:39
  • 5
    This is not an answer.
    – Jordan
    Mar 1, 2012 at 6:11
  • 1
    Java already has a class Class.
    – dan04
    Mar 1, 2012 at 6:13
  • 3
    @JasonWhitehorn: two items differing only by case is not necessarily a bad idea at all – if all your classes have uppercase names while all keywords in your language are lowercase, it's completely unambiguous that Class is a custom-defined class. Mar 1, 2012 at 12:22

I am agree with @Winston Ewert that I'd pick another term because the word Class can be ambiguous.

In this case you have to use better synonym that suit your implementation. If i do model the such type of architecture then i shall go for Course, but there are other synonym also available can be used..

Check a example class architecture that somewhat match to your system. Ref: Student class and Course class

As your question tagged with the naming, use a noun or noun phrase to name a class from synonym that you use.


In some programming languages you can use reserved words in the variable names (possibly even class names?). For example in C# you could do like this even though class is a reserved word:

string @class = "Super class";

You could check your programming language specs does it allow you to do this.

If not then just go with Winston Ewerth's answer.


Aside from programming language syntax, the word class is not a good name from data modeling perspective in the case of a school information system. When you think about what a class means you find that (among other things):

A class is an regularly scheduled activity that has a start and end and is supervised (taught) by a school educator. Within this activity a subject is taught or an activity (like sport) is performed, so, a subject is offered as zero, one or more classes.

So the word class is really a "Scheduled Educational Activity" So you have the choic of:

  • ScheduledEducationalActivity

  • ScheduledActivity (in which case you can be more generic and allow the activity to be educational or an event like a lecture or a seminar or a tournment,...etc.)

  • SubjectOffering

So the name class really is a convention or (a business name) but is not the best name that describes the entity.


You could declare the entity as ClassRoom!

  • 2
    That would be a bad name, unless the entity represents the physical room where the class is to be held.
    – Jesper
    Mar 13, 2012 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.