SlideShare a Scribd company logo
1 of 37
Trinity College, Dublin 08 – 11 June 2010 UCUM Unified Code for Units of Measure Werner Keil Agile Coach, emergn
Our Goal Avoiding Interface and Arithmetic Errors
Emphasis Most of today’s technologies including the current Java Language Releases lack support for common non-trivial Arithmetic problems like Unit Conversions.
Summary Present Situation Historic IT Errors and Bugs Cause of Conversion Errors  Proposed Changes Unit and Measure Support Type Safety Case Studies Demo Q&A
What do these disasters have in common? Patriot MissileThe cause was an inaccurate calculation of the time since boot due to a computer arithmetic error. Ariane 5 ExplosionThe floating point number which a value was converted from had a value greater than what would be represented by a 16 bit signed integer.
What do these disasters have in common? Mars Orbiter Preliminary findings indicate that one team used English units (e.g. inches, feet and pounds) while the other used metric units for a key spacecraft operation. NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency's team used the more conventional metric system for a key spacecraft operation This also underlines the added risk when 3rd party contractors are involved or projects are developed Offshore
NASA “Star Wars” Experiment, 1983 23rd March 1983. Ronald Reagan announces SDI (or “Star Wars”): ground-based and space-based systems to protect the US from attack by strategic nuclear ballistic missiles.
1985 Mirror on underside of shuttle SDI Experiment: The Plan Big mountain in Hawaii
1985 SDI Experiment: What really happened
1985: What happened?
NASA Mars Climate Orbiter, 1999
Unit Tests did not find these Errors All previous example illustrate three categories of errors difficult to find through Unit Testing: Interface Errors (e.g. millisecond/second, radian/degree, meters/feet). Arithmetic Errors (e.g. overflow). Conversion Errors.
Causes of Conversion Errors Ambiguity on the unit Gallon Dry / Gallon Liquid Gallon US / Gallon UK Day Sidereal / Day Calendar ... Wrong conversion factors: static final double PIXEL_TO_INCH = 1 / 72; double pixels = inches * PIXEL_TO_INCH
Present Situation Java does not have strongly typed primitive types (like e.g. Ada language). For performance reasons most developer prefer primitive types over objects in their interface. Primitives type arguments often lead to name clashes (methods with the same signature)‏
UCUM Unified  Code for Units of Measure The Unified Code for Units of Measure is a code system intended to include all units of measures being contemporarily used in international science, engineering, and business. The purpose is to facilitate unambiguous electronic communication of quantities together with their units. The focus is on electronic communication, as opposed to communication between humans. A typical application of The Unified Code for Units of Measure are electronic data interchange (EDI) protocols, but there is nothing that prevents it from being used in other types of machine communication. How does it relate?
UCUM Unified  Code for Units of Measure The Unified Code for Units of Measure is inspired by and heavily based on ISO 2955-1983 ANSI X3.50-1986 HL7's extensions called ISO+
JSR-275 Base Classes and Packages Namespace: javax.measure.* Only one interface and one abstract class Measurable<Q extends Quantity> (interface)‏ Measure<V, Q extends Quantity> (abstract class)‏ Three sub-packages Unit (holds the SI and NonSI units)‏ Quantity (holds dimensions mass, length)‏ Converter (holds unit converters)‏
Units and Systems of Unit
Unit Operations Results with Same Dimension	Different Dimension Binary Operations	Binary Operations plus (double) or (long)	root(int) times(double) or (long)	power(int) divide(double) or (long)	times(Unit) compound(Unit)	divide(Unit) Unary Operations 	inverse() © 2007-2009  Creative Arts & Technologies
The King is Dead… Units of Measure API Namespace: org.unitsofmeasure.* Only interfaces and one abstract class Measurable<Q extends Quantity> (interface)‏ Measure<V, Q extends Quantity> (abstract class)‏ Two sub-packages Quantity (holds dimensions mass, length) Util (misc items and helpers)
JSR-256 Mobile Sensor API Namespace: javax.microediton.sensor* Focusing on Sensors, but it got a minimalistic Unit API “in the closet” Unit	Essentially an SI singleton holding relevant unit constants, too. ChannelInfoHolding name, accuracy, data type,measurement ranges, scale and unit MeasurementRangeRange of possible values from minimum to maximum
JSR-256 Sensor States
JSR-256 Sensor Groups Context types categorize sensors into three groups:  ambient, sensors measuring some ambient property of the environment  device, sensors measuring properties related to the device  user, sensors measuring some function of the user  By using context types, it is possible to find, for example, user-related sensors for fitness, or ambient sensors for smart home controlling. Although the granularity of this level does not qualify the sensors very precisely, still in some cases it provides the way to make the distinction, for example, cf. air thermometer (ambient) / clinical thermometer (user).
JSR-256 Quantity The quantity provides a more precise qualifier. The unit and the quantity has a close relation. Some quantities are listed in tables of Unit class. When the quantity and context type is known, it is often easy to guess the full purpose of the sensor. Some examples are given here:  Quantity: electric_current + context type: ambient = sensor measuring electric current, amperemeter Quantity: catalytic_activity + contex type: ambient = sensor measuring catalytic activity
OSGi Measurement Package Namespace: org.osgi.util.measurement SI only Unit API “in the closet” Unit	Essentially an SI singleton holding relevant unit constants, too. MeasurementRepresents a value with an error, a unit and a time-stamp.  StateGroups a state name, value and timestamp.
Eclipse project UOMo One Unit Framework to Measure them All Namespace: org.eclipse.uomo.* Two main areas Static Type Safe Units of Measure Support Based on Units of Measure API On top of ICU4J, the Globalization standard at Eclipse and others (Android, GWT, Google Financial, etc.) UCUM Reference Implementation Successor to Eclipse OHF UCUM Bundle
Case Study: Monetary System Monetary systems are not subject to the JSR, but this illustrates, how easily the framework can be extended to non physical or scientific quantities. Such extension can be valuable by leveraging the framework’s capabilities (formatting, conversion,…)  and applying its usefulness beyond what e.g. java.util.Currency now has to offer.
Currency Conversion Classes
Online Currency Conversion Example
Trading Application Example What happens, if we use built in java.util.Currency and Standard  JSP formats
Money Demo (1) We’ll extend MoneyDemo to show fuel costs in Indian Rupees. First by adding a new currency to MonetarySystem. // Use currency not defined as constant (Indian Rupee). public static final DerivedUnit<Money> INR= monetary(new Currency(„INR") ); Then add this line to MoneyDemo.(also change static import to MonetarySystem.*; ) UnitFormat.getInstance().label(INR, „Rp");
Money Demo (2) Next set the Exchange Rate for Rp. ((Currency) INR).setExchangeRate(0.022);   // 1.0Rp = ~0.022 $ Note, the explicit cast is required here, because getUnits() in SystemOfUnits currently requires a neutral <?> generic collection type.
Money Demo (3) Then we add the following line to the “Display cost.” section of MoneyDemo System.out.println("Trip cost = " + tripCost + " (" + tripCost.to(INR) + ")"); Resulting in the additional output: Trip cost = 87.50 $ (3977.26 Rp)
Links JCP – Java Community Process http://www.jcp.org UCUM http://www.unitsofmeasure.org Units of Measure API http://www.javaforge.com/project/uom
Questions werner@emergn.com Or  info@catmedia.us Twitter: @wernerkeil
Werner Weil: UCUM - epicenter 2010

More Related Content

Viewers also liked

Tbc, Hepatitis B, Neumococo
Tbc, Hepatitis B, NeumococoTbc, Hepatitis B, Neumococo
Tbc, Hepatitis B, NeumococoHelver Gonzales
 
Turning Continuous Improvement and a PMO into an Innovation Team
Turning Continuous Improvement and a PMO into an Innovation Team Turning Continuous Improvement and a PMO into an Innovation Team
Turning Continuous Improvement and a PMO into an Innovation Team KaiNexus
 
The lean hospital what is mean
The lean hospital what is meanThe lean hospital what is mean
The lean hospital what is meanEmad Kotb
 
Practicing Lean 2016 Mark Graban Lean Frontiers
Practicing Lean 2016 Mark Graban Lean FrontiersPracticing Lean 2016 Mark Graban Lean Frontiers
Practicing Lean 2016 Mark Graban Lean FrontiersMark Graban
 
Pure culture technic
Pure culture technicPure culture technic
Pure culture technicRitesh ranjan
 
Culture characteristic of bacteria
Culture characteristic of bacteriaCulture characteristic of bacteria
Culture characteristic of bacteriaDr. Samira Fattah
 

Viewers also liked (8)

Tbc, Hepatitis B, Neumococo
Tbc, Hepatitis B, NeumococoTbc, Hepatitis B, Neumococo
Tbc, Hepatitis B, Neumococo
 
Task analysis
Task analysisTask analysis
Task analysis
 
Turning Continuous Improvement and a PMO into an Innovation Team
Turning Continuous Improvement and a PMO into an Innovation Team Turning Continuous Improvement and a PMO into an Innovation Team
Turning Continuous Improvement and a PMO into an Innovation Team
 
The lean hospital what is mean
The lean hospital what is meanThe lean hospital what is mean
The lean hospital what is mean
 
Anh Nhuyen, Rovio
Anh Nhuyen, RovioAnh Nhuyen, Rovio
Anh Nhuyen, Rovio
 
Practicing Lean 2016 Mark Graban Lean Frontiers
Practicing Lean 2016 Mark Graban Lean FrontiersPracticing Lean 2016 Mark Graban Lean Frontiers
Practicing Lean 2016 Mark Graban Lean Frontiers
 
Pure culture technic
Pure culture technicPure culture technic
Pure culture technic
 
Culture characteristic of bacteria
Culture characteristic of bacteriaCulture characteristic of bacteria
Culture characteristic of bacteria
 

Similar to Werner Weil: UCUM - epicenter 2010

Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011beloslab
 
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)Werner Keil
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013Werner Keil
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013Werner Keil
 
geecon 2013 - Standards for the Future of Java Embedded
geecon 2013 - Standards for the Future of Java Embeddedgeecon 2013 - Standards for the Future of Java Embedded
geecon 2013 - Standards for the Future of Java EmbeddedWerner Keil
 
Software Requirements and Design Process in the Aerospace Industry
Software Requirements and Design Process in the Aerospace IndustrySoftware Requirements and Design Process in the Aerospace Industry
Software Requirements and Design Process in the Aerospace IndustryLeif Bloomquist
 
Applying Drools in Assistive Technology
Applying Drools in Assistive TechnologyApplying Drools in Assistive Technology
Applying Drools in Assistive Technologytsurdilovic
 
Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for SpaceUlisses Costa
 
The Eclipse M2M IWG and Standards for the Internet of Things
The Eclipse M2M IWG and Standards for the Internet of ThingsThe Eclipse M2M IWG and Standards for the Internet of Things
The Eclipse M2M IWG and Standards for the Internet of ThingsWerner Keil
 
JSR 363 - The Answer to Life Science and the Internet of Everything
JSR 363 - The Answer to Life Science and the Internet of EverythingJSR 363 - The Answer to Life Science and the Internet of Everything
JSR 363 - The Answer to Life Science and the Internet of EverythingWerner Keil
 
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docx
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docxDEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docx
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docxsimonithomas47935
 
Standards for the Future of Java Embedded (16:9)
Standards for the Future of Java Embedded (16:9)Standards for the Future of Java Embedded (16:9)
Standards for the Future of Java Embedded (16:9)Werner Keil
 
Standards for the Future of Java Embedded
Standards for the Future of Java EmbeddedStandards for the Future of Java Embedded
Standards for the Future of Java EmbeddedWerner Keil
 
Running Head WINDOWS AND LINUX 1WINDOWS AND LINUX12.docx
Running Head WINDOWS AND LINUX     1WINDOWS AND LINUX12.docxRunning Head WINDOWS AND LINUX     1WINDOWS AND LINUX12.docx
Running Head WINDOWS AND LINUX 1WINDOWS AND LINUX12.docxjeffsrosalyn
 
Cigdem gencel persistence in poor estimating in software engineering- whys an...
Cigdem gencel persistence in poor estimating in software engineering- whys an...Cigdem gencel persistence in poor estimating in software engineering- whys an...
Cigdem gencel persistence in poor estimating in software engineering- whys an...oxwocs
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELijasuc
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELijasuc
 
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications neirew J
 

Similar to Werner Weil: UCUM - epicenter 2010 (20)

Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011
 
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Kepler 2013
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
 
geecon 2013 - Standards for the Future of Java Embedded
geecon 2013 - Standards for the Future of Java Embeddedgeecon 2013 - Standards for the Future of Java Embedded
geecon 2013 - Standards for the Future of Java Embedded
 
Software Requirements and Design Process in the Aerospace Industry
Software Requirements and Design Process in the Aerospace IndustrySoftware Requirements and Design Process in the Aerospace Industry
Software Requirements and Design Process in the Aerospace Industry
 
Applying Drools in Assistive Technology
Applying Drools in Assistive TechnologyApplying Drools in Assistive Technology
Applying Drools in Assistive Technology
 
IJET-V3I2P15
IJET-V3I2P15IJET-V3I2P15
IJET-V3I2P15
 
Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for Space
 
The Eclipse M2M IWG and Standards for the Internet of Things
The Eclipse M2M IWG and Standards for the Internet of ThingsThe Eclipse M2M IWG and Standards for the Internet of Things
The Eclipse M2M IWG and Standards for the Internet of Things
 
JSR 363 - The Answer to Life Science and the Internet of Everything
JSR 363 - The Answer to Life Science and the Internet of EverythingJSR 363 - The Answer to Life Science and the Internet of Everything
JSR 363 - The Answer to Life Science and the Internet of Everything
 
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docx
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docxDEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docx
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING JUBAIL UNIV.docx
 
Standards for the Future of Java Embedded (16:9)
Standards for the Future of Java Embedded (16:9)Standards for the Future of Java Embedded (16:9)
Standards for the Future of Java Embedded (16:9)
 
The OHF Legacy
The OHF LegacyThe OHF Legacy
The OHF Legacy
 
Standards for the Future of Java Embedded
Standards for the Future of Java EmbeddedStandards for the Future of Java Embedded
Standards for the Future of Java Embedded
 
Running Head WINDOWS AND LINUX 1WINDOWS AND LINUX12.docx
Running Head WINDOWS AND LINUX     1WINDOWS AND LINUX12.docxRunning Head WINDOWS AND LINUX     1WINDOWS AND LINUX12.docx
Running Head WINDOWS AND LINUX 1WINDOWS AND LINUX12.docx
 
Cigdem gencel persistence in poor estimating in software engineering- whys an...
Cigdem gencel persistence in poor estimating in software engineering- whys an...Cigdem gencel persistence in poor estimating in software engineering- whys an...
Cigdem gencel persistence in poor estimating in software engineering- whys an...
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
 
MOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODELMOBILE PHONE SENSORS META-MODEL
MOBILE PHONE SENSORS META-MODEL
 
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
 

Recently uploaded

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Recently uploaded (20)

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

Werner Weil: UCUM - epicenter 2010

  • 1.
  • 2. Trinity College, Dublin 08 – 11 June 2010 UCUM Unified Code for Units of Measure Werner Keil Agile Coach, emergn
  • 3. Our Goal Avoiding Interface and Arithmetic Errors
  • 4. Emphasis Most of today’s technologies including the current Java Language Releases lack support for common non-trivial Arithmetic problems like Unit Conversions.
  • 5. Summary Present Situation Historic IT Errors and Bugs Cause of Conversion Errors Proposed Changes Unit and Measure Support Type Safety Case Studies Demo Q&A
  • 6. What do these disasters have in common? Patriot MissileThe cause was an inaccurate calculation of the time since boot due to a computer arithmetic error. Ariane 5 ExplosionThe floating point number which a value was converted from had a value greater than what would be represented by a 16 bit signed integer.
  • 7. What do these disasters have in common? Mars Orbiter Preliminary findings indicate that one team used English units (e.g. inches, feet and pounds) while the other used metric units for a key spacecraft operation. NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency's team used the more conventional metric system for a key spacecraft operation This also underlines the added risk when 3rd party contractors are involved or projects are developed Offshore
  • 8. NASA “Star Wars” Experiment, 1983 23rd March 1983. Ronald Reagan announces SDI (or “Star Wars”): ground-based and space-based systems to protect the US from attack by strategic nuclear ballistic missiles.
  • 9. 1985 Mirror on underside of shuttle SDI Experiment: The Plan Big mountain in Hawaii
  • 10. 1985 SDI Experiment: What really happened
  • 12. NASA Mars Climate Orbiter, 1999
  • 13. Unit Tests did not find these Errors All previous example illustrate three categories of errors difficult to find through Unit Testing: Interface Errors (e.g. millisecond/second, radian/degree, meters/feet). Arithmetic Errors (e.g. overflow). Conversion Errors.
  • 14. Causes of Conversion Errors Ambiguity on the unit Gallon Dry / Gallon Liquid Gallon US / Gallon UK Day Sidereal / Day Calendar ... Wrong conversion factors: static final double PIXEL_TO_INCH = 1 / 72; double pixels = inches * PIXEL_TO_INCH
  • 15. Present Situation Java does not have strongly typed primitive types (like e.g. Ada language). For performance reasons most developer prefer primitive types over objects in their interface. Primitives type arguments often lead to name clashes (methods with the same signature)‏
  • 16. UCUM Unified Code for Units of Measure The Unified Code for Units of Measure is a code system intended to include all units of measures being contemporarily used in international science, engineering, and business. The purpose is to facilitate unambiguous electronic communication of quantities together with their units. The focus is on electronic communication, as opposed to communication between humans. A typical application of The Unified Code for Units of Measure are electronic data interchange (EDI) protocols, but there is nothing that prevents it from being used in other types of machine communication. How does it relate?
  • 17. UCUM Unified Code for Units of Measure The Unified Code for Units of Measure is inspired by and heavily based on ISO 2955-1983 ANSI X3.50-1986 HL7's extensions called ISO+
  • 18. JSR-275 Base Classes and Packages Namespace: javax.measure.* Only one interface and one abstract class Measurable<Q extends Quantity> (interface)‏ Measure<V, Q extends Quantity> (abstract class)‏ Three sub-packages Unit (holds the SI and NonSI units)‏ Quantity (holds dimensions mass, length)‏ Converter (holds unit converters)‏
  • 19. Units and Systems of Unit
  • 20. Unit Operations Results with Same Dimension Different Dimension Binary Operations Binary Operations plus (double) or (long) root(int) times(double) or (long) power(int) divide(double) or (long) times(Unit) compound(Unit) divide(Unit) Unary Operations inverse() © 2007-2009 Creative Arts & Technologies
  • 21. The King is Dead… Units of Measure API Namespace: org.unitsofmeasure.* Only interfaces and one abstract class Measurable<Q extends Quantity> (interface)‏ Measure<V, Q extends Quantity> (abstract class)‏ Two sub-packages Quantity (holds dimensions mass, length) Util (misc items and helpers)
  • 22. JSR-256 Mobile Sensor API Namespace: javax.microediton.sensor* Focusing on Sensors, but it got a minimalistic Unit API “in the closet” Unit Essentially an SI singleton holding relevant unit constants, too. ChannelInfoHolding name, accuracy, data type,measurement ranges, scale and unit MeasurementRangeRange of possible values from minimum to maximum
  • 24. JSR-256 Sensor Groups Context types categorize sensors into three groups: ambient, sensors measuring some ambient property of the environment device, sensors measuring properties related to the device user, sensors measuring some function of the user By using context types, it is possible to find, for example, user-related sensors for fitness, or ambient sensors for smart home controlling. Although the granularity of this level does not qualify the sensors very precisely, still in some cases it provides the way to make the distinction, for example, cf. air thermometer (ambient) / clinical thermometer (user).
  • 25. JSR-256 Quantity The quantity provides a more precise qualifier. The unit and the quantity has a close relation. Some quantities are listed in tables of Unit class. When the quantity and context type is known, it is often easy to guess the full purpose of the sensor. Some examples are given here: Quantity: electric_current + context type: ambient = sensor measuring electric current, amperemeter Quantity: catalytic_activity + contex type: ambient = sensor measuring catalytic activity
  • 26. OSGi Measurement Package Namespace: org.osgi.util.measurement SI only Unit API “in the closet” Unit Essentially an SI singleton holding relevant unit constants, too. MeasurementRepresents a value with an error, a unit and a time-stamp. StateGroups a state name, value and timestamp.
  • 27. Eclipse project UOMo One Unit Framework to Measure them All Namespace: org.eclipse.uomo.* Two main areas Static Type Safe Units of Measure Support Based on Units of Measure API On top of ICU4J, the Globalization standard at Eclipse and others (Android, GWT, Google Financial, etc.) UCUM Reference Implementation Successor to Eclipse OHF UCUM Bundle
  • 28. Case Study: Monetary System Monetary systems are not subject to the JSR, but this illustrates, how easily the framework can be extended to non physical or scientific quantities. Such extension can be valuable by leveraging the framework’s capabilities (formatting, conversion,…) and applying its usefulness beyond what e.g. java.util.Currency now has to offer.
  • 31. Trading Application Example What happens, if we use built in java.util.Currency and Standard JSP formats
  • 32. Money Demo (1) We’ll extend MoneyDemo to show fuel costs in Indian Rupees. First by adding a new currency to MonetarySystem. // Use currency not defined as constant (Indian Rupee). public static final DerivedUnit<Money> INR= monetary(new Currency(„INR") ); Then add this line to MoneyDemo.(also change static import to MonetarySystem.*; ) UnitFormat.getInstance().label(INR, „Rp");
  • 33. Money Demo (2) Next set the Exchange Rate for Rp. ((Currency) INR).setExchangeRate(0.022); // 1.0Rp = ~0.022 $ Note, the explicit cast is required here, because getUnits() in SystemOfUnits currently requires a neutral <?> generic collection type.
  • 34. Money Demo (3) Then we add the following line to the “Display cost.” section of MoneyDemo System.out.println("Trip cost = " + tripCost + " (" + tripCost.to(INR) + ")"); Resulting in the additional output: Trip cost = 87.50 $ (3977.26 Rp)
  • 35. Links JCP – Java Community Process http://www.jcp.org UCUM http://www.unitsofmeasure.org Units of Measure API http://www.javaforge.com/project/uom
  • 36. Questions werner@emergn.com Or info@catmedia.us Twitter: @wernerkeil