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 7700705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:46:15+00:00 2026-05-31T22:46:15+00:00

I am dealing with a clinical application that uses both base and derived units

  • 0

I am dealing with a clinical application that uses both base and derived units of measure.

Currently, we store them as a text field in a separate column in each table that requires units. However, I am planning to redesign the database so that we have all the units of measurement in one table and use foreign keys in the table that require UOMs.

This kind of solves the problem at the database level. However, in the Java code, we use String to store the units like so:

class Foo {
    double amount;
    String unit;
}

I imagine using String to store units could become a nightmare going forward. I need suggestions on a clean way to manage units of measure so that I can, say, compare two Foos or add two Foos by making sure they have the same units, etc.

  • 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-31T22:46:16+00:00Added an answer on May 31, 2026 at 10:46 pm

    I think you should have a better abstraction than a String; it’s little more than a primitive.

    I’d write a Units class that would parse and store those Strings from the database and allow you to compare them easily.

    public class Units {
        private final String name;
    
        // constructors, equals, hashCode, toString and other operations here
    }
    

    It might also be useful to have categories of Units. (You can measure pressure a lot of ways.) British and international units can describe the same thing.

    You might also have categories based on physical quantities (e.g. force, mass, charge, time, etc.)

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

Sidebar

Related Questions

When dealing with a flash application that will run in a browser, it's obvious
I'm dealing with a web app that uses a home-grown templating system that lets
Dealing with an employee that went over my head
I'm dealing with a MySQL table that defines the JobName column as UNIQUE. If
I am dealing with MySQL tables that are essentially results of raytracing simulations on
When dealing with websites with large amount of javascript, i see that these are
Dealing with go's funcs I discovered that one can't force the compiler to control
When dealing with both ints and floats in SSE (AVX) is it a good
I am dealing with lot of double values in my application, is there is
I'm dealing with an _NSDictionary that I'm trying to parse. I'm using this code

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.