Skip to main content
This revision made December 18, 2012 00:11, by keilw

Design principles

  • Value types (Simple immutable types, depending on even simpler immutable types or primitives)
  • Method naming and style in alignment with java.util.Currency, where applicable BigDecimal, unless otherwise recommended by (Oracle) JDK Architects
    • same method name prefixes - getInstance() for factories, other operations modeled after BigDecimal to the extent it makes sense. See JavaFX or other APIs.
    • overall API "feel" shold mirror BigDecimal, unless otherwise recommended by (Oracle) JDK Architects
  • Works acceptably with other JVM languages (Groovy, Scala, Clojure...) most do with java.util.Currency, or BigDecimal, thus integration will be similar.
    • Possibly have to align with OpenJDK and other parts like JavaFX


Do we want to include the following as a design principle? There is some debate about whether to use factories, why lock it down?

  • No separate factories for the value types
    • specifically, users should be able to write Money.getInstance(30, GBP) or similar. Factories may exist separate to this, but should not be the first design option.
Difference compared to previous revision
<span>'''Design principles''' * Value types (Simple immutable types, depending on even simpler immutable types or primitives) * Method naming and style in alignment with <span style="text-decoration:underline;color:green">java.util.Currency, where applicable BigDecimal, unless otherwise recommended by (Oracle) </span>'''Design principles''' * Value types (Simple immutable types, depending on even simpler immutable types or primitives) * Method naming and style in alignment with J<span style="text-decoration:line-through;color:red">SR-310</span>J<span style="text-decoration:underline;color:green">DK Architects</span> ** same method name prefixes - <span style="text-decoration:line-through;color:red">of</span><span style="text-decoration:underline;color:green">getInstance()</span> for factories, <span style="text-decoration:line-through;color:red">wi</span><span style="text-decoration:underline;color:green">o</span>th<span style="text-decoration:underline;color:green">er</span>th <span style="text-decoration:line-through;color:red">f</span> o<span style="text-decoration:underline;color:green">pe</span>or<span style="text-decoration:line-through;color:red"> </span>r<span style="text-decoration:underline;color:green">at</span>i<span style="text-decoration:underline;color:green">ons </span>im<span style="text-decoration:line-through;color:red">mutab</span>m<span style="text-decoration:underline;color:green">ode</span>le<span style="text-decoration:underline;color:green">d</span>le <span style="text-decoration:line-through;color:red">se</span> <span style="text-decoration:underline;color:green">af</span>t<span style="text-decoration:line-through;color:red">t</span>er<span style="text-decoration:line-through;color:red">s,</span> <span style="text-decoration:line-through;color:red">plus/m</span>ter <span style="text-decoration:underline;color:green">B</span>i<span style="text-decoration:line-through;color:red">nus </span><span style="text-decoration:underline;color:green">gD</span>e<span style="text-decoration:line-through;color:red">t</span>c<span style="text-decoration:line-through;color:red"> (</span>ec<span style="text-decoration:underline;color:green">im</span>a<span style="text-decoration:underline;color:green">l to the exte</span>an<span style="text-decoration:line-through;color:red">d</span>n<span style="text-decoration:underline;color:green">t</span> <span style="text-decoration:line-through;color:red">a</span><span style="text-decoration:underline;color:green">it </span>m<span style="text-decoration:underline;color:green">ak</span>e<span style="text-decoration:underline;color:green">s se</span>men<span style="text-decoration:line-through;color:red">d</span>n<span style="text-decoration:underline;color:green">s</span>e<span style="text-decoration:line-through;color:red">d</span><span style="text-decoration:underline;color:green">.</span> <span style="text-decoration:line-through;color:red">if J</span>S<span style="text-decoration:line-through;color:red">R-310</span> S<span style="text-decoration:underline;color:green">ee</span> <span style="text-decoration:line-through;color:red">n</span><span style="text-decoration:underline;color:green">J</span>a<span style="text-decoration:line-through;color:red">ming</span><span style="text-decoration:underline;color:green">vaFX</span> <span style="text-decoration:line-through;color:red">is</span><span style="text-decoration:underline;color:green">or</span><span style="text-decoration:line-through;color:red">am</span><span style="text-decoration:underline;color:green">oth</span>e<span style="text-decoration:line-through;color:red">nded)</span><span style="text-decoration:underline;color:green">r APIs.</span> ** overall API "feel" shold <span style="text-decoration:underline;color:green">mirror BigDecim</span>al<span style="text-decoration:underline;color:green">, unle</span> ** overall API "feel" shold als<span style="text-decoration:line-through;color:red">o</span>s<span style="text-decoration:underline;color:green">s</span> <span style="text-decoration:line-through;color:red">m</span><span style="text-decoration:underline;color:green">otherw</span>i<span style="text-decoration:underline;color:green">se </span>ir<span style="text-decoration:line-through;color:red">r</span>r<span style="text-decoration:underline;color:green">ec</span>o<span style="text-decoration:underline;color:green">mmended by (O</span>r<span style="text-decoration:underline;color:green">acle)</span>or J<span style="text-decoration:line-through;color:red">SR-310</span> J<span style="text-decoration:underline;color:green">DK Architects</span> * Works acceptably with other JVM languages (Groovy, Scala, Clojure...)<span style="text-decoration:underline;color:green"> most do with java.util.Currency, or BigDecimal, thus integration will be similar.</span> * Works acceptably with other JVM languages (Groovy, Scala, Clojure...) ** Possibly have to align with OpenJDK and other parts like JavaFX<span style="text-decoration:line-through;color:red"> (not all but most 310 method names match Groovy, Fantom/JScience or Ceylon, while FX currently doesn't)</span> Do we want to include the following as a design principle? There is some debate about whether to use factories, why lock it down? * No separate factories for the value types ** specifically, users should be able to write Money.<span style="text-decoration:line-through;color:red">of</span> ** Possibly have to align with OpenJDK and other parts like JavaFX ... Do we want to include the following as a design principle? There is some debate about whether to use factories, why lock it down? * No separate factories for the value types ** specifically, users should be able to write Money.<span style="text-decoration:underline;color:green">getInstance</span>(30, GBP) or similar. Factories may exist separate to this, but should not be the first design option.<span style="text-decoration:line-through;color:red"> </span><span>
 
 
Close
loading
Please Confirm
Close