Transactions without Transactions
Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Charles Humble on Nov 25, 2009
Following on from last week's surprise announcement at Devoxx that Sun would be adding closures to Java, Mark Reinhold has published a blog entry providing more background to the decision.
The principle use case for Java closures is parallel programming. Reinhold argues that using tools such as parallel arrays requires too much boiler plate code in Java, and that by introducing closures to the language it is possible to eliminate that boilerplate. He goes on:
In the last few years three serious proposals for adding closures to Java have been put forward: BGGA, CICE, and FCM. These proposals cover a wide range of complexity and expressive power. My view, having studied them all, is that each contains good ideas yet none is entirely appropriate for a "working programmer's language".To support the principal use case of parallel programming we really only need two key features:
- A literal syntax, for writing closures, and
- Function types, so that closures are first-class citizens in the type system.
To integrate closures with the rest of the language and the platform we need two additional features:
- Closure conversion, so that a closure of appropriate type can be used where an object of a single-method interface or abstract class is required, and
- Extension methods, so that closure-oriented bulk-data methods can be retrofitted onto existing libraries, and in particular the Collections Framework, without breaking compatibility.
Java is often criticised for the slow pace of its evolution. Whilst the argument is often overplayed (Java has been through 4 major revisions since C++ was last updated for example) anything that encourages language experimentation within Java is positive, provided it can be done in a way that doesn't impact the language directly. In a previous article I explored three alternative techniques that allow this - DSLs, the Java 6 annotation processor, and moving the default place for adding syntactic sugar from the language to the IDE - but whilst each of these techniques is useful we found that each had its limitations when attempting to provide support for closures. Sun's solution is to use the JDK 7 project itself to do the experimentation before deciding whether to standardise the feature for Java SE. As Reinhold puts it:
Sun will initiate the design and implementation of a simple closures feature, as outlined above, and add it to JDK 7 so as to enable broad experimentation. If all goes well then we'll later submit a language-change JSR which would, in turn, be proposed as a component of the eventual Java SE 7 JSR.
Sun is keen to here from "everyone who participated in the earlier closures conversations - as well as anyone else with an informed opinion" and a straw man proposal is expected soon.
Improve Java Garbage Collection, Runtime Execution, and JVM visibility with Zing
18 agile and lean practices for effective software development governance
Monitor your Production Java App - includes JMX! Low Overhead - Free download
Would someone please send me a link to describe why closures are related to parallel programming. Every example I have seen utilizes inline processing.
I thought the article linked to in Mark's blog - www.ibm.com/developerworks/java/library/j-jtp03... - did a pretty good job of explaining this. Most of the new JDK7 concurrency libraries (Fork/Join and Parallel Array for instance) require a lot of boiler plate to make them work. So much so that I believe ParallelArray is currently out-of-scope of Java 7 though the revised deadline might allow it back in.
I found this bit from Mark's blog item interesting:
* Capture of non-final variables,
* Non-local transfer of control, and
* Library-defined control structures (i.e., control abstraction).
At present I see no need to add any of these to Java.
Which begs the question - I can throw lambdas to Fork&Join and friends, but I can't write a parallel map/for using lambdas because that would be a library defined control structure?
alblue.blogspot.com/2009/11/java-will-have-lamb... describes the difference between lambdas and closures, and the fact that the new proposal correctly calls them lambdas.
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.
Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.
John Davies examines Visa’s architecture and shows how enterprises have architected complex integrations incorporating Hadoop, memcached, Ruby on Rails, and others to deliver innovative solutions.
Sean Comerford unveils ESPN.com’s architecture, what components are used and why, and the current changes the website goes through.
Are there repeated patterns of failure on Enterprise Agile Enablement efforts? Sanjiv and Arlen discuss Seven Deadly Sins to avoid when adopting Agile in an enterprise.
4 comments
Watch Thread Reply