Object-Oriented Coding – A Class Named Class?

coding-stylenamingobject-oriented

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?

Best Answer

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.

Related Topic