New-age Transactional Systems - Not Your Grandpa's OLTP
John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Geoffrey Wiseman on Oct 17, 2007
Inadequate models of physical measurements can lead to significant programmatic errors. In particular, the practice of modeling a measure as a simple number with no regard to the units it represents creates fragile code. Another developer or another part of the code might misinterpret the number as representing a different unit of measurement. For example, it might be unclear whether a person's weight is expressed in pounds, kilograms, or stone. The issue is difficult to solve through testing and has already cost millions of dollars to society worldwide. (NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency's team used the more conventional metric system for a key spacecraft operation.)
JSR-275 introduces a new package, javax.measure, with an interface, Measurable, and a class, Measure.
Measurable represents an attribute which could be measured which could be measured (e.g. Altitude, Height), and for which a value can be retrieved, given a compatible unit:
Measurable<length> height = person.getHeight();
long inches = height.longValue(NonSI.INCH);
By using generics, Measurable is typesafe; a compile-time error would be generated when passing Measurable<mass> to a function that requires Measurable<length>:
Measurable<mass> weight = person.getWeight();
person.setHeight( weight ); // error!
Measure represents a particular measurement, the combination of a numeric value and a particular unit. A particular measurable value (e.g. geoffreyWiseman.getHeight()) could be represented by different measures (e.g. Measure.valueOf(73,NonSI.INCH), Measure.valueOf(1.8542,SI.METRE)).
The API also contains quantities (e.g. Mass, Height, Power, Pressure), which are used to parameterize the generic measures and measurements, and Units (INCH, METRE), which are held within systems of units. SI represents the metric system, both with prefixes and units (METER, KILO(METER), etc.), and NonSI holds common units that aren't part of the metric system (DAY, FOOT, KNOT, etc.).
It's possible to convert between units of the same dimension using a UnitConverter. Parsing and formatting are accounted for, including compound units for combinations like feet and inches; hours, minutes and seconds. The API is designed for extension, supporting the creation of new units, systems of units, quantities.
There has been some discussion of using JSR-275 to support JSR-310, the date/time API, but there would need to be further discussion. Stephen Colebourne points out in JSR-275: Suitable for Java 7? that date/time units can't be treated like consistent scientific units for conversion:
Er, how exactly did we manage to convert between months and days? What does that really mean? Well, assuming I've understood everything, what it does is use a definition of a year as 365 days, 5 hours, 49 minutes, and 12 seconds, and a month being one twelth of that. It then goes ahead and does the conversion from months to days using that data.
To learn more, investigate the specification or the reference implementation.
18 agile and lean practices for effective software development governance
Monitor your Production Java App - includes JMX! Low Overhead - Free download
Using Drools? See what you're missing! Get the Power of Drools with the Assurance of Red Hat
The article didn't escape the generic type parameters with < and > so Measurable<Length> looks like Measurable.
Hi Daniel,
Thanks for the note - the article has been updated.
--
Ryan Slobojan
Hi Daniel,
There are still some minor typos, e.g. <mass> and similar generic types should be <Mass> instead.
While discussions are currently hot with JCP members including Stephen and JSR-310 on how to integrate those types best, other innovative, competing platforms like .NET (F# mostly), Scala (with a very limited half-baked approach) or Curl (where a Quantity similar to the base type for Mass, Length, etc. in JSR-275 is an essential part of its "LANG.UNITS" package ;-) show how Java or JavaFX must be enhanced to still be attractive for a modern Cloud and RIA type environment.</mass></mass>
John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.
Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.
Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.
Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).
Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.
Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.
One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.
InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.
3 comments
Watch Thread Reply