Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 907013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:28:53+00:00 2026-05-15T16:28:53+00:00

I try to name a class (also members, properties and so forth) as exact

  • 0

I try to name a class (also members, properties and so forth) as exact as I can. But sometimes I’m not sure if this is so clever if the class name becomes huge (50 chars and more). The handling is so what uncomfortable and the code becomes difficult to read.

The question occured for me seldom and therefore I don’t have much experience with working with such long names but from time to time (now) it occurs. How other people handle this? Have you an approximate upper limit and then make abbreviations or is it worth the pain to handle such long names?

Update

As requested here an example of such a long class name.

ProjectContractChargingPeriodProjectAccountReferenceVM

The first Project represents the domain, it may be omitted because the namespace implies already that it handles projects. The problem with that is, that if I do this with this class name, then I must do it with all classes of this namespace and that I definitively don’t like because then many (short) class-names of this namespace will lose their expressiveness.
[Project]ContractChargingPeriod describes the object, this class is used for and ProjectAccountReference means that the class is a reference to a ProjectAccount. With ProjectAccount is the same problem as with the ProjectContract. Only using Account is not meaningful because in the app exists also other Account-Classes. The Reference is a little bit weak because in reality it’s a little bit more than only a reference, but this is the general purpose. The VM is an abbreviation I always use and it stands for ViewModel. I think this is legal because everyone who works with WPF knows what VM means.

I have to say, that the class is used to wrap a class out of an ORM that is built with an elder tool I created a long time ago. The classes there represent quasi 1:1 the ERM and I am aware that this is not optimal, but changing it would be a major effort.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:28:54+00:00Added an answer on May 15, 2026 at 4:28 pm

    (I use Java/C++, and have used other OO languages, but not C#, what I say here pretty much applies to all the languages I have used)

    I use descriptive class names. I don’t think I have made it to 50 characters however 🙂
    Generally long class names are not public, and are usually hidden behind an interface and a factory. The interface has a much shorter name than the classes.

    One thing you might do is, assuming you have a number of long-named classes that are closely related, put them into a package. One way to spot this is if the classes all have the same prefix word(s). If there are a number of classes that all start with the same name then, perhaps, the name should be a package instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.