Slashdot Mirror


Draft Review of Java 7 "Measures and Units"

Jean-Marie Dautelle writes to inform us that the public review period ends on July 8 for JSR-275, "Measures and Units" Early Draft. The JSR-275 will be a major enhancement for Java 7 by providing "strong" typing (through class parameterization) and easy internationalization of Java programs, preventing conversion errors. The latest version 0.8 is available as a PDF. The reference implementation is provided by the JScience project under a BSD license."

20 of 220 comments (clear)

  1. Re:Java 8 by EWIPlayer · · Score: 5, Funny

    Take it from me, I work in HR at a Fortune 500 company, so I know a thing or two.

    This AC is totally right. Every time I need a decision on which language I should use to implement a product, I always go straight to HR; preferably HR in fortune 500 company. Those folks really know their stuff!

    As if what companies use has anything whatsoever to do with this paper... I agree Java sucks, but this has nothing to do with whether or not someone is "employable" after reading this paper - it has to do with a fairly smart group of folks trying to make Java a bit better for numerical work. (i.e. for the public sector, more often than not)

    --
    This sig used to be really funny...
  2. Similar to Fortress by Coryoth · · Score: 4, Interesting

    This looks rather similar to the units and dimensions handling and checking available in Fortress, Sun's effort to build a new numerical/scientific computing language. In general it seems like a sensible idea -- having the option of adding extra annotation that allows for more exacting static checking and greater assurance is generally always a good thing. The only downside is that, at least in the java implementation, it is a little cumbersome and clumsy (though maybe that's just par for the course for new java versions). Now if only java could get statically checkable optional contracts as in Spec# we might actually be getting somewhere. At the very least it would be nice if they had runtime checkable contracts, properties and tests as in Fortress. Or perhaps I should just wait for Fortress to finally mature; it seems that will happen faster than java getting the features I'm after.

  3. getting tired of Java ... by boxlight · · Score: 5, Interesting

    I've spent most of the last 10 years building desktop and web applications with Java: AWT, Swing, JSP, Struts, J2EE, EJBs, and on and on.

    Through all those years I've had to fight perceptions of Java being hard to distribute, slow, difficult, insecure, and over-engineered. I've done pretty well in the battle, and produced some pretty nice products.

    Maybe I'm having a bit of a mid-life crisis, and I'm wondering where to go from here. I'm looking at alternatives for development: AJAX, Ruby, PHP, and Adobe AIR. But nothing out there (outside of the Microsoft world) does everything that Java does as well -- but Java just doesn't do GUI too well. Although GWT is pretty cool. And I've always thought Applets were underrated and under-utilized.

    The point of this rant? Java 7 doesn't excite me in the least. Me and everyone I know are firmly planted in Java 5 (or is it 1.5? I always forget) and we don't appear to be moving to Java 6 (1.6?) -- so why should we care about Java 7 (1.7?).

    Anyway, that's my rant. Any suggestions are greatly appreciated!

    1. Re:getting tired of Java ... by alyawn · · Score: 5, Interesting

      I agree about the features of Java 6 & 7. I code to Java 5 but run in the latest and greatest VM because they continue to make performance enhancements there.

      As for GUI development, I believe that we will see some progress made there. Right now, there is some good competition going on between Swing, SWT, and other toolkits. And now, QT just came out with QT Jambi which looks really cool. The bottom line is that eventually, one of these toolkits will emerge and become the defacto toolkit. Remember, cross platform UI is a hard problem to solve. They'll figure it our eventually. Or, you may get tired enough and write one yourself :)

    2. Re:getting tired of Java ... by cmburns69 · · Score: 5, Insightful

      Version 1.7 will come out, and then you'll start moving to 1.6. When 1.8 comes out, then you can switch to 1.7. It seems like very few people actually use the most recent version. I suspect this is because new methods need to be researched, and community support for new features must be developed.

      --
      Online Starcraft RPG? At
      Dietary fiber is like asynchronous IO-- Non-blocking!
    3. Re:getting tired of Java ... by tcopeland · · Score: 4, Informative

      > Java 6 and Java 7 are relatively minor changes.

      Language-wise Java 1.6 doesn't include any changes; check out the docs for the -source option for javac.

    4. Re:getting tired of Java ... by onash · · Score: 5, Informative

      The JSR that I'm excited about;
      - JSR 294 Improved Modularity Support (superpackages); so we can define the API that is public for a library, so the user doesn't have to see all the public functions.
      - JSR 296 Swing Application Framework; which helps us build better Swing GUIs faster in a more standard way.
      - JSR 295 Beans Binding and JSR 303 Beans Validation
      I was really excited about that Consumer JRE / Java Kernel, which was suppose to minimize the size of the JRE so you could bundle a 5mb JRE for a normal Swing Application, but they decided on pushing that to Java 6! so it's arriving as a patch late this year. It will probably include a very nice looking look&feel as well as GUI drawing optimizations using DirectX on Windows.. pretty cool.

      We can also hope for Closures, which would make our GUI code a lot neater.. My company and everyone that I know (except Apple) have moved to Java 6 - and the IDEs such as Eclipse and new technologies like Open-Terracotta are making me love Java! Especially cause we are developing applications / algorithms that run on many different platform.. Java is really the only way cause its fast enough and rock solid.

  4. Neat idea by mritunjai · · Score: 4, Informative

    Its a one of the several neat ideas being lifted from the Fortress language.

    For the unitiated, Guy Steele (of Scheme fame) is building a new language for scientific computing called Fortress. It has some nice ideas that really should have been there by now. The language would have saved countless headaches in not just scientific but probably all mainstream software development projects.

    Of course, its just one of the pet projects in SUN Labs ;)

    --
    - mritunjai
  5. Re:getting tired of Java = Python! by Sciros · · Score: 4, Funny

    Well at least it's 2 whole cents. Too many people say stuff like "just wanted to add my .02 cents" which IMO deals a severe blow to their credibility.

    --
    I like basketball!!1!
  6. Re:Java 8 by xero314 · · Score: 4, Informative

    I work in HR at a Fortune 500 company Translation: "I have no idea what I am talking about"

    Lets see what jobs are actually out there:
    • Dice
      • C#: 7303 (or 5054 if you take out all the incorrect matches on C)
      • Java: 16803
    • Monster (last 10 days since it limits to 5k)
      • C#: 1911
      • Java: 3760
    That is without comparing salaries which are on average higher for Java developers.

    Just goes to show how out of touch HR really is.
  7. Re:More Java growth? by jgrahn · · Score: 5, Funny

    Looks like the death-blow for c#?

    Yes. A couple of classes for handling metres, kilograms and seconds is the killer application for Java. All other languages/operating environments will disappear overnight.

  8. Re:i like this a lot by AKAImBatman · · Score: 4, Informative

    seriously, how come this is the first that i've heard of this kind of idea?

    You want the honest answer or the sugarcoated one?

    Sugar: JScience is getting attention now because Sun is standardizing it through the JCP.

    Honest: Because you've been living in Microsoft la-la land? JScience has been around in the form of the J.A.D.E. library for at least 5 or 6 years; probably longer. Jean-Marie has worked diligently over the years to make sure that Java has had top-notch support for scientific programming. The fact that he's getting recognition by the JCP members is nothing short of splendid. He deserves every bit of it. :)
  9. Re:Ugh... by Coryoth · · Score: 4, Insightful

    Really? No kidding? It's called a requirement. So we are adding functionality to give poor developers yet another crutch to lean on, catering to the stupid? No, it would be adding a mechanism that allows requirements to be documented properly in the code itself, rather than on paper in a binder buried behind the filing cabinet in a document that is now hopelessly out of date and doesn't reflect the code at all anymore.

    Perhaps you are a perfect programmer who never makes mistakes. Some of us, despite our best efforts, do make mistakes occasionally; perhaps we simply weren't thinking about how this code would interact with someone elses code at the time; perhaps we just made a typo; perhaps we hadn't quite had our coffee yet; who knows, but mistakes happen to everyone (except, apparently, yourself). In the case that mistakes creep in, it is nice to be able to catch and fix them as early as possible, rather than having a complex and expensive bug hunt somewhere down the line. Spending a moment to actually document requirements and intentions in a form that can be checked (be it statically, or automatically at runtime if you leave checks on) efficiently and regularly is a good thing. Most of us do that already in the form of static types which are checked at compile time. Adding some expressivity to that (via a more powerful type system, contract annotations on methods and objects, an automated unit testing system, or just extra static checks on units) isn't a bad thing, especially if it is optional (as it often is).

    I can have some sympathy for the complaint that adding bits and pieces in this rather piecemeal (and in the case of this particular implementation, somewhat clumsy and verbose) fashion is poor. Ideally adding means to decently document and express requirements and intentions should be something added to the language as a whole, with an overriding vision of how it should work. For that see Eiffel, Spec#, Fortress, or languages with more expressive type systems like the ML family and Haskell. Still, with something as simple and encapsulable as dimension and unit checking, why not just throw it in as a convenient optional extra? If you don't like it, don't import the library that implements it.
  10. Re:Java 8 by Mr.+Bad+Example · · Score: 5, Funny

    > Take it from me, I work in HR at a Fortune 500 company, so I know a thing or two.

    HR? I'd be surprised if you know what color database has the most RAM.

  11. Re:More Java growth? by fm6 · · Score: 5, Interesting

    A little detail: "Java" is both a platform and a language. C# is just a language, one of several that runs on the .NET platform. (Microsoft doesn't like the word "platform", but it's the only one that fits.) So when you're analyzing market share, you need to compare Java with .NET, not with C#.

    The figures you quote show .NET doing pretty good, though still lagging way behind Java. One little improvement in the Java language is not going to spell the "death nell" for the .NET platform. That would be true even if .NET didn't have the backing of the biggest software company on the planet.

    What is bad news for .NET is the fact that Sun seems to be capturing a lot of developer mind share with its Java Community Process, which is where this proposal comes from, along with a lot of other good stuff, including JSR 166, which originated outside Sun, and has successfully added a major improvement in concurrency to the Java platform.

    The JCP won't spell the "death knell" to C# or .NET either, not as long as they have MS's backing — and are essential tools on Windows. But it will certainly help Java hold onto its lead.

  12. Philosophy of numbers by michaelmalak · · Score: 4, Interesting
    It's interesting that I was trying to do the same thing with C++ back in 2000, maybe even 1996.

    The idea is based on the philosophy that numbers do not exist in isolation. It is possible to speak of, e.g., the number 5 as an abstract entity unto its own, but that should be rare. Most of the time, "5" refers to the ratio "5:1", where the "1" refers to something tangible. In science, the "1" is denoted with units. The problem is, starting with tabulating machines, then onto electronic calculators, and even multi-gigabyte computers, numbers are almost universally represented (erroneously) as the former -- purely abstract numbers. The units are stripped off.

    As any struggling physics or chemistry student knows, one can fake one's way through a test by doing "dimensional analysis" on test questions. If the units cancel out properly and agree, you've probably got the right answer.

    Compilers should be doing dimensional analysis at compile-time. I had originally hoped to create C++ templates -- which are evaluated at compile-time -- to do this, but I couldn't quite see how to get them to handle all the possible permutations of unit combinations and conversions -- at least not easily. It really needs to be built into the language.

    With a compiler enforcing dimensional analysis, it would force programmers to think through every formula and calculation. Novel unit combinations would arise as a result of creating database reports. E.g. a payroll report might have $/2-week pay period. A conversion somewhere to $/year would be another unit, and the conversion between $/2-week pay period and $/year would be clearly definied in one place rather than sprinkled throughout the code.

    Putting conversions in one place is the first thing I did when I cleaned up some pre-existing source code that I took over. I explicitly created three coordinate systems (device, world, and screen) and created two two-way conversions to go between the levels. Before that, there were conversions all over the place, each a little different, each with different handling of roundoffs and some even with hidden fudge factors. ("Conversions in one place" can be done without developing a units system, as it has its own benefits.)

    I blame a lack of education on the philosophy of numbers for programming languages relying upon naked numbers for so many decades. Rote algorithms for addition, subtraction, multiplication, and division taught in elementary school are the foundation of this vacuous philosophy.

    It could even be responsible for the public's acceptance of no gold standard for the dollar. They're not demanding to know what the reference point of "one dollar" is.

    And of course it's the Federal Reserve that can print endless money for the war in Iraq, thank to the lack of a gold standard.

    So there you have it -- lack of units in programming languages and the war in Iraq have a common cause: the lack of correct philosophy on numbers taught in schools.

    1. Re:Philosophy of numbers by ispeters · · Score: 4, Insightful

      It could even be responsible for the public's acceptance of no gold standard for the dollar. They're not demanding to know what the reference point of "one dollar" is.

      And of course it's the Federal Reserve that can print endless money for the war in Iraq, thank to the lack of a gold standard.

      I was agreeing with you completely until you said that. There can be no reference point for "one dollar". A currency system lifts the burden of a barter system from its users. Without the dollar, you'd have to bake bread and swap it for internet connectivity, or something. How much bandwidth can you get for a loaf of bread? The same question applies to the dollar. Currency is a tangible way to represent the virtual concept of value. There is no unitary value of value so there can be no fixed unitary value for a currency. A free-floating currency values itself according to what its users think it's worth, which is, IMHO, the only sane way to value a virtual concept.

      Ian

  13. Re:More Java growth? by Shados · · Score: 4, Insightful

    One issue with .NET that slowed down its growth, was poor support for enterprise projects. That is, .NET was quite the ideal platform for mid size project, but when you start needing reliable services (by reliable, I mean queueing, availability contracts, etc), distributed transactions for things other than DBs, handling encapsulated business processes, etc, it was way, -way- behind Java.

    Now with .NET 3.0, it caught up, and with .NET 3.5 its quite impressive: however, 3.5 isn't officially out, and 3.0 doesn't have Visual Studio support, and for the most part in the .NET world, if its not in Visual Studio, it doesn't exists. Once VS2008 comes out (at the end of this year), things should spice up a bit...

    MS' presence on codeplex is also helping the community side a bit, especially with Patterns & Practices (which a lot of things done by that team, altered by the community, eventually makes it in the real things, like Project Acropolis).

    Thats mostly speculation mind you, but it should be interesting...

  14. Re:More Java growth? by fm6 · · Score: 4, Interesting

    In other words, Microsoft screwed up all its early planning for .NET. That's only just, since Sun did exactly the same thing with Java: lousy compilers and virtual machines; too much emphasis on web applications and "network computer" technology. Most of the negative things people think they know about Java comes from that era.

  15. And while your at it by ClosedSource · · Score: 4, Funny

    Please answer the same question for C#.