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

  • Home
  • SEARCH
  • 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 62079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:25:11+00:00 2026-05-10T18:25:11+00:00

How do you think, is it a good idea to have such an enum:

  • 0

How do you think, is it a good idea to have such an enum:

enum AvailableSpace {    Percent10,    Percent20,    SqF500,    SqF600 } 

The question is about the semantics of the values names, i.e. both percentage and square feet. I really believe that it’s not a good idea, but I could not find and guidelines, etc. in support of this.

EDIT: This will be used to determine a state of an entity – i.e. as a read only property to describe a state of an object. If we know the total space (i.e. the object itself knows it), we have the option to convert internally, so we either have only percentage, or square feet, or both. The argument is, that ‘both’ is not a good idea.

The above is an example of course, but the real problem is that some data providers send us totals (sq.f.), and others percentage, and my goal is to unify the UI. I’m free to make some approximations, so the exact values will be adapted based on how accurate we want to present the information.

The question is only about the semantics of the value names, not the content – i.e. if it is a good idea to put percentage in an (potential) int enum.

  • 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. 2026-05-10T18:25:11+00:00Added an answer on May 10, 2026 at 6:25 pm

    The answer: No, it is not a good idea to use enums for representing values. Especially values in two semantically distinct scales. You should not use enums for values.

    The reason: What’s the relation between the enum values from the two scales, like Percent10 and SqF600? How do you expand the list of values you can represent within your code? How do you do comparison and arithmetic operations on these values?

    The suggestion (not asked for, but nevertheless here it is. :-)): The semantic of what you are trying to do would be better reflected by a struct that contains two fields – one for absolute area and one for percentage available of that absolute area. With such structure you can represent anything you can represent with the enums above. For example, data providers that give you absolute area, are represented with a struct with the area and 100% available. Data providers that give you percentage, are represented with a struct with the percentage they set and the absolute area such that the percentage of that area is the actual available area the data provider wants to report. You get ‘normalized’ representation of the data from both type of providers and you can add couple of operators to enable comparison and arithmetic calculations with instances.

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

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you're using a variable in a property, you need… May 12, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer Don't mix static and instance methods like this. Consider, separating… May 12, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer Rather than hard code the path to your Lua script… May 12, 2026 at 6:14 pm

Related Questions

This question is for web developers and architects. How do you think is it
I have a project that I have been working on for a while, just
At my company we're starting to branch into web APIs to access and update
I'd like to implement a Lisp interpreter in a Lisp dialect mainly as a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.