comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: SI Units Checked and Unchecked
Date: Thu, 9 Aug 2018 10:32:43 -0700 (PDT)
Date: 2018-08-09T10:32:43-07:00	[thread overview]
Message-ID: <60ddd5ae-57e1-45e8-929c-302fabaa24ef@googlegroups.com> (raw)
In-Reply-To: <pkhnur$fp9$1@gioia.aioe.org>

On Thursday, August 9, 2018 at 10:51:59 AM UTC-5, Dmitry A. Kazakov wrote:
> On 2018-08-09 17:03, Dan'l Miller wrote:
> 
> > So, Dmitry, you are making the mistake of excessive reuse in the app-domain of an unfinished library. 
> > Sure, at some deep level in the library, there can be a bland gauge that skeuomorphically represents a > > swinging black needle on a white circle that has no idea whether it is measuring pressure or amperes
> > or volts or speed.  But at the intended user-interface facade of the library, there should be:
> > 1) a strongly-typed gauge for amperes,
> > 2) a separate strongly-typed gauge for pressure,
> > 3) a separate strongly-typed gauge for volts,
> > 4) a separate strongly-typed gauge for speed,
> > and so forth that are wrappers around the one shared white circle with swinging black needle as the
> > bland unitless-clueless(-at-engineering-/compile-time) gauge of which you speak.
> 
> No, I am speaking about a widget that checks and enforces measurement 
> units.

as am I

> If you look how GUI widgets are constructed you would notice 
> adjustment objects,

which should utilize the compile-time-enforced strongly-typed types, not unitless scalars

> events to propagate,

which should utilize the compile-time-enforced strongly-typed types, not unitless scalars

> properties to set and query, 

which should utilize the compile-time-enforced strongly-typed types, not unitless scalars

> MVC

which should utilize the compile-time-enforced strongly-typed types, not unitless scalars

> and dozens of other things

which should utilize the compile-time-enforced strongly-typed types, not unitless scalars

> connecting the widget to the world around 
> it, all dealing with measurement units. There is no way anybody could 
> design this with generics or statically typed.

So you can't use /this/ name instead of /that/ name of type.  Gee, your keyboard is so weird that it won't let you type /this/ strongly-typed identifier instead of /that/ weakly-typed identifier in app-domain declarations of instantiations.

> It can be statically constrained though, in some few cases, because 
> widgets are customary stored and restored. There might be some limited 
> cases with all static layouts in avionics or medical applications, these 
> are an exception from the common rule.

Safety-critical uses a different set of rules than “the common rule” of which you speak.

> And note that speed and pressure are measured in dozens different units. 

and they should all be supported, even ones that are out-of-vogue, such as CGS instead of MKS, and SI prefixes thereof

> One of the requirements of sane design is that all compatible units were 
> allowed. E.g. an adjustment object in kPa should work with a barograph 
> indicating mm Hg.

where “works with” is defined as having an overtly-instantiated converter object between them, where the converter object again assures compile-time physics-correct enforcement of strongly-typed input units of measure to strongly-typed output units of measure.  Indeed, in addition to providing all the customary conversions (e.g., MKS to CGS and vice versa), the library must provide a toolkit for the app-domain programmer to declare a few more conversions than supplied by the less-insightful library designer (e.g., even avoirdupois to metric and vice versa, Queen Anne 1707 system still in wide use in the USA to metric and vice versa,  King George III 1824 system in former use throughout the British Empire to metric and vice versa.

Just like the rule of not hardcoding a single iterator/cursor into a container, don't hardcode conversions or prohibitive lack thereof into the compile-time-enforced strong-typing units-of-measure dimension types.

> And I don't remember a single customer who ever wanted 
> his HMI showing speed in SI's m/s.

Why in the world would a GUI widget library dictate the requirements to the customer, as a tail wagging the dog?  The strongly-type GUI widget library should present a physics-correct plethora of options to the customer so that the customer speaks the language of the customer, not of some library designer (who sought effort reduction).  The purpose of engineering is to serve the customer's expectations, not to the library designer's whim.


  reply	other threads:[~2018-08-09 17:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 12:44 SI Units Checked and Unchecked AdaMagica
2018-08-09 13:47 ` Dan'l Miller
2018-08-09 14:07   ` Dmitry A. Kazakov
2018-08-09 15:03     ` Dan'l Miller
2018-08-09 15:51       ` Dmitry A. Kazakov
2018-08-09 17:32         ` Dan'l Miller [this message]
2018-08-09 19:42           ` Dmitry A. Kazakov
2018-08-09 22:12             ` Dan'l Miller
2018-08-10  6:45               ` Dmitry A. Kazakov
2018-08-10 13:59                 ` Dan'l Miller
2018-08-10 14:50                   ` Dmitry A. Kazakov
2018-08-10 17:04                     ` Dan'l Miller
2018-08-10 17:34                       ` Dmitry A. Kazakov
2018-08-11  4:42                         ` Paul Rubin
2018-08-11  5:46                           ` Dmitry A. Kazakov
2018-08-11 19:57                             ` Paul Rubin
2018-08-11 21:01                               ` Dmitry A. Kazakov
2018-08-09 18:47       ` Paul Rubin
2018-08-09 19:13         ` Dan'l Miller
2018-08-09 14:31   ` AdaMagica
2018-08-09 15:19     ` Dan'l Miller
2018-08-09 16:07 ` Jeffrey R. Carter
2018-08-09 17:41   ` AdaMagica
2018-08-09 20:34     ` Jeffrey R. Carter
2018-08-10  9:13       ` AdaMagica
2018-08-10 20:20         ` Jeffrey R. Carter
2018-08-13  8:57           ` AdaMagica
2018-08-20 17:55             ` AdaMagica
2019-09-04 14:20 ` Shark8
2019-09-04 17:11   ` AdaMagica
2019-09-06 21:01     ` Shark8
2020-08-13 12:24       ` SI Units Checked and Unchecked - Completela overhauled version AdaMagica
  -- strict thread matches above, loose matches on Subject: below --
2003-02-05  7:03 SI Units Checked and Unchecked Grein, Christoph
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox