SlideShare a Scribd company logo
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
The First IoT JSR: Units of Measurement
JSR-363 [TBW-1406]
Leonardo Lima & Otávio Santana
@leomrlima & @otaviojava & @UnitAPI
https://www.jcp.org/en/jsr/detail?id=363
http://unitsofmeasurement.github.io
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
The First IoT JSR: Units of Measurement
Leonardo Lima
•Computer engineer, server & embedded SW developer
•From São Paulo, Brasil, now in Austin, TX
•CTO at
•Spec Lead – JSR363 – Units of Measurement
•V2COM’s Representative at JCP Executive Committee
[www.linkedin.com/in/leomrlima]
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
The First IoT JSR: Units of Measurement
Otávio Santana
•Software engineer, Tomitribe
•From Salvador, Brazil
•Java Champion, SouJava JUG Leader
•Apache and OpenJDK Committer
•JSR 363 Expert Group member
•Representative at JCP EC for SouJava
[about.me/otaviojava]
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What are Units of Measurement?
10,363 ??????
A Measurement
A Unit
San Jose
São Paulo
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What is the problem, in code?
int distance = 10_363; //in ???
float speed = airplane.getSpeed(); //in ???
System.out.println(“TTD: “ + (distance/speed) + “
hours”);
10,363 ??????
A Measurement
A Unit
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
LEARNING FROM THE PAST…
Some examples of how things can go wrong…
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Some real-life mishaps…
NASA “Star Wars” Initiative, 1985
Sea Level
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
2001: Escape of the 250Kg tortoise
Los Angeles Zoo lent Clarence, a 250-kilogram, 75-
year-old Galapagos tortoise, to the Exotic Animal
Training and Management Program at Moorpark
College in Moorpark CA.
The first night in his new home, Clarence wrecked it:
“He just pushed one of the fence poles right
over,” said Moorpark's Chuck Brinkman.
The L.A. Zoo warned that Clarence was big, and
needed an enclosure for an animal that “weighs
in at about 250”, so that's what the college
built.
Unfortunately, they thought the zoo meant 250
pounds, so the enclosure wasn't adequate for
holding a 250-kilogram (552 lbs) beast.
Clarence
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Why do we need a specification?
There are no specifications or standards for handling units in Java.
The current solution is to use primitives, that don’t provide any Type
Safety.
The errors are difficult to find using unit testing:
Interface and Internationalization (e.g. radian/degree, meters/feet);
Arithmetic operations (e.g. overflow);
Conversion between units (e.g. from same domain);
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What is JSR-363?
Interfaces and abstract classes supporting unit operations including:
Checking of unit compatibility;
Expression of measurement in various units; and
Arithmetic operations on units.
Concrete classes implementing standard unit types (base, derived)
and unit conversion.
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
CORE THEORY AND CONCEPTS
Some Basic Science behind the API
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What is a Unit?
c. (a) Any determinate quantity, dimension, or magnitude adopted as a
basis or standard of measurement for other quantities of the same
kind and in terms of which their magnitude is calculated or
expressed.
Oxford English Dictionary
Or … A well defined standard we all know?
Unit Definition
Second The duration of 9,192,631,770 periods of the radiation corresponding to the
transition between the two hyperfine levels of the ground state of caesium 133
atom
Kilogram The mass of the international prototype kilogram [a very special lump of metal]
metre The distance travelled by light in a vacuum in
3.3356409519815204957557671447492e-9 seconds
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
A Standard Measurement …
“The nice thing about standards is that you have so many to choose
from.”
Andrew S. Tanenbaum,
Computer Networks 2nd ed., p. 254
Foot
Mile
Yard Chain
Fathom
Furlong
InchNautical Mile
Statute Mile
astronomical unit (AU)
Light year
Parsec(or meter)
Passus (roman)
Hand
ångström
Scots/Welsh/English Mile
Metre fermi micron
Thou (or mil)League
rod/perch/pole
nail
Barleycorn
link
ell Cubitfinger
palm
Poppyseed
Milli Centi Kilo
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Dimension
Allows analysis of a quantity by the rational powers of the 7
fundamental dimensions (quantities are compatible when they have
the same dimensions):
length (L), mass (M), time (T), electric charge (I), absolute
temperature (Θ), amount of substance (N) and luminous intensity (J)
Examples:
Speed = length/time - it’s dimensions are L=1,T=-1 (rest 0) (e.g. metre/second - ms-1)
Acceleration is speed/time (m/s/s or ms-2) L=1, T=-2
Force is mass x acceleration M x ((length/time)/time) or M=1, L=1, T=-2
Molar Entropy: M=1 L=2 T=−2 Θ=−1 N=−1 (trust me!)
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Quantity
A physical attribute of a thing. Something that can be measured and
has units. Compatible quantities have the same dimension…
Examples:
• Time
• Length
• Speed
• Amount of Substance
• Luminous Intensity
• Volume
• Mass
• Force
• Power
• Electrical Current
• Magnetic Flux Density
• Volumetric Flow Rate
• Fuel Economy*
• Percentage
• Eggs per carton
• Sheep per hour
• Bits and bytes …
… ∞
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What is the problem, in code?
int distance = 10_363; //in ???
float speed = airplane.getSpeed(); //in ???
System.out.println(“TTD: “ + (distance/speed) + “
hours”);
10,363 ??????
A Measurement
A Unit
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
What is JSR-363, in code?
Airplane airplane = new Airplane(“A380”);
QuantityFactory<Length> lengthFactory =
provider.getQuantityFactory(Length.class);
Quantity<Length> distance = lengthFactory.create(10_363,
KILO(METRE));
Quantity<Speed> airplaneSpeed = airplane.getSpeed();
Quantity<Time> timeToDest = distance.divide(airplaneSpeed)
.asType(Time.class);
System.out.println(“TTD: “ + timeToDest.to(HOUR));
TTD: 11.033853606779548 h
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
JSR-363 in IoT
IoT is all about measurements (and timestamps and sensor ID). Before
JSR-363, we’d code against primitives: Double, Float, BigDecimal.
With JSR-363, you can make your API typesafe and avoid bugs due to
lack of consistency or misundertandings.
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
JSR-363 in IoT
Before:
After:
public class ThermometerReading extends Measurement {
private Float temperature;
}
public class ThermometerReading extends Measurement {
private Quantity<Temperature> temperature;
}
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Who is going to use JSR-363?
Java developers who work with physical quantities need to handle
measurements in their programs.
Inadequate models of physical measurements can lead to significant
programmatic errors.
Platform providers and developers can provide and use a better
defined API
Embedded developers can have less error-prone, more self-
documented code
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
JSR-363 timeline
March 11, 2014: Submitted
April 7, 2014: Creation approved
Dec 2014 – Jan 2015: Early Draft (approved)
Nov 2015 – Jan 2016: Public Review (approved)
Q3/2016 : Final Draft
Q3/2016: Final Release
@leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne
Links to JSR-363
Public mailing list(s) and/or forum(s)
Units-Dev on Google Groups
Units-Users on Google Groups
The JSR page on JCP.org…
And two other “JSR project websites”:
Main project website is on GitHub (unitsofmeasurement)
Java.net site is used for JIRA (deprecated, use GitHub!)
And you can get sample code at our GitHub.
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
@YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne

More Related Content

Similar to JSR363 - Devoxx US

Building Deep Learning Applications with TensorFlow and Amazon SageMaker
Building Deep Learning Applications with TensorFlow and Amazon SageMakerBuilding Deep Learning Applications with TensorFlow and Amazon SageMaker
Building Deep Learning Applications with TensorFlow and Amazon SageMaker
Amazon Web Services
 
Build Deep Learning Applications with TensorFlow and Amazon SageMaker
Build Deep Learning Applications with TensorFlow and Amazon SageMakerBuild Deep Learning Applications with TensorFlow and Amazon SageMaker
Build Deep Learning Applications with TensorFlow and Amazon SageMaker
Amazon Web Services
 
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
InfluxData
 
Workshop: Build Deep Learning Applications with TensorFlow and SageMaker
Workshop: Build Deep Learning Applications with TensorFlow and SageMakerWorkshop: Build Deep Learning Applications with TensorFlow and SageMaker
Workshop: Build Deep Learning Applications with TensorFlow and SageMaker
Amazon Web Services
 
Model-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentModel-based programming and AI-assisted software development
Model-based programming and AI-assisted software development
Eficode
 
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
Amazon Web Services
 
Build Deep Learning Applications with TensorFlow & SageMaker
Build Deep Learning Applications with TensorFlow & SageMakerBuild Deep Learning Applications with TensorFlow & SageMaker
Build Deep Learning Applications with TensorFlow & SageMaker
Amazon Web Services
 
Java ME API Next
 Java ME API Next Java ME API Next
Java ME API Next
Otávio Santana
 
Pebank java handsout
Pebank java handsoutPebank java handsout
Pebank java handsout
PE-BANK
 
Monitoring Clojure Applications with Prometheus
Monitoring Clojure Applications with PrometheusMonitoring Clojure Applications with Prometheus
Monitoring Clojure Applications with Prometheus
Joachim Draeger
 
Java 8
Java 8Java 8
Java 8
Raghda Salah
 
Basic Tutorial for Robotic Arm
Basic Tutorial for Robotic ArmBasic Tutorial for Robotic Arm
Basic Tutorial for Robotic Arm
Yu Wei Chen
 
OM-JSON - a JSON implementation of O&M
OM-JSON - a JSON implementation of O&MOM-JSON - a JSON implementation of O&M
OM-JSON - a JSON implementation of O&M
Simon Cox
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
skilljiolms
 
Analysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligenceAnalysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligence
anishahmadgrd222
 
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlowAWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
Amazon Web Services
 
Observability: Beyond the Three Pillars with Spring
Observability: Beyond the Three Pillars with SpringObservability: Beyond the Three Pillars with Spring
Observability: Beyond the Three Pillars with Spring
VMware Tanzu
 
And Then There Are Algorithms
And Then There Are AlgorithmsAnd Then There Are Algorithms
And Then There Are Algorithms
InfluxData
 
(Py)testing the Limits of Machine Learning
(Py)testing the Limits of Machine Learning(Py)testing the Limits of Machine Learning
(Py)testing the Limits of Machine Learning
Rebecca Bilbro
 
Werner Weil: UCUM - epicenter 2010
Werner Weil: UCUM - epicenter 2010Werner Weil: UCUM - epicenter 2010
Werner Weil: UCUM - epicenter 2010
IrishDev.com
 

Similar to JSR363 - Devoxx US (20)

Building Deep Learning Applications with TensorFlow and Amazon SageMaker
Building Deep Learning Applications with TensorFlow and Amazon SageMakerBuilding Deep Learning Applications with TensorFlow and Amazon SageMaker
Building Deep Learning Applications with TensorFlow and Amazon SageMaker
 
Build Deep Learning Applications with TensorFlow and Amazon SageMaker
Build Deep Learning Applications with TensorFlow and Amazon SageMakerBuild Deep Learning Applications with TensorFlow and Amazon SageMaker
Build Deep Learning Applications with TensorFlow and Amazon SageMaker
 
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
 
Workshop: Build Deep Learning Applications with TensorFlow and SageMaker
Workshop: Build Deep Learning Applications with TensorFlow and SageMakerWorkshop: Build Deep Learning Applications with TensorFlow and SageMaker
Workshop: Build Deep Learning Applications with TensorFlow and SageMaker
 
Model-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentModel-based programming and AI-assisted software development
Model-based programming and AI-assisted software development
 
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
Build Deep Learning Applications with TensorFlow & SageMaker: Machine Learnin...
 
Build Deep Learning Applications with TensorFlow & SageMaker
Build Deep Learning Applications with TensorFlow & SageMakerBuild Deep Learning Applications with TensorFlow & SageMaker
Build Deep Learning Applications with TensorFlow & SageMaker
 
Java ME API Next
 Java ME API Next Java ME API Next
Java ME API Next
 
Pebank java handsout
Pebank java handsoutPebank java handsout
Pebank java handsout
 
Monitoring Clojure Applications with Prometheus
Monitoring Clojure Applications with PrometheusMonitoring Clojure Applications with Prometheus
Monitoring Clojure Applications with Prometheus
 
Java 8
Java 8Java 8
Java 8
 
Basic Tutorial for Robotic Arm
Basic Tutorial for Robotic ArmBasic Tutorial for Robotic Arm
Basic Tutorial for Robotic Arm
 
OM-JSON - a JSON implementation of O&M
OM-JSON - a JSON implementation of O&MOM-JSON - a JSON implementation of O&M
OM-JSON - a JSON implementation of O&M
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
 
Analysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligenceAnalysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligence
 
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlowAWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow
 
Observability: Beyond the Three Pillars with Spring
Observability: Beyond the Three Pillars with SpringObservability: Beyond the Three Pillars with Spring
Observability: Beyond the Three Pillars with Spring
 
And Then There Are Algorithms
And Then There Are AlgorithmsAnd Then There Are Algorithms
And Then There Are Algorithms
 
(Py)testing the Limits of Machine Learning
(Py)testing the Limits of Machine Learning(Py)testing the Limits of Machine Learning
(Py)testing the Limits of Machine Learning
 
Werner Weil: UCUM - epicenter 2010
Werner Weil: UCUM - epicenter 2010Werner Weil: UCUM - epicenter 2010
Werner Weil: UCUM - epicenter 2010
 

More from Leonardo De Moura Rocha Lima

Top 9 mistakes to avoid when developing with NoSQL
Top 9 mistakes to avoid when developing with NoSQLTop 9 mistakes to avoid when developing with NoSQL
Top 9 mistakes to avoid when developing with NoSQL
Leonardo De Moura Rocha Lima
 
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
Leonardo De Moura Rocha Lima
 
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
Leonardo De Moura Rocha Lima
 
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
Leonardo De Moura Rocha Lima
 
Java & IoT
Java & IoTJava & IoT
Collections.compare(JDK, Eclipse, Guava, Apache...);
Collections.compare(JDK, Eclipse, Guava, Apache...);Collections.compare(JDK, Eclipse, Guava, Apache...);
Collections.compare(JDK, Eclipse, Guava, Apache...);
Leonardo De Moura Rocha Lima
 
IoT Security: Cases and Methods
IoT Security: Cases and MethodsIoT Security: Cases and Methods
IoT Security: Cases and Methods
Leonardo De Moura Rocha Lima
 
IoT Security: Cases and Methods [CON5446]
IoT Security: Cases and Methods [CON5446]IoT Security: Cases and Methods [CON5446]
IoT Security: Cases and Methods [CON5446]
Leonardo De Moura Rocha Lima
 
Secure IoT with Blockchain: Fad or Reality? [BOF5490]
Secure IoT with Blockchain: Fad or Reality? [BOF5490]Secure IoT with Blockchain: Fad or Reality? [BOF5490]
Secure IoT with Blockchain: Fad or Reality? [BOF5490]
Leonardo De Moura Rocha Lima
 
Building a Reliable Remote Communication Device with Java ME8 [CON2285]
Building a Reliable Remote Communication Device with Java ME8 [CON2285]Building a Reliable Remote Communication Device with Java ME8 [CON2285]
Building a Reliable Remote Communication Device with Java ME8 [CON2285]
Leonardo De Moura Rocha Lima
 
A internet das coisas e o futuro - Java ME 8 e adiante!
A internet das coisas e o futuro - Java ME 8 e adiante!A internet das coisas e o futuro - Java ME 8 e adiante!
A internet das coisas e o futuro - Java ME 8 e adiante!
Leonardo De Moura Rocha Lima
 

More from Leonardo De Moura Rocha Lima (11)

Top 9 mistakes to avoid when developing with NoSQL
Top 9 mistakes to avoid when developing with NoSQLTop 9 mistakes to avoid when developing with NoSQL
Top 9 mistakes to avoid when developing with NoSQL
 
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
 
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
JavaOne 2017 - Collections.compare:JDK, Eclipse, Guava, Apache... [CON1754]
 
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
 
Java & IoT
Java & IoTJava & IoT
Java & IoT
 
Collections.compare(JDK, Eclipse, Guava, Apache...);
Collections.compare(JDK, Eclipse, Guava, Apache...);Collections.compare(JDK, Eclipse, Guava, Apache...);
Collections.compare(JDK, Eclipse, Guava, Apache...);
 
IoT Security: Cases and Methods
IoT Security: Cases and MethodsIoT Security: Cases and Methods
IoT Security: Cases and Methods
 
IoT Security: Cases and Methods [CON5446]
IoT Security: Cases and Methods [CON5446]IoT Security: Cases and Methods [CON5446]
IoT Security: Cases and Methods [CON5446]
 
Secure IoT with Blockchain: Fad or Reality? [BOF5490]
Secure IoT with Blockchain: Fad or Reality? [BOF5490]Secure IoT with Blockchain: Fad or Reality? [BOF5490]
Secure IoT with Blockchain: Fad or Reality? [BOF5490]
 
Building a Reliable Remote Communication Device with Java ME8 [CON2285]
Building a Reliable Remote Communication Device with Java ME8 [CON2285]Building a Reliable Remote Communication Device with Java ME8 [CON2285]
Building a Reliable Remote Communication Device with Java ME8 [CON2285]
 
A internet das coisas e o futuro - Java ME 8 e adiante!
A internet das coisas e o futuro - Java ME 8 e adiante!A internet das coisas e o futuro - Java ME 8 e adiante!
A internet das coisas e o futuro - Java ME 8 e adiante!
 

Recently uploaded

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 

Recently uploaded (20)

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 

JSR363 - Devoxx US

  • 1. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne The First IoT JSR: Units of Measurement JSR-363 [TBW-1406] Leonardo Lima & Otávio Santana @leomrlima & @otaviojava & @UnitAPI https://www.jcp.org/en/jsr/detail?id=363 http://unitsofmeasurement.github.io
  • 2. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne The First IoT JSR: Units of Measurement Leonardo Lima •Computer engineer, server & embedded SW developer •From São Paulo, Brasil, now in Austin, TX •CTO at •Spec Lead – JSR363 – Units of Measurement •V2COM’s Representative at JCP Executive Committee [www.linkedin.com/in/leomrlima]
  • 3. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne The First IoT JSR: Units of Measurement Otávio Santana •Software engineer, Tomitribe •From Salvador, Brazil •Java Champion, SouJava JUG Leader •Apache and OpenJDK Committer •JSR 363 Expert Group member •Representative at JCP EC for SouJava [about.me/otaviojava]
  • 4. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What are Units of Measurement? 10,363 ?????? A Measurement A Unit San Jose São Paulo
  • 5. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What is the problem, in code? int distance = 10_363; //in ??? float speed = airplane.getSpeed(); //in ??? System.out.println(“TTD: “ + (distance/speed) + “ hours”); 10,363 ?????? A Measurement A Unit
  • 6. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne LEARNING FROM THE PAST… Some examples of how things can go wrong…
  • 7. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Some real-life mishaps… NASA “Star Wars” Initiative, 1985 Sea Level
  • 8. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne 2001: Escape of the 250Kg tortoise Los Angeles Zoo lent Clarence, a 250-kilogram, 75- year-old Galapagos tortoise, to the Exotic Animal Training and Management Program at Moorpark College in Moorpark CA. The first night in his new home, Clarence wrecked it: “He just pushed one of the fence poles right over,” said Moorpark's Chuck Brinkman. The L.A. Zoo warned that Clarence was big, and needed an enclosure for an animal that “weighs in at about 250”, so that's what the college built. Unfortunately, they thought the zoo meant 250 pounds, so the enclosure wasn't adequate for holding a 250-kilogram (552 lbs) beast. Clarence
  • 9. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Why do we need a specification? There are no specifications or standards for handling units in Java. The current solution is to use primitives, that don’t provide any Type Safety. The errors are difficult to find using unit testing: Interface and Internationalization (e.g. radian/degree, meters/feet); Arithmetic operations (e.g. overflow); Conversion between units (e.g. from same domain);
  • 10. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What is JSR-363? Interfaces and abstract classes supporting unit operations including: Checking of unit compatibility; Expression of measurement in various units; and Arithmetic operations on units. Concrete classes implementing standard unit types (base, derived) and unit conversion.
  • 11. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne CORE THEORY AND CONCEPTS Some Basic Science behind the API
  • 12. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What is a Unit? c. (a) Any determinate quantity, dimension, or magnitude adopted as a basis or standard of measurement for other quantities of the same kind and in terms of which their magnitude is calculated or expressed. Oxford English Dictionary Or … A well defined standard we all know? Unit Definition Second The duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of caesium 133 atom Kilogram The mass of the international prototype kilogram [a very special lump of metal] metre The distance travelled by light in a vacuum in 3.3356409519815204957557671447492e-9 seconds
  • 13. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne A Standard Measurement … “The nice thing about standards is that you have so many to choose from.” Andrew S. Tanenbaum, Computer Networks 2nd ed., p. 254 Foot Mile Yard Chain Fathom Furlong InchNautical Mile Statute Mile astronomical unit (AU) Light year Parsec(or meter) Passus (roman) Hand ångström Scots/Welsh/English Mile Metre fermi micron Thou (or mil)League rod/perch/pole nail Barleycorn link ell Cubitfinger palm Poppyseed Milli Centi Kilo
  • 14. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Dimension Allows analysis of a quantity by the rational powers of the 7 fundamental dimensions (quantities are compatible when they have the same dimensions): length (L), mass (M), time (T), electric charge (I), absolute temperature (Θ), amount of substance (N) and luminous intensity (J) Examples: Speed = length/time - it’s dimensions are L=1,T=-1 (rest 0) (e.g. metre/second - ms-1) Acceleration is speed/time (m/s/s or ms-2) L=1, T=-2 Force is mass x acceleration M x ((length/time)/time) or M=1, L=1, T=-2 Molar Entropy: M=1 L=2 T=−2 Θ=−1 N=−1 (trust me!)
  • 15. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Quantity A physical attribute of a thing. Something that can be measured and has units. Compatible quantities have the same dimension… Examples: • Time • Length • Speed • Amount of Substance • Luminous Intensity • Volume • Mass • Force • Power • Electrical Current • Magnetic Flux Density • Volumetric Flow Rate • Fuel Economy* • Percentage • Eggs per carton • Sheep per hour • Bits and bytes … … ∞
  • 16. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
  • 17. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What is the problem, in code? int distance = 10_363; //in ??? float speed = airplane.getSpeed(); //in ??? System.out.println(“TTD: “ + (distance/speed) + “ hours”); 10,363 ?????? A Measurement A Unit
  • 18. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne What is JSR-363, in code? Airplane airplane = new Airplane(“A380”); QuantityFactory<Length> lengthFactory = provider.getQuantityFactory(Length.class); Quantity<Length> distance = lengthFactory.create(10_363, KILO(METRE)); Quantity<Speed> airplaneSpeed = airplane.getSpeed(); Quantity<Time> timeToDest = distance.divide(airplaneSpeed) .asType(Time.class); System.out.println(“TTD: “ + timeToDest.to(HOUR)); TTD: 11.033853606779548 h
  • 19. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne JSR-363 in IoT IoT is all about measurements (and timestamps and sensor ID). Before JSR-363, we’d code against primitives: Double, Float, BigDecimal. With JSR-363, you can make your API typesafe and avoid bugs due to lack of consistency or misundertandings.
  • 20. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne JSR-363 in IoT Before: After: public class ThermometerReading extends Measurement { private Float temperature; } public class ThermometerReading extends Measurement { private Quantity<Temperature> temperature; }
  • 21. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Who is going to use JSR-363? Java developers who work with physical quantities need to handle measurements in their programs. Inadequate models of physical measurements can lead to significant programmatic errors. Platform providers and developers can provide and use a better defined API Embedded developers can have less error-prone, more self- documented code
  • 22. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
  • 23. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne JSR-363 timeline March 11, 2014: Submitted April 7, 2014: Creation approved Dec 2014 – Jan 2015: Early Draft (approved) Nov 2015 – Jan 2016: Public Review (approved) Q3/2016 : Final Draft Q3/2016: Final Release
  • 24. @leomrlima & @otaviojava & @UnitAPI#JSR363JavaOne Links to JSR-363 Public mailing list(s) and/or forum(s) Units-Dev on Google Groups Units-Users on Google Groups The JSR page on JCP.org… And two other “JSR project websites”: Main project website is on GitHub (unitsofmeasurement) Java.net site is used for JIRA (deprecated, use GitHub!) And you can get sample code at our GitHub.
  • 25. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne
  • 26. @YourTwitterHandle#DVXFR14{session hashtag} @leomrlima & @otaviojava & @wernerkeil#JSR363JavaOne