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."
Looks like the death-blow for c#? I realize that there will be a lot of c# projects in MS shops, but Java has been around so long and continues to grow.
Dice.com results:
'java' - 16799
'c#' - 7305
'.NET' - 12042 (inclusive of c#)
Website Hosting
Additions of features like this are useful for applications that need unit of measure conversion. I can think of a number of situations where using a mechanism like this rather than writing my own conversion could be useful. Also adding the ability to extend it yourself with custom unit's could be very helpful in some cases.
How much do additions such as this add to the overall footprint of the language? I understand that this project may not be very large but how many parallel projects such as this are being added to the codebase. I'm not sure what the benefit of adding this directly over having it available as a library. In many cases we need to keep several java instances on the same server(app specific, multi versions) this means that this footprint growth get's multiplied across the multiple instances.
This signature would be better if I was creative.
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.
Craft Beer Programming T-shirts
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!
It sounds like this stuff comes from Sun's work on Fortress, which is a language designed to replace FORTRAN in scientific computing (and HPC). The nice thing about having units in the language is that you can use the compiler's type checking way beyond its normal boundaries. You can do this already with classes, but it's messy. You could have a distance and a time class, for example, and constructors that would take scalars and units and create them, then a speed class that would construct a speed from a distance and a time, but it would be a lot of code and very hard to read, so most people just use integers (or floats) and rely on their brains to catch conversion errors. If you add some syntactic sugar then you make it much more attractive, and reduce the errors in the program.
I am TheRaven on Soylent News
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.
Although still in it's infancy, JavaFX kinda sounds interesting. I've played around with it a little bit, and it's definitely fun. There are several examples out there showing you how it's done and they get the point across pretty well. It's supposed to be an alternative to Flash and Silverlight and although showing promise, it definitely falls short in it's multimedia capabilities(sound and video). Multimedia would perhaps be the killer feature to add to Java 7. Anyway, they're supposedly optimizing Java 7 to handle JavaFX and JavaFX Script and this is perhaps one of the features that "might" encourage people to upgrade.
https://openjfx.dev.java.net/
Btw, JavaFX was previously known as F3 (Form Follows Function?) for those that may be looking up more details and examples of it.
...what the programming language of the future will look like but I know it will be called "Java"!!!
Case in point: As if EJB3 has anything to do with EJB2 other than sharing the same name.
[signature]
We have been using the JScience package to record a variety of internal data about a (we hope!) large scale statistics intensive website we've been building. It is actually a breath of fresh air not to have to worry about accidentally confusing impressions per minute with unique visitors per hour, but rather letting the compiler do the worrying for you. This will be a great addition to Java, but you don't need to wait, JScience's implementation is robust and we've been using it in production for months.
"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."
I really don't understand this obsession with the Gold Standard. A gram of gold has no intrinsic value either, any more than one US dollar does. (Other than for making connectors on circuit boards). Its value, like the dollar, lies purely in what other people are willing to exchange for it - and like a paper currency, that 'value' can fluctuate wildly. Gold is simply a fiat currency on a global scale, and its arbitrarily assigned market value bears no relation to any true wealth. The same for every single other investment or speculation commodity, be it diamonds, yen, shares, futures, tulips or bets on horses down at the local track. If its value derives entirely or mostly from *other people's subjective valuation of it* then it's an illusion, a Ponzi scheme that just hasn't collapsed yet - but drop someone in a desert with the choice between a gold bar and a bottle of water, it will.
Gold's main value as a currency was because 1) it didn't corrode, 2) it wasn't useful for anything else, and 3) it was produced at a slow but mostly constant rate (but not at a rate usefully matching the actual growth of economies, leading to huge abberations like Spain's inflationary spiral after gaining South America's goldfields, and the gold rushes of the 1800s)
Basically gold was just a crude mechanical approximation of a cryptographic reputation protocol implemented in ore. Its failings as an estimator of personal and social worth are legendary. We can do a lot, lot better.
Now: if you pegged a currency to a basket of useful commodities or social indexes: water, food, housing, textiles, domesticated wildlife, access to healthcare - the things that a person or society can actually *use* as primary units of biological energy and production - then you'd have a currency with *real* intrinsic value, and you could start talking about having a philosophy behind your money.
You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
I don't know what you were trying to accomplish, but if you wanted a GUI element in .NET you could have used a ListView, a DataGrid, or the newer DataGridView.
.NET DataSet (which contains DataTables) doesn't just work with databases. You can manually set Rows and Tables or read XML into them.
BTW the