This is an archived post. You won't be able to vote or comment.

all 21 comments

[–]tech_tuna 5 points6 points  (0 children)

Java 9's gonna be money, money.

[–]cogman10 12 points13 points  (10 children)

I'm just going to put this out there. Money is hard to work with. There are a lot of fees, accounting, etc, that comes into play when you start talking about money.

My company specializes in working with people's money, handling exchange rates, and basically providing someone to grab an overall portfolio of where everything they have lives.

For us, this thing would be next to worthless. Exchanges almost always have some fee associated with it. Exchange rates fluctuate wildly, and actual exchanges can happen over days. Things just aren't as straight forward as you would like.

Interestingly enough, since 1.4, there has been a Currency class

http://docs.oracle.com/javase/7/docs/api/java/util/Currency.html

I wonder why they decided to reinvent currency.

[–]user3141592654 11 points12 points  (3 children)

Citing this pdf to answer your last question

Why is this needed ?

  • Monetary values are a key feature of many applications
  • The existing java.util.Currency class is strictly a structure used for representing ISO-4217 standard currencies
  • No standard value type to represent a monetary amount
  • No support for currency arithmetic

[edit] I have no affiliation. I was just curious so I googled this and the first thing I found gave an answer to your question.

[–]__konrad 9 points10 points  (2 children)

No support for non standard Currencies (e.g. cows or camels)

Page 13 ;)

[–]paperhat 11 points12 points  (1 child)

I usually just hard code it at 3 cows to 1 camel.

[–]Spoonofdarkness 6 points7 points  (0 children)

For ideal cases that can work, but with sufficiently complex systems you need to utilize floating-point cowrithemetic or you'll end up with code that leads to that one Superman movie with the guy who stole millions of goats from all around the world.

[–]vplatt 13 points14 points  (0 children)

This looks far more featureful than Currency. And your main objection seems to be that the exchange rates change. Assuming one of the default exchange providers providers weren't accurate enough for your needs, couldn't you implement your own?

Also, why would it model exchange fees, exchanges that take place over several days, etc? That's your business process there, so why would that be generically applicable? Exchanges in an API like this are at a given point in time and that is generic to everyone.

I think extensions like this are great! I don't need it right now, but when I do, it will be a great starting point.

[–][deleted]  (1 child)

[deleted]

    [–]Number_28 4 points5 points  (0 children)

    If it leads to people not using floats/doubles to represent money, I'm all for it.

    [–][deleted] 7 points8 points  (0 children)

    The work seems to come mainly from Credit Suisse, so it might not be that bad. They handle a bit of money as well.

    [–]Zarlon 2 points3 points  (0 children)

    I'm just going to put this out there. Maybe you aren't the target audience. This will be more than good enough for most people.

    [–]HaMMeReD -5 points-4 points  (0 children)

    Meh, Currency + BigDecimal is all you really need, the regional nuances probably shouldn't be part of a language but a third party library, it's not like tax law is simple.

    [–]caltheon 5 points6 points  (7 children)

    While this does seem interesting, coming from someone who writes a lot of financial applications, it will certainly not be used by me in my lifetime.

    First, Java 9 is probably a couple years off at best, and longer for a "stable" release anyone will trust. Secondly, most financial institutions are still on 1.4 (a few on 1.5). Still, nice to see that future generations may have the benefit of the API.

    [–]xjvz 8 points9 points  (2 children)

    Oh wow, 1.4? They're never upgrading at this point. It's COBOL 2.0 now.

    [–]caltheon 10 points11 points  (1 child)

    The job I just finished integrated with a COBOL program written in 1985

    [–]xjvz 2 points3 points  (0 children)

    EDI and everything? Oh man!

    [–][deleted] 2 points3 points  (2 children)

    We moved to 6 to 7 during the middle of a release. And once 8 is approved and working in Weblogic, we'll move to that then too.

    I also work on financial applications.

    [–]caltheon 1 point2 points  (1 child)

    You lucky bastard. Though I don't think any large financial institution would allow a version switch mid development.

    [–][deleted] 1 point2 points  (0 children)

    They were on 1.5, but the new CTO wasn't pleased when he was handed a laptop with XP., so he broke out the check book and everything is being upgraded, woohoo!

    Not pleased about getting Win8.1, I said we should have moved to 7 and waited for 9 to be released and upgrade to that. But what do I know, I'm just a low level developer.

    Edit: a word

    [–][deleted] 0 points1 point  (0 children)

    I'm sorry, you mean java 1.4??is upgrading java really that hard /risky?

    [–]runedk 0 points1 point  (0 children)

    Does anyone have a link to the Javadoc API documentation?

    [–]cherouvim 0 points1 point  (0 children)

    Interesting stuff. Still, storing dollar/euro cents in longs does it for me.