JavaOne 2012 – Day 1

JavaOne 2012

Unfortunately, as I feared, this first day of JavaOne started very early for me. I woke up at 4AM and I decided not to fight it. It gave me time to do a bit of work and write yesterday’s blog entry.

Atomic Data Structures

I left my hotel at 8 and walked 3 blocks that separated it from Hilton where my first session was taking place. It is important to pick a good session to start the week. I thought I did a good job in pre-enrolling in “How do atomic data structures work?” but unfortunately it didn’t live up to my expectations. It was obvious that the presenter knew his topic very well and this was his area of expertise however he gave the impression that he was nervous. Consequently, his talk was not well structured, his thoughts wandered and his jokes failed to revive the audience.

The session was centred around non-blocking data structures and how they work. The background consisted of the definition of atomicity, various standard ways to achieve it, what is a lock-free data structure, synchronized regions, memory barriers, various useful classes from the standard Java API such as java.util.concurrent.atomic.AtomicReference and java.util.concurrent.atomic.AtomicReferenceFieldUpdater. The background ended with a section about atomic updates.

The speaker then talked about linked queues, non-blocking linked queues and array-based bounded queues. It was a good refresher to listen to techniques such as the required steps in removing and adding an element. The most interesting part of the session was about the LMAX Disruptor.

LMAX is a trading platform. In their quest to achieve very low latency and high throughput with their Java platform, they created a framwork that has “mechanical sympathy” for the hardware (cache misses at the CPU-level are costly) and that is lock-free (locks requiring kernel arbitration are costly). Their solution is Disruptor and it sounds like a very interesting framework.

Constraint Programming API

My next session was one of the most interesting sessions of the day: Dr. Jacob Feldman‘s Constraint Programming API talk. I didn’t know Dr. Feldman previously but it turns out that he worked in University College Cork for 5 years. I was pleasantly surprised to hear that UCC”s Cork Constraint Computation Centre (4C) was the world leader in this area.

Constraint Programming (CP) is a programming model where the developer/designer states the relationships between the variables declaratively. CP separates Problem Definition from Problem Resolution. For example, you have a system where 3 variables have the following relationships (constraints):

  • x + y = z
  • x = y – 3
  • 0 <= x, y, z <=9

You could solve this simple problem by creating nested loops and by enforcing the constraints. But the API gives you a way to describe the problem in a readable fashion and solves the problem with better-than-reasonable performance.

Another simple example would be an application/component that displays a greeting message based on the time of the day, the gender, the marital status and the salutation of the person. With each variable the decision table grows and the combinations grow exponentially. You can easily see how far such a problem can go.

Dr. Feldman started his talk by defining what are optimization engines and what are the leading optimization techniques that are currently in use. He mentioned mainly two optimization techniques:

  • LP/MIP (Linear Programming/Mixed Integer Programming)
  • CP (Constraint Programming)

And as the name of his session indicated, he focused on Constraint Programming. He gave a very simple example how a problem resolution can hide the associated problem definition. As part of his coding example, where 3 nested loops were used to solve the problem, by optimizing the code, the problem definition became completely obfuscated to the reader. One couldn’t go back to the code and extract the initial constraints easily. Instead he used the CP API to define the problem more clearly before solving it in a Constraint Satisfaction Problem (CSP) example:

Problem p = ProblemFactory.newProblem("Test");
Var x = p.variable("X", 1, 10);
Var cost = x.multiply(3).multiply(y).minus(z.minus...

Then he quickly mentioned the concept of constraint propagation and bi-directional constraint propagation:

Imagine there are the following constraints:

  • x < y
  • 0 <= x, y <= 10

Given the constraints above the following emerges:

  • 0 <= x <= 9
  • 1 <= y <= 10

Changes in x causes changes in y:

  • x > 3
  • y > 4

JSR-331 defines a constraint programming API for Java. It has some basic concept such as Problem and Solver:


  • Var
  • VarReal
  • VarBool
  • VarSet
  • Constraint


  • Search strategy
  • Solution

The rest of the talk was going through various very interesting examples in different nature:

  • Map colouring problem where given a list of countries and colours the application has to match a country with a colour that is different then its neighbours’.
  • A logical problem: ” SEND + MORE = MONEY” where each letter corresponds to a digit.
  • The famous “Zebra Puzzle” that is said to be invented by Einstein.
  • Scheduling problems,
  • House construction problems,
  • Resource allocation problems,
  • Cloud balancing

It was a very interesting and engaging talk. I’m already downloading OpenRules to have a deeper look at it. For more information Dr. Feldman recommended the Handbook of Constraint Programming by Francesca Rossi, Peter van Beek, Toby Walsh.

Java vs Node.js

My next session went through building a RESTful Web API using oAuth 2.0 by very much concentrating on oAuth and infrastructure. The most interesting information that I retain from the talk is that even though they love Node.js’s even-driven model, it failed to make an impression on Shutterfly who still uses Java because Node.js hasn’t performed as well as they expected.

Continuous Integration and Automated Mobile Application Testing

The talk of Intuit’s Eing Ong was another great one. Concentrating on Android and iOS, she first described a typical setup. After a theoretical introduction to mobile tests in a continuous integration environment using and the two main automated testing techniques (instrumented and non-instrumented), she presented demos using iOS and Android ran by Jenkins.

Let me quickly reiterate some of the main points starting with the advantages of instrumentation and non-instrumentation:


  • Device platform agnostic.
  • Test code reuse.
  • Test language & test harness autonomy.
  • Support for:
    • Multi-applications testing
    • Custom UI Levels
    • Database/server API assertions
    • Use of external libraries (e.g. image manipulation)


  • Elements can be accessed.
  • Ease of debugging
  • Ease of test verification
  • Reduced tools dependencies
  • Support for:
    • Installing application
    • Launching application
    • Cleanup (kill application)
    • Test execution on device
    • Code coverage

When to use these techniques:


  • External interaction
  • Hardware interaction
  • Image-based features


  • Text-based features

Mobile automation tools:


  • Non-instrumentation
    • eggPlant
    • Sikuli
    • MOET
    • MonkeyRunner
  • Instrumentation
    • Robotium
    • Calabash
    • MonkeyTalk


  • Non-instrumentation
    • eggPlant
    • Sikuli
    • MOET
  • Instrumentation
    • UIAutomation
    • KIF
    • iCuke
    • Frank
    • UISpec
    • Zucchini
    • Bwoken
    • Calabash
    • MonkeyTalk

She was a great speaker who kept the session interesting.

Mobile WORA with Codename One

I’m very happy that Codename One session didn’t disappoint me and even exceeded my expectations. This talk was one of the highlights of the day. Presented mainly by Shai Almog accompanied by his colleague Chen Fishbein, both ex-Sun employees, the session covered Codename One, a cross platform mobile development tool in Java.

Codename One is free & Open Source tool. It allows Java developers to build true native apps for all major mobile devices. Its architecture is very interesting as some part of the heavy lifting is done on the cloud. This is especially useful for iOS applications as one needs a Mac in order to build an iOS application. Codename One has the following architectural parts:

  • Java API
  • Designer
  • Simulator
  • IDE Plug-in (NetBeans and Eclipse)
  • Build Server
  • Service Cloud

The Java API does most of the heavy lifting by compiling and glueing the user code to the target platform code. They are also talking to JetBrains to collaborate on a plug-in for IntelliJ IDEA.

Their Kitchen Sink demo looked very good on ten or so different devices running iOS, Android, Win8 Mobile and BlackBerry among a few others. However I need to try it for myself to get a real feel for it. As I am writing this post, Eclipse is installing the Codename One plug-in and I’m hoping to get my hands on a simple example very soon.

Their “free” usage is somewhat limited, especially for iOS applications. Every user gets 100 credits/month that can be spent for builds. An Android app consumes 1 credit/build however this goes up to 20 credits/build for iOS as it is a much more lengthy and costly (Mac hosting on the Cloud is more expensive). But I think this should be fine for most amateurish apps. To get unlimited credits, one pays $9/month, which covers, understandably, various costs associated by running servers on the Cloud. For enterprise level agreements, there’s a higher and more expensive tier.

All in all Codename One looked very promising. Very soon I’m going to have a first-hand experience using it. I’ll probably blog about it later.

It’s time for me to get ready for the 2nd day of JavaOne 2012. I’m hoping to meet you here tomorrow.

A demain!

, , , , , , , ,

  1. #1 by boardtc on September 28, 2016 - 2:49 pm

    You can delete my comment please! I thought your post was for this year!

    • #2 by Yagiz Erkan on September 28, 2016 - 11:28 pm

      Done! 🙂
      Thanks for visiting.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: