docs: add workshop about JRS-354
Money and Currency API
This commit is contained in:
commit
43d441c1f6
3 changed files with 447 additions and 0 deletions
26
workshops/money-currency-api.md
Normal file
26
workshops/money-currency-api.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Beyond BigDecimal: Money and Currency API in Java (JSR-354)
|
||||
|
||||
| Type | Length | Languages |
|
||||
| -------- | ------ | --------- |
|
||||
| Workshop | ~ 3 h | 🇬🇧 🇩🇪 |
|
||||
|
||||
## Abstract 🇬🇧
|
||||
|
||||
Working with monetary amounts seems trivial at first glance. In practice, many Java applications rely on `BigDecimal` for the amount and `Currency` for the currency. This works for simple numbers, but it does not solve the actual problem: money is more than just a number. Currency information must be handled consistently, rounding rules depend on the currency, and not all currencies have two decimal places.
|
||||
|
||||
This is exactly where JSR-354, the Money and Currency API for Java, comes in. It provides a domain-driven model for monetary amounts with `MonetaryAmount` and `CurrencyUnit`, helping to avoid common mistakes when dealing with currencies and rounding.
|
||||
|
||||
In this workshop, the core concepts of the API are presented in a practical way: proper modelling of monetary amounts, safe calculations, flexible rounding strategies, formatting, and currency conversion. In addition, less well-known but highly powerful features are introduced, such as `MonetaryOperator`, `MonetaryQuery`, monetary contexts, and extensibility via providers.
|
||||
|
||||
After the workshop, participants will be able to model monetary amounts correctly, avoid common pitfalls when working with currencies, and apply JSR-354 effectively to express domain requirements in a clearer, more robust, and more maintainable way in code.
|
||||
|
||||
## Abstrakt 🇩🇪
|
||||
|
||||
Mit Geldbeträgen zu arbeiten wirkt auf den ersten Blick trivial. In der Praxis landen viele Java-Anwendungen bei `BigDecimal` für den Betrag und `Currency` für die Währung. Das funktioniert für einfache Zahlen, löst aber das eigentliche Problem nicht: Geld ist mehr als nur eine Zahl. Währungsinformationen müssen konsequent mitgeführt werden, Rundungsregeln sind abhängig von der Währung, und nicht jede Währung hat zwei Nachkommastellen.
|
||||
|
||||
Genau hier setzt JSR-354 an, die Money and Currency API für Java. Sie stellt mit `MonetaryAmount` und `CurrencyUnit` ein fachlich sauberes Modell für Geldbeträge bereit und verhindert typische Fehler im Umgang mit Währungen und Rundungen.
|
||||
|
||||
In diesem Workshop werden die zentralen Konzepte der API praxisnah vermittelt: korrekte Modellierung von Geldbeträgen, sichere Berechnungen, flexible Rundungsstrategien, Formatierung sowie Währungsumrechnung. Darüber hinaus werden weniger bekannte, aber besonders mächtige Funktionen vorgestellt, etwa `MonetaryOperator`, `MonetaryQuery`, Monetary Contexts und die Erweiterbarkeit über Provider.
|
||||
|
||||
Nach dem Workshop sind die Teilnehmenden in der Lage, Geldbeträge fachlich korrekt zu modellieren, typische Fehlerquellen im Umgang mit Währungen zu vermeiden und JSR-354 gezielt einzusetzen, um fachliche Anforderungen klarer, robuster und wartbarer im Code abzubilden.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue