Devoxx 2014, Day 3

So the group of ConSol Devoxxians is now complete as the rest of the posse has finally arrived for the upcoming conference days in Antwerp. And we are all excited to hear the latest news in the opening keynote from Stephan Janssen, who is best named as the father of the Devoxx conference and the Parleys platform.

IMG_20141112_091456

Stephan has some great announcements in his keynote. One of them is to welcome Devoxx Poland as new family member in Krakow next year, which is indeed great news for our ConSol colleagues in Poland.

Another nice idea comes with the new platform called Voxxed (voxxed.com) which collects blogs, writings, white papers and interviews related to Devoxx technologies. Great collection point to get latest trends and news on technologies around the Java platform.

Next keynote is about RedHat and the JBoss xPaas cloud services on OpenShift. The demos looked fine and the idea to ship bpmPaas for instance with middleware integration on Camel and ActiveMQ is pretty nice.

Following up is Brian Goetz from Oracle with an update and forecast for Java 9 and JEE 9. Together with Jasper Potts they show a pretty nice demo of how Java can be used on a virtual car system. They show that Java nowadays is able to run on both embedded small devices like fan controllers and light sensors up to scalable backend services running somewhere in the cloud.

That completes the keynote action for today and now we dive into lots of conference talks:

“Beautiful Web Apps with Polymer and Paper Elements” by Martin Gorner (christoph)

I have been using Backbone.js and Bootstrap for several projects in the past. These APIs provided nice looking well structured JavaScript web applications for me. So now I am curious to see what Polymer and Paper Elements bring with the box.

Material Design

Material design is a design philosophy developed at Google. You can see a nice demo here: google.com/design

The design principles do use the paper metaphor a lot. Piece of papers can be cut into slices, you can see a natural drop shadow and you can put paper slices to the front and back. So Material design feels like natural to us users as we naturally know paper pieces and their behavior. Material design components emphasize the intentional use, the informational layout with big, bold fonts, colors, icons and pictures.

Here are some key components in this design philosophy:

  • floating action buttons: button in form of a dot with most frequent action in context located somewhere on the screen
  • meaningful animations: touch something, mobile first pardigm, show reaction, show interaction
  • contextual colors: extract the dominant color from a picture and use it in the curent context
  • hero elements: showing focus in given context

Paper Elements now is a group of components for the web implementing Material design principles. Polymer builds upon Html Web Components standards. What is it? The Web Component standard includes 4 specifications:

  • Html Import
  • Shadow Dom
  • Template
  • Custom elements

Custom elements is the most important specification for Web Components. You are able to create custom Html elements and rename or extend existing tags. We then just register custom elements via JavaScript.

Browser support for these 4 specifications is still ongoing. Of course Chrome is one of the first browsers that fully supports the specifications. And of course IE is way back in supporting these specifications.

Polymer as a framework implements these specifications to simplify the usage in a cross browser way. Polymer does a good job to put these specifications to usage right now even if not all browsers have support for the specifications. In addition to that Polymer offers a great lineup of ready to use components to build upon.

Now after clarifying the specification Martin shows some pretty awesome demos of Polymer and Paper Elements code. As a conclusion to me Polymer is a complete new way of adding styled, featured and skilled components to a Html web page. It is super easy to use and comes in very handy for any Html and JavaScript developer. The concrete design principles and the component nature that is very extendable is an impressing way of web development. I am very excited to learn more about this technology.

“What Have the Monads Ever Done For Us?” by Dick Wall (fabian)

It is very interesting to see how all the functional concepts like Monads become relevant at Java conferences with Java 8. Dick Wall, who would usually talk about Scala, had a lot of Java examples in his great talk “What Have the Monads Ever Done For Us?”.

Here’s one example of what Monads can do for us with Java 8: Imagine you want to implement the following method:

public <T> Optional<T> applyThreeTimes(T value, Function<T, Optional<T>> func);

It takes a value, and a function, and it should apply the function three times, like return func(func(func(value))). However, the function returns an Optional, which makes it impossible to just return func(func(func(value))).

The solution is to use Optional.flatMap:

return func.apply(value).flatMap(func).flatMap(func);

Cool, isn’t it? This is what Monads do to us in Java 8. For more info, watch Dick Wall’s talk on Parleys.

“HTTP 2.0 comes to Java. What Servlet 4.0 means to you” by Ed Burns (torsten)

In this talk Ed Burns explained what will be new in Http 2.0 and how these changes in Http will be reflected in the Servlet Api. He also showed how libraries that build on top of servlets such as - surprise - JSF can use the new Servlet and Http features.

I understood that Http will be bi-directional, server push will be possible, data send over the wire will not be (or is not limited to?) text but binary. Headers that are not changing during the client-server conversation such as the user agent only have to be send once.

The most relevant change is probably that the server can push resources to the client. If the client requests a page the server already knows what additional resources such as CSS or JS files the client will need with the requested page. So the server can send those resources to the clients cache in advance.

What could be a bit scary is that the wire format will be binary and not text any more (if I got it right). Text has some advantages and it would be a pity to loose those.

The Http 2.0 and Servlet 4.0 features are interesting for sure but I guess these could have been presented in a much shorter, crisper way. And for the JSF part of the presentation: my colleagues know what my experiences with JSF are.

“Spotify - audio delivery at scale” by Niklas Gustavsson (christian)

If you didn’t know, Spotify is a music streaming service which delivers music to more than 40 million users in 56 countries from a massive selection of songs. As a VoD veteran I was eager to know more about how they get a grip on such large scale instant availability of streams.

Here are some interesting facts about Spotify’s infrastructure:
The backend consists of more than a hundred single, self-contained services, each with a dedicated focus on one particular functionality, i.e. micro-service style. This allows for easy horizontal scalability and maintainability since every service has its own life-cycle. Here comes the surprising fact: services are developed by different teams which work fairly independently and can even choose their architecture, development process, and programming language among other things. This sure is an interesting approach. Equally astonishing to me was that these web services do not run in application servers but are simply executable JARs!

Since Spotify delivers music streams to end users in real-time they need to somehow enable instant availability of every song to every user. For this they have some tricks up their sleeves:

  • Distributed data centers with content around the globe using various CDNs (Content Delivery Networks)
  • Rule set on where to look for data based on the user's location and other user specific data
  • Prefetch algorithms based on the user's behavior
  • Head files (first 10 seconds of a song) are used to get songs started before the complete song can be successfully retrieved. It is then switched seamlessly on the client-side.

I was impressed with the amount of innovative, non-standard implementation which seems to work well. It seems large-scale problems still need custom-built solutions.

“Connecting Physical Devices to the Real-Time Web - Enterprise Grade WebSocket for the Internet of Things” by Peter Moskovits (ana)

This talk was my first talk in Devoxx (and the best one of Day 3).

I hadn´t seen anything about websockets and I saw that this talk had a „novice“ level, so I thought: “cool, I can learn some basics about websocket“. Then Peter started speaking and said: “well, I´m going to assume that you already know enough about websockets…“ xD So I didn´t learn too much about websocket basics with this talk but it was interesting enough to know that I want to read something about it after Devoxx.

He defined websockets as “TCP for the Web“, single socket connections with a bidirectional communication.

In one of the demos (called “Smartphone as a remote control“), he used a mobile and a remote control car (connected to a raspberry Pi). He had created an HTML5 app using a Javascript library, to send messages through the websockets. The idea here is that the web app client sends events to the websockets and the car is listening to these events and then react properly. He called that „Event-driven web“.

He didn´t use more than 10 lines of Javascript code:

var mySocket=new WebSocket(“ws:/…”);
mySocket.send("hello world");

He showed also another demo where they had a quadcopter with a lot of sensors for humidity, temperature, … (connected to an Arduino) and the data collected by the sensors were distributed to the web over a satellite network. The overall latency between sending the quadcopter data and showing it in the browser client was under 1 second!

In the middle of these architectures, the Kaazing WebSocket Gateway was used. It´s important to know that Peter works by Kaazing… so it would be nice to know what other alternatives can be used.

“Modern Web Architecture” by Ted Neward (georgi)

The talk should have bean about Modern Web Architecture. In fact the half of the talk was about a project called Xanadu, which has been started in the 1960s or something like that and the 1.0 has been delivered somewhere in the 90s. If you are interested in this project, you can read something about it on wikipedia http://en.wikipedia.org/wiki/Project_Xanadu.

For my understanding this has nothing to do with modern web architecture. It is for sure an anti-example how you should do it, but was this really so important to talk about it more than 20 minutes? I like Ted as speaker, but because of Xanadu there was so little time at the end of the talk for the really interesting slides. The last five minutes were fast like an ignite talk. I was also in another talk of Ted, which was about Swift and it was a really good and entertaining one.

Nevertheless a good take away from were the following 10 things, which should always be considered during developing an enterprise (web) project:

  • The network is NOT reliable
  • Latency is NOT zero
  • Bandwidth is NOT infinite
  • The network is NOT secure
  • Topology DOES change
  • There is NOT only one administrator
  • Transport cost is NOT zero
  • The network is NOT homogeneous
  • The system is NOT monolithic
  • The system is NOT finished

“Java 8 - Understanding Functional Interfaces and Writing Mixins” by Heinz Kabutz (georgi)

At the very beginning Heinz has introduced the new lambda syntax in Java 8 and functional interfaces, which in fact is an interface with one single abstract method. Then there were some examples which class is a functional interface and can be used with the new lambda syntax.

For example Runnable and ActionListener are functional interfaces. EventListener is not a functional interface since it has no methods at all. MouseListener is also not a functional interface, because it has more than one single method defined.

He has shown an interesting example for logging using the java.util.logging and the new Supplier interface in Java 8.

Java 5,6,7

log.debug("logging..." + System.currenttimemilis())

Java 8

log.debug(() -> "logging..." + System.currenttimemilis())

Due to the lazy evaluation of the lambda expression, is the lambda implementation is more efficiently than the one implemented in Java 7. Executing the code 100 billion times has shown a significant time difference.

At the end of the session mixins has been introduced and the way they can be written in Java, which in fact is done by combining functional interfaces with interface default methods. Mixins could be used for example to add additional functionality to Enums.

Within the demo he has introduced a FocusEventProducerMixin, which has had a single method addFocusListener and two default implementations for focusGained and focusLost.

All the code shown in the presentation is available on github. So feel free to try it on your own!

Author: Christoph Deppisch
Categories: devoxx, development