SlideShare a Scribd company logo
1 of 34
JSR 354
Java Money and Currency API


             Werner Keil
    Build Manager, DevOps Expert,
             Agile Coach
             Maersk Line
         EG Member, JSR 354
             @wernerkeil
Werner Keil - Bio
 •   Consultant – Coach
 •   Creative Cosmopolitan
 •   Open Source Evangelist
 •   Software Architect
 •   Java Godfather
 •   JCP Executive Committee Member
 •   Eclipse UOMo Project Lead
 •   DevOps Guy

                                      2
Show me the Money!
Agenda
 •   History
 •   Motivation
 •   The JSR
 •   Virtual Currencies
 •   Currency Exchange
 •   Demos
 •   Q&A


                          4
History




          5
Earlier Approaches
 Martin Fowler:
 A large proportion of the computers in this world manipulate money, so it's always
 puzzled me that money isn't actually a first class data type in any mainstream
 programming language.The lack of a type causes problems, the most obvious
 surrounding currencies…




 see http://martinfowler.com/eaaCatalog/money.html
                                                                                      6
Earlier Approaches (2)
 Eric Evans – Time and Money:
 On project after project, software developers have to reinvent the wheel, creating
 objects for simple recurring concepts such as "money" and "currency". Although
 most languages have a "date" or "time" object, these are rudimentary, and do not
 cover many needs, such as recurring sequences of time, durations of time, or
 intervals of time. …
 see http://timeandmoney.sourceforge.net/
 To be quite frank, their code isn‘t more than an academic POC, factories
 called dollars() or euros() are useless in real globally deployed frameworks,
 but he made a good point.
                                                                                      7
MoneyDance




             8
Motivation
Summary
 •   This JSR will provide a          money and currency API for Java,
     targeted at all users            of currencies      and monetary
     amounts in Java.
 •   The API will provide support for standard ISO-4217 and Custom
     (e.g. Virtual) currencies, as well as representation of a monetary amount.

 •   It willsupport currency arithmetic, even across different currencies, and
     foreign currency exchange.
 •   Additionally, implementation details surrounding serialization
     and thread safety       are to be considered
                                                                                  10
Why is it needed?
 •   Monetary values are a key feature to many applications.
 •   The existing java.util.Currency class is strictly a structure usedfor
     representing ISO-4217 standard currencies.
 •   No standard value type to represent a monetary amount.
 •   No support for currency arithmetic or conversion




                                                                             11
Challenges
 •   Keep it simple – Remember the most common use case
     •Adding currency values e.g. in an e-commerce app.
 •   Performance
     •How to support low latency applications, such as High Frequency
      Trading apps.
 •   Precision
     •There can potentially be differing precisions specified for arithmetic,
      currency exchange and formatting

                                                                                12
Challenges (2)
 •   Formatting
     •Requirement should be to use existing Number Formats.
     •However there is no existing format representing for example Indian
      Rupees:
      which might look something like this: 12,34,00,000
     •Natural language support for non-decimal valuations for example
         •
        Lakhs
         •
        Crores
         •
        1 Lakh = 100,000
         •
        1 Crore = 100 Lakh                                                  13
Challenges (3)
 •   Formatting
     •12,34,56,000.21 is written
      12 Crore, 34 Lakh, 56 Thousand Rupees and 21 Paise
 •   Support for non-standard rounding modes




                                                           14
Non-standard Rounding Modes
 •   It is a big world, and each country has its regulations and cultural nuances
     for expressing currencies in natural language, rounding policies, groupings,
     etc.
     • For example, in Argentina rounding is prescribed for the third digit after
       the decimal point:
         If the third digit is 2 or less, change it to 0 or drop it.
         If the third digit is between 3 and 7, change it to 5.
         If the third digit is 8 or more, add one to the second digit and drop the third digit or change it
         to 0.




                                                                                                              15
Non-standard Rounding – Argentina
 Argentina Rounding Examples

 Original Number   Rounded       Notes
 123.452           123.45        Third digit<3 round down
 123.456           123.455       3<=third digit<=7 change to 5
 123.459           123.46        Third digit>=8 round up



 Switzerland uses a similar rounding strategy.


                                                                 16
Risks
 Plan – “Money and Currency” is a formidable and dynamic category with
 regional dependencies, requiring programmers, business users, international
 accountants, and attorneys.
 Risk – Incomplete or outdated spec
 Mitigation – Resulting API should be flexible, let application developer
 change implementation as needed.




                                                                               17
Risks (2)
 Plan – There is also a Java dependency on JDK NumberFormat.
 Risk – NumberFormat may require coordinated modifications.
 Mitigation – Coordinate with JDK release;
 Supply NumberFormats and similar classes that augment JDK content.
 Plan – There is also a Java dependency on JDK NumberFormat.
 Risk – NumberFormat may require coordinated modifications.
 Mitigation – Coordinate with JDK release;
 Supply NumberFormats and similar classes that augment JDK content.

                                                                      18
The JSR
Expert Group Members
 •   Credit Suisse
 •   Goldman Sachs
 •   Stephen Colebourne
 •   Ben Evans
 •   Werner Keil
 •   Bob Lee




                          20
Supporting the JSR
 •   Credit Suisse
 •   Caxton Associates
 •   Goldman Sachs
 •   JP Morgan/Chase
 •   London Java Community
 •   Stephen Colebourne
 •   Werner Keil


                             21
Schedule
 •       Targeted to Java 9
 •       Aiming at Java ME/Embedded 8 or 9
     •    Following the EC Merge and Standard/Embedded harmonization, no JSR should be SE/EE or
          ME only, with very few, specialized exceptions. Money is so important, and has almost no
          legacy in the JDK except java.util.Currency, that it should be supported by ALL POSSIBLE
          platforms, except maybe JavaCard for now.

 •       With back-port to previous versions still supported and in relevant use




                                                                                                     22
Virtual Currencies




                     23
Facebook Credits
 What are Facebook Credits?
 • Facebook Credits are a virtual currency you can use to buy virtual goods
 in any games or apps of the Facebook platform that accept payments. You
 can purchase Facebook Credits directly from within an app using your
 credit card, PayPal, mobile phone and many other local payment methods.

 ► Hence any such purchase is practically a conversion,
       similar to if you buy a foreign currency when
       travelling abroad☺

                                                                              24
Top 10 Video Game Currencies
 1. Gold
 2. Gil
 3. Rupees (not Indian;-)
 4. Credits
 5. Gold Rings
 6. Hearts
 7. Zenny
 8. Potch
 9. Munny
 10.Nuyen                      25
World Currencies




                   26
Currency Exchange
Currency Conversion (JScience)




                                 28
Online Currency Conversion Example




                                     29
Trading Application Example
    What happens, if we use built in java.util.Currency and Standard
                             JSP formats




                                                                       30
Demos
Q&A
Links

   • The JSR: http://jcp.org/en/jsr/summary?
     id=354

   • java.net Project:
     http://java.net/projects/javamoney/

   • GitHub Project:
     http://github.com/JavaMoney/
Links (2)

   • Eclipse UOMo:
     http://www.eclipse.org/uomo/

   • JScience:
     http://www.jscience.org

   • JodaMoney:
     http://joda-money.sourceforge.net/

More Related Content

Similar to JSR 354 - Money and Currency API for Java

Java in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MJava in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MMarkus Eisele
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Martijn Verburg
 
How do we drive tech changes
How do we drive tech changesHow do we drive tech changes
How do we drive tech changesJaewoo Ahn
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Martijn Verburg
 
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...Databricks
 
JavaOne Latin America Participate in Shaping Java's Future
JavaOne Latin America Participate in Shaping Java's Future JavaOne Latin America Participate in Shaping Java's Future
JavaOne Latin America Participate in Shaping Java's Future Heather VanCura
 
Case Study of Financial Web System Development and Operations with Oracle Web...
Case Study of Financial Web System Development and Operations with Oracle Web...Case Study of Financial Web System Development and Operations with Oracle Web...
Case Study of Financial Web System Development and Operations with Oracle Web...Hirofumi Iwasaki
 
MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014myappconverter
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedAlexander Makarov
 
Go for the Money - JSR 354
Go for the Money - JSR 354Go for the Money - JSR 354
Go for the Money - JSR 354Anatole Tresch
 
Groovy On The Trading Desk
Groovy On The Trading DeskGroovy On The Trading Desk
Groovy On The Trading DeskJonathan Felch
 
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone GapCreating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone GapFITC
 
Java, now and forever
Java, now and foreverJava, now and forever
Java, now and foreverThang Bui
 
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptxGauravGamer2
 
Java EE - Finest basics
Java EE - Finest basicsJava EE - Finest basics
Java EE - Finest basicsEdward Ndukui
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
Future of XML Payment Management: Challenges, Evolution and Benefits March 2...
Future of XML Payment Management: Challenges, Evolution and Benefits  March 2...Future of XML Payment Management: Challenges, Evolution and Benefits  March 2...
Future of XML Payment Management: Challenges, Evolution and Benefits March 2...XMLdation Ltd
 

Similar to JSR 354 - Money and Currency API for Java (20)

Java in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/MJava in the age of containers - JUG Frankfurt/M
Java in the age of containers - JUG Frankfurt/M
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
 
How do we drive tech changes
How do we drive tech changesHow do we drive tech changes
How do we drive tech changes
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
 
JavaOne Latin America Participate in Shaping Java's Future
JavaOne Latin America Participate in Shaping Java's Future JavaOne Latin America Participate in Shaping Java's Future
JavaOne Latin America Participate in Shaping Java's Future
 
Case Study of Financial Web System Development and Operations with Oracle Web...
Case Study of Financial Web System Development and Operations with Oracle Web...Case Study of Financial Web System Development and Operations with Oracle Web...
Case Study of Financial Web System Development and Operations with Oracle Web...
 
MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 
Go for the Money - JSR 354
Go for the Money - JSR 354Go for the Money - JSR 354
Go for the Money - JSR 354
 
Groovy On The Trading Desk
Groovy On The Trading DeskGroovy On The Trading Desk
Groovy On The Trading Desk
 
Moneyandcurrency2
Moneyandcurrency2Moneyandcurrency2
Moneyandcurrency2
 
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone GapCreating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
 
Java, now and forever
Java, now and foreverJava, now and forever
Java, now and forever
 
slides-students-C03.pdf
slides-students-C03.pdfslides-students-C03.pdf
slides-students-C03.pdf
 
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
 
Java EE - Finest basics
Java EE - Finest basicsJava EE - Finest basics
Java EE - Finest basics
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
Future of XML Payment Management: Challenges, Evolution and Benefits March 2...
Future of XML Payment Management: Challenges, Evolution and Benefits  March 2...Future of XML Payment Management: Challenges, Evolution and Benefits  March 2...
Future of XML Payment Management: Challenges, Evolution and Benefits March 2...
 

More from Werner Keil

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Werner Keil
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021Werner Keil
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualWerner Keil
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualWerner Keil
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRWerner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020Werner Keil
 
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Werner Keil
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayWerner Keil
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesWerner Keil
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesWerner Keil
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichWerner Keil
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Werner Keil
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Werner Keil
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Werner Keil
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudWerner Keil
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartWerner Keil
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgWerner Keil
 
JSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short OverviewJSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short OverviewWerner Keil
 

More from Werner Keil (20)

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
 
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG Munich
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the Cloud
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ Stuttgart
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
 
JSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short OverviewJSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short Overview
 

Recently uploaded

fca-bsps-decision-letter-redacted (1).pdf
fca-bsps-decision-letter-redacted (1).pdffca-bsps-decision-letter-redacted (1).pdf
fca-bsps-decision-letter-redacted (1).pdfHenry Tapper
 
Andheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot ModelsAndheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot Modelshematsharma006
 
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130  Available With RoomVIP Kolkata Call Girl Serampore 👉 8250192130  Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Roomdivyansh0kumar0
 
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...makika9823
 
SBP-Market-Operations and market managment
SBP-Market-Operations and market managmentSBP-Market-Operations and market managment
SBP-Market-Operations and market managmentfactical
 
Governor Olli Rehn: Dialling back monetary restraint
Governor Olli Rehn: Dialling back monetary restraintGovernor Olli Rehn: Dialling back monetary restraint
Governor Olli Rehn: Dialling back monetary restraintSuomen Pankki
 
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...yordanosyohannes2
 
Unveiling the Top Chartered Accountants in India and Their Staggering Net Worth
Unveiling the Top Chartered Accountants in India and Their Staggering Net WorthUnveiling the Top Chartered Accountants in India and Their Staggering Net Worth
Unveiling the Top Chartered Accountants in India and Their Staggering Net WorthShaheen Kumar
 
Attachment Of Assets......................
Attachment Of Assets......................Attachment Of Assets......................
Attachment Of Assets......................AmanBajaj36
 
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMulki Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best Servicesnajka9823
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxhiddenlevers
 
Tenets of Physiocracy History of Economic
Tenets of Physiocracy History of EconomicTenets of Physiocracy History of Economic
Tenets of Physiocracy History of Economiccinemoviesu
 
Monthly Market Risk Update: April 2024 [SlideShare]
Monthly Market Risk Update: April 2024 [SlideShare]Monthly Market Risk Update: April 2024 [SlideShare]
Monthly Market Risk Update: April 2024 [SlideShare]Commonwealth
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdfAdnet Communications
 
Bladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex
 
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170Sonam Pathan
 
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance CompanyInterimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance CompanyTyöeläkeyhtiö Elo
 
House of Commons ; CDC schemes overview document
House of Commons ; CDC schemes overview documentHouse of Commons ; CDC schemes overview document
House of Commons ; CDC schemes overview documentHenry Tapper
 

Recently uploaded (20)

fca-bsps-decision-letter-redacted (1).pdf
fca-bsps-decision-letter-redacted (1).pdffca-bsps-decision-letter-redacted (1).pdf
fca-bsps-decision-letter-redacted (1).pdf
 
Andheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot ModelsAndheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot Models
 
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130  Available With RoomVIP Kolkata Call Girl Serampore 👉 8250192130  Available With Room
VIP Kolkata Call Girl Serampore 👉 8250192130 Available With Room
 
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
 
SBP-Market-Operations and market managment
SBP-Market-Operations and market managmentSBP-Market-Operations and market managment
SBP-Market-Operations and market managment
 
Governor Olli Rehn: Dialling back monetary restraint
Governor Olli Rehn: Dialling back monetary restraintGovernor Olli Rehn: Dialling back monetary restraint
Governor Olli Rehn: Dialling back monetary restraint
 
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...
AfRESFullPaper22018EmpiricalPerformanceofRealEstateInvestmentTrustsandShareho...
 
Unveiling the Top Chartered Accountants in India and Their Staggering Net Worth
Unveiling the Top Chartered Accountants in India and Their Staggering Net WorthUnveiling the Top Chartered Accountants in India and Their Staggering Net Worth
Unveiling the Top Chartered Accountants in India and Their Staggering Net Worth
 
Attachment Of Assets......................
Attachment Of Assets......................Attachment Of Assets......................
Attachment Of Assets......................
 
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMulki Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mulki Call Girls 7001305949 WhatsApp Number 24x7 Best Services
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
 
Tenets of Physiocracy History of Economic
Tenets of Physiocracy History of EconomicTenets of Physiocracy History of Economic
Tenets of Physiocracy History of Economic
 
Monthly Economic Monitoring of Ukraine No 231, April 2024
Monthly Economic Monitoring of Ukraine No 231, April 2024Monthly Economic Monitoring of Ukraine No 231, April 2024
Monthly Economic Monitoring of Ukraine No 231, April 2024
 
Monthly Market Risk Update: April 2024 [SlideShare]
Monthly Market Risk Update: April 2024 [SlideShare]Monthly Market Risk Update: April 2024 [SlideShare]
Monthly Market Risk Update: April 2024 [SlideShare]
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf
 
Bladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results PresentationBladex 1Q24 Earning Results Presentation
Bladex 1Q24 Earning Results Presentation
 
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170
Call Girls Near Golden Tulip Essential Hotel, New Delhi 9873777170
 
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance CompanyInterimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
Interimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
 
House of Commons ; CDC schemes overview document
House of Commons ; CDC schemes overview documentHouse of Commons ; CDC schemes overview document
House of Commons ; CDC schemes overview document
 

JSR 354 - Money and Currency API for Java

  • 1. JSR 354 Java Money and Currency API Werner Keil Build Manager, DevOps Expert, Agile Coach Maersk Line EG Member, JSR 354 @wernerkeil
  • 2. Werner Keil - Bio • Consultant – Coach • Creative Cosmopolitan • Open Source Evangelist • Software Architect • Java Godfather • JCP Executive Committee Member • Eclipse UOMo Project Lead • DevOps Guy 2
  • 3. Show me the Money!
  • 4. Agenda • History • Motivation • The JSR • Virtual Currencies • Currency Exchange • Demos • Q&A 4
  • 6. Earlier Approaches Martin Fowler: A large proportion of the computers in this world manipulate money, so it's always puzzled me that money isn't actually a first class data type in any mainstream programming language.The lack of a type causes problems, the most obvious surrounding currencies… see http://martinfowler.com/eaaCatalog/money.html 6
  • 7. Earlier Approaches (2) Eric Evans – Time and Money: On project after project, software developers have to reinvent the wheel, creating objects for simple recurring concepts such as "money" and "currency". Although most languages have a "date" or "time" object, these are rudimentary, and do not cover many needs, such as recurring sequences of time, durations of time, or intervals of time. … see http://timeandmoney.sourceforge.net/ To be quite frank, their code isn‘t more than an academic POC, factories called dollars() or euros() are useless in real globally deployed frameworks, but he made a good point. 7
  • 10. Summary • This JSR will provide a money and currency API for Java, targeted at all users of currencies and monetary amounts in Java. • The API will provide support for standard ISO-4217 and Custom (e.g. Virtual) currencies, as well as representation of a monetary amount. • It willsupport currency arithmetic, even across different currencies, and foreign currency exchange. • Additionally, implementation details surrounding serialization and thread safety are to be considered 10
  • 11. Why is it needed? • Monetary values are a key feature to many applications. • The existing java.util.Currency class is strictly a structure usedfor representing ISO-4217 standard currencies. • No standard value type to represent a monetary amount. • No support for currency arithmetic or conversion 11
  • 12. Challenges • Keep it simple – Remember the most common use case •Adding currency values e.g. in an e-commerce app. • Performance •How to support low latency applications, such as High Frequency Trading apps. • Precision •There can potentially be differing precisions specified for arithmetic, currency exchange and formatting 12
  • 13. Challenges (2) • Formatting •Requirement should be to use existing Number Formats. •However there is no existing format representing for example Indian Rupees: which might look something like this: 12,34,00,000 •Natural language support for non-decimal valuations for example • Lakhs • Crores • 1 Lakh = 100,000 • 1 Crore = 100 Lakh 13
  • 14. Challenges (3) • Formatting •12,34,56,000.21 is written 12 Crore, 34 Lakh, 56 Thousand Rupees and 21 Paise • Support for non-standard rounding modes 14
  • 15. Non-standard Rounding Modes • It is a big world, and each country has its regulations and cultural nuances for expressing currencies in natural language, rounding policies, groupings, etc. • For example, in Argentina rounding is prescribed for the third digit after the decimal point: If the third digit is 2 or less, change it to 0 or drop it. If the third digit is between 3 and 7, change it to 5. If the third digit is 8 or more, add one to the second digit and drop the third digit or change it to 0. 15
  • 16. Non-standard Rounding – Argentina Argentina Rounding Examples Original Number Rounded Notes 123.452 123.45 Third digit<3 round down 123.456 123.455 3<=third digit<=7 change to 5 123.459 123.46 Third digit>=8 round up Switzerland uses a similar rounding strategy. 16
  • 17. Risks Plan – “Money and Currency” is a formidable and dynamic category with regional dependencies, requiring programmers, business users, international accountants, and attorneys. Risk – Incomplete or outdated spec Mitigation – Resulting API should be flexible, let application developer change implementation as needed. 17
  • 18. Risks (2) Plan – There is also a Java dependency on JDK NumberFormat. Risk – NumberFormat may require coordinated modifications. Mitigation – Coordinate with JDK release; Supply NumberFormats and similar classes that augment JDK content. Plan – There is also a Java dependency on JDK NumberFormat. Risk – NumberFormat may require coordinated modifications. Mitigation – Coordinate with JDK release; Supply NumberFormats and similar classes that augment JDK content. 18
  • 20. Expert Group Members • Credit Suisse • Goldman Sachs • Stephen Colebourne • Ben Evans • Werner Keil • Bob Lee 20
  • 21. Supporting the JSR • Credit Suisse • Caxton Associates • Goldman Sachs • JP Morgan/Chase • London Java Community • Stephen Colebourne • Werner Keil 21
  • 22. Schedule • Targeted to Java 9 • Aiming at Java ME/Embedded 8 or 9 • Following the EC Merge and Standard/Embedded harmonization, no JSR should be SE/EE or ME only, with very few, specialized exceptions. Money is so important, and has almost no legacy in the JDK except java.util.Currency, that it should be supported by ALL POSSIBLE platforms, except maybe JavaCard for now. • With back-port to previous versions still supported and in relevant use 22
  • 24. Facebook Credits What are Facebook Credits? • Facebook Credits are a virtual currency you can use to buy virtual goods in any games or apps of the Facebook platform that accept payments. You can purchase Facebook Credits directly from within an app using your credit card, PayPal, mobile phone and many other local payment methods. ► Hence any such purchase is practically a conversion, similar to if you buy a foreign currency when travelling abroad☺ 24
  • 25. Top 10 Video Game Currencies 1. Gold 2. Gil 3. Rupees (not Indian;-) 4. Credits 5. Gold Rings 6. Hearts 7. Zenny 8. Potch 9. Munny 10.Nuyen 25
  • 30. Trading Application Example What happens, if we use built in java.util.Currency and Standard JSP formats 30
  • 31. Demos
  • 32. Q&A
  • 33. Links • The JSR: http://jcp.org/en/jsr/summary? id=354 • java.net Project: http://java.net/projects/javamoney/ • GitHub Project: http://github.com/JavaMoney/
  • 34. Links (2) • Eclipse UOMo: http://www.eclipse.org/uomo/ • JScience: http://www.jscience.org • JodaMoney: http://joda-money.sourceforge.net/