JAX Conference 2013

IMG_20130604_134149

A few days ago I went with a friend to JAX conference 2013, a conference in which experts & leaders from the industry share their thoughts and experience with other Java community members.

We started with a session about testing HTML5 in all browsers using Java by Kevin Nilson. He got me hooked right from the beginning with two nice Javascript riddles:

The first:

var t = ['a','b','c',]; // pay attention to the last comma
console.log(t.length);

Is that a legal expression? (yes)
What’s the length? (hint: browser dependent…)

The second:

var abcData = ['a','b','c'];
var xyzData = ['X','Y','Z'];

function xyz(){
  var msg = '';
  for(i=0;i<3;i++){
      msg += xyzData[i];
  }
}

function aXYZbXYZcXYZ(){
  var msg = '';
  for(i=0;i<3;i++){
      msg += abcData[i];
      var tmp = xyz();
      msg += tmp
  }
} 

What’s going to be printed ?
My guess was “aXYZbXYZcXYZ” – but it was wrong…
If you want to see the answer – you can watch the video of the session (in the link above).

After the warm-up, Kevin discussed the limitations of using selenium to test mobile and the advantages of using tools like TestSwarm and QUnit.

Getting Started with WebSocket using Java by Arun Gupta introduced a light full-duplex bi-directional communication protocol between server and client. “Upgrading” HTTP protocol to WebSocket is done using HTTP-headers:

upgrade: websocket
connection: upgrade

for which the server supposed to return HTTP code:

101 - switching protocols

Full-duplex means that once communication has been established, both sides are peers in the manner that both can send information to each other simultaneously (unlike HTTP in which only the client triggers the request and the server can only respond). Another advantage of using Websocket is the speed: the thin frame that is used by the protocol allows sending bigger chunks of data more quickly than using HTTP which carries the overhead of sending headers in every request/response. Arun benchmarked the performance of WebSocket vs. REST and the difference were (as expected) huge, for example: sending 5,000 messages of 1KB each using REST took 55 seconds and only 1.2 seconds using WebSocket.

Another interesting session was: Apache TomEE, Java EE 6 Web Profile on Tomcat by David Blevins. TomEE (pronounced: “Tommy”) is a project that aims to combine plain vanilla Tomcat with some of the more common JavaEE components, such as EJB, JPA, JMS and more (they call it “Web-profile” and it contains about half of the “full profile”). Recently they passed the TCK (Technology Compatibility Kit) of the Web-profile, David says, without increasing Java memory!

IMG_20130604_143229
In The Road to Lambda (will be released in Java 8 – around sprint 2014) Mike Duigou showed the power of using lambdas which makes your code simpler (reduces the boilerplate), and as a bonus you get lazy evaluation and support for parallelism. Like Generics (introduced at Java 5) helps us abstract over types, the goal of Lambda is to help us better abstract over behavior (passing “behavior” = method, between objects using vars).

I got to admit that even though I like functional programming I hate the use of anonymous classes in Java, to me, it always felt like some kind of ugly hybrid between OOP and functional programming:
Lambda (closure) ties up code to data, and the equivalent to it in OO is… well, Objects.
So I was pretty skeptical about the whole idea but I’m glad to say that I was wrong!

The session started by using the fact that other languages like C++ and C# already introduced closures (bad reasoning TMO), but then Mike gave a couple of good motives, one of which was the transformation of the following code:

for(Shape s: shapes){
    if(s.getColor() == RED)
        s.setColor(BLUE);
}

to:

shapes.forEach(s->{
    if(s.getColor() == RED)
        s.setColor(BLUE);
});

At first glance it looks like there’s no much difference besides the different syntax, but what really matters here is what goes under the hood: the former piece of code translates into an iterator that traverse the shapes in a serial manner, while the latter enables the library to set its own implementation which could, for instance, support parallelism.

Another example which I really liked is

int sumOfWeights = shapes.stream
				.filter(s->s.getColor == BLUE)
				.map(s->s.getWeight())
				.sum();

or even a bit simpler:

int sumOfWeights = shapes.stream
				.filter(s->s.getColor == BLUE)
				.map(Shape::getWeight)
				.sum();

but what really impressed me was how easy it is to modify the code to use parallel processing:

int sumOfWeights = shapes.parallel()
				.filter(s->s.getColor == BLUE)
				.map(Shape::getWeight)
				.sum();

IMG_20130604_153015

Since this post is becoming too long I won’t write about other sessions, that said, I cannot not mention (and post links to) other great sessions such as Designing a Beautiful REST+JSON API by Les Hazlewood, The Spring 3.1, 3.2 and 4.0 Update by Josh Long and The Java EE 7 Platform: Boosting Productivity and Embracing HTML 5 by Arun Gupta.

See you in #JAXConf next year!

Advertisements
JAX Conference 2013

Thoughts about GMIC SV and GDG DevFest

GDG-San-Francisco-DevFest

Like I wrote yesterday, GMIC SV sucked. Supposedly, it had different sessions for entrepreneurs & executives, start-ups and developers. I think that the main purpose was to help US and Chinese companies to do some networking – and maybe it was successful from that perspective, but as a developer who made the effort to participate (on a Friday!) in code-labs and learn about new technologies – it pretty much sucked…

The WiFi connection was horrible, which effected the speakers presentations as well as the attendees. They had separate rooms with light refreshment and coffee (for developers and executives), only that the developers’ room ran out of coffee during the first hour and it was left this way at least until noon (I didn’t bother to check later). Also, the A/C was working so hard in one of the labs – that I’m pretty sure that at some point I noticed a polar bear running to the bathroom…

I went to three sessions and one keynote and only the first session was interesting (to me). During lunch break, we went out and strolled the streets of downtown San Jose looking for something to eat (since food was supplied only for Executives and VIPs). We had less than an hour – if we wanted to make it to the next session.

It kind of felt that this convention wasn’t REALLY for developers and we were treated like we belonged to the lowest caste…

Around 15:30 we decided we’ve had enough of it, and of course we didn’t bother to go for the second day. Luckly for us, we found out about GDG San Francisco DevFest (which took place in Google’s offices in Mountain view) and bought tickets on time. This one was a totally different story. You can see the agenda for yourself.

We started with Google wallet session by Mihai Ionescu which was very interesting especially since I’ve been in the E-commerse business for more than five years now.
My conclusion from that session is that Google, like PayPal wallet, supplies very limited payment processing services:

  • supports only credit-cards
  • supports only 9 currencies
  • supports only single items (can’t create a cart and checkout with multiple products)
  • supports only monthly subscriptions (recurring charges)
  • does not support configurable soft-descriptor (that’s what the customer sees in his bank statements)
  • does not support currency-conversion – it’s the vendor’s responsibility to calculate the conversion: Google will charge the amount that is passed in the request in the same currency that you state – you cannot provide one price in USD and expect Google to calculate the conversion for you
  • you (the vendor) need to open a merchant account
  • in case of a refund/chargeback – no “hedging” is done – so if the customer was charged in Euro and after three months the dollar dropped and the customer asked for a refund – the vendor will pay back the amount in US Dollars converted from the current rate of Euro – which might result in loss of money

But of course, there are “Pros” too, after all it’s Google:

  • commission rates are WAY lower than PayPal’s: 5% or 1.9% + 30 cents per transaction (the lower between the two!)
  • no refund/chargeback fees!
  • it used to force the user to open a Google wallet account (like PayPal’s) and now you can pay as a “guest”
  • will support quarterly subscriptions (probably by the end of Q1 2013)
  • simple integration using Javascript, json (JWT – json web token) and server-side

The second session was: Start ups by Rob Walling and I have only one word to say:
AWESOME!

After lunch, which was really nice, we joined a session on YouTube by Jeremy Walker, which described YouTube API capabilities that will be available in v3 once it’s out (should be in less than a month).

And the last talk for the day (for me) was about Google+ by Jonathan Beri which discussed the new API – personally it was less relevant for me – but yet it was interesting.

I’ll wrap up this time with the geekiest joke of the week by Song from GMIC SV – HTML5 code-lab:
man: make me a sandwich
wife: NO!
man: sudo make me a sandwich
wife: okay

Thoughts about GMIC SV and GDG DevFest

Silicon Valley CodeCamp

I know it’s totally geeky, but I’m excited about the CodeCamp this weekend as if I was a kid that his parents are taking him to six-flags…
There are so many interesting sessions, all the timeslots have at least 3-4 talks I’d like to hear…

On a totally different note, there’s a new video-clip that drives everyone crazy calledGANGNAM STYLE and naturally, many people created their own version. LOVED it!
Have a great weekend guys, I know I will ;)

Silicon Valley CodeCamp