Jump to content

How to design an application when it comes to Unit of Measurement conversions


dennis-fedco
Go to solution Solved by Psycho,

Recommended Posts

Let's say there is an application where a user would like to use English and Metric systems to enter values.  For example, to handle customer orders where customers give data in this or that system, (but not both).

 

From the user-view, all the user cares about is if they can select English or Metric system, enter their values, click submit, and have their data added to the page in their choice of system, and have their values (and choice of system) stay the same.

The back end however is set up to do "compute" operations with English system in mind only.  So inside back end, before the compute module, all the values should be converted to English.  Some things like precomputed constants, that exist in computations are in English unit of measurements.

 

So I have attached an image of what I am thinking .. 

* first (top) way is one where the front-end takes care of conversions.  Back-end is not aware of another system (which makes it difficult sometimes, when trying to display a page back to the user saying "We know you chose system X"), and being aware of chosen system is something that I think is beneficial.

* the second (bottom) way is where front end is merely a passing device to back end, and bac-end takes care of conversions.  Back-end is also aware of the two systems

 

 

My question is -- is there a preferred way to design an application when it comes to considerations above?  Have a system-aware back-end, or try to localize system to front end only?

post-167637-0-77980500-1415741808_thumb.png

Link to comment
Share on other sites

  • Solution

Never rely upon client-side functionality for computations or validations. It can break if JS is not working or there is a compatibility issue and it can be easily overridden by the user to submit values you don't want to allow. Sure, it might not be an issue in the context of your app, but it's not good process.

 

I would allow the user to change the measurement type and, once submitted, save that value in a cookie and use it to auto-select the measurement type on each successive page load.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.