Thursday, November 22, 2012

Conclusion

Devoxx 2012 was great with high quality of sessions and enthusiastic speakers.
Besides updates in many technologies, I retain the following points:
  • JavaScript ecosystem is still growing. Tools will improve and consolidate.
  • Google initiatives push the browsers towards a complete platform hosting web components.
  • Many other companies hesitate to jump to JS now or stay with GWT.

We spend the friday night coding at the hotel. This hacking session was about integrating AngularJS with a vert.x backend. We manage to get "realtime" updates accross pages using the event bus and websockets.

Saturday 1:30 AM

Friday, November 16, 2012

Kotlin


Hadihariri.com

Design
. Java interoperable
. Fast as java
. Concise: without ceremony. Concentrate on value!
. Tooling

http://kotlin.jetbrains.org/

You can build app with any app. The point how many restrictions and frictions the language bring in. 

. Kotlin can target java or JavaScript 
. String interpolation
. Mutable and immutable (val) variable.
. No ; (optional)
. Have functions and classes and traits
. Just one constructor: use optional parameters
. Data classes: a DTO or a class with data and not behavior 
.. Out of the box toString, equal and compare methods
. Delegation is the dependency injection in kotlin
. Too many dependencies on a class it's a sign that the class is doing too much. You may miss an abstraction level.
. Naming is important. Do't use and on naming because it means the class or function is making different things
. Lambda expressions (function literals)
. Inheritance: everything is final unless you write open. The class must then be designed for inheritance
. Type inference
. High order functions
. Singleton objects
. Classes can e extend from trait, open classes or abstract classes
. Null protection: Save operator for java. In kotlin you can't get a nullpoinrtexception (unless you used !!)
. You don't cast, use is operator
. Conventions to override operators
. Sometime you can omit brackets: you can create (Static typed) dsl like in order to be more expressive
. Spek testing library : test business specification! Nice!!!!
. You can call from/to java : completely interoperable on the same project
. Scripting
. Module coming soon

. Vet.x kotlin available https://github.com/alextkachman/vertex-kotlin

Designed to enforce good design practices in real world apps.


Mgwt and PhoneGap


Mobile apps have to die. Mobile web will win. 
. Just too many apps
. Keep searching on the mess
. Search engine solves the mess but mobile web needed

PhoneGap: 
. bring standard API across devices.
. Once mobile web will be there PhoneGap should disappear (transitive)
. Some mobile os vendors are integrating phonegap so that apps do not have to provide it
. Use w3c API wherever possible... They remove implementation once implementation are compatible

Mgwt: mobile widget
GWT phonegap: missing part to make GWT apps run on phonegap

Mgwt has different CSS for different platform
Care about performance: JavaScript cost less that rendering. You should really optimize rendering.

Don't use JavaScript for all device rotation and animation staff so that mobile devices will use native code:
. Betters performance 
. Don't drain battery

JavaScript device orientation event fired at the end of the rotation. You see is frameworks are handling device rotation in JavaScript or natively: if handed natively you see rendering while rotating the device.




mgwt

Daniel introduces with thinking about the future explosion of mobile use cases and the proliferation of apps will make the user experience always worse.
This is again advocacy of mobile web.

He also spends time about explaining PhoneGap and why it's great.

The generation of browser-specific generation is leverage to choose the right look and feel for different platforms and media size.

The performance concerns linked mobile are apparently taken seriously and addressed. HTML5 and CSS3 are used at their max.

Offline support is included.

It leverages the GWT dead code removal to avoid downloading code that is not used by all platforms, down to the methods and fields.

Hazelcast

A clustering library based on multicast with higher level API than JGroups. Provides shared data structures like maps and queues.
Very lightweight with 1.7MB jar. Runs on rasperry py:)
Static assignment of data keys to cluster partitions. When new node appear, migration of data occurs automatically.
EE edition: elastic memory, jaas security.
Execution of callables can be delegated to nodes.
Persistence support with a map abstraction to implement. Support for write-behind storing data asynchronously in the background.
Many distributed structures supported. AtomicLong allows for clustering a sequence generator.
Plugable behavior to choose between values when nodes rejoin after network partition.

Party at Noxx

A bit harder to wake up this morning after the party night. JBoss sponsored it and offered drinks. Thanks.


The future of GWT, a general impression

Thursday, November 15, 2012

Spring 3.1, 3.2 and 3.3 (4.0?)


Spring 3.1
Webappinitializer: an interface to implement to build what you declare with web.xml programmatically 

Servlet 3.0: did you know it has standardized file uploaded? No more common-fileupload needed. If there as dependency, spring register it as a MultipartFile....

Spring mvc
. Requestmethodhandleradapter
.. Arbitrary map pings to handlers methods across controllers 
.FlashMap and FlashMapMamanger
.. Attributes that survive redirects

Update of supported libs
. Hibernate 4.0
. Quartz 2.0

Java SE7
. Jdbc 4.1
. Fork-join

Caching, persistence and lot's more in it!

Spring 3.2 (end 2012)
. Asynchronous servlet thought async mvc processing
.. Callable (request and response on different threads)
.. Used for DeferredResult and fileuploads
. Core framework refinements
. New spring mvc test framework 

Spring 3.3 (Q4 2013) - maybe will be called 4.0
. Full java 7 byte code (asm 4.0', cglib 3.0)
. Jms 2.0 : message oriented architecture - using annotations like jms listener
. Websockets : already supported in spring integration
. Next generation groovy support
. Java 8 and ee7 support (delayed)
.. Lambda expression (closure) : expect call back functions instead of anonymous classes on API 
. New date time API
. Parameter name discovery 
. Java.util.concurrency enhancements
. Jcache support 
. Jpa 2.1
. Jtan1.2 @transactional
. Bean validation 1.1
. Servlet 3.1
. Jsf 2.2

Angular


Complexity kills innovation.
State of the web makes users happy but not developers
Jquery is still imperative: you express how to do and not what to do
Angular is a declarative way: with declarative templating you just link things and magic happen. Changes to the model will be propagated to the view and at the end Dom updates are done automatically. So you don't work on the views updating fields but on the model.

Data binding
. Bind model to templates and let templates to generate the views 
. Two ways data bindings

Advanced templates binding collections with repeat hint
. Remove code to synchronize model and views through 2 ways data binding
. New spec coming to allow data binding on browsers and not in frameworks

HTML can be verbose
. Custom elements in form of reusable components (angular directives)
. New spec web components with native API (available in chrome code based)

Http://Buildwith.angularjs.org 

WebStorm is a great javascript IDE 

Scope is the glue between the view and the model, a sort of view model.

Angular filters for making conversions of data (from name to avatar URL)

Ng-model makes the 2 ways binding happening

Using mongolab which is a mongo db on the cloud (with rest API). Backend calls are asynchronous and not blocking (it would be bad on a single threaded environment like a javascript app). The API looks synchronous...

No global state on angular apps. Global state is bad and not testable. Angular use dependency injection instead.

Angular apps are testable because 
. Separation of duties
. Dependency injection  
. Guideline: no Dom manipulation on controllers (easy to test controllers because don't need a Dom)
. Using jasmine, extended with dependency injection (don't even need to write index.html.... There is a spectacular test runner. Spectacular runs on node and use plain browsers. It watch code and fire tests automatically on change)
. Mock-out server calls using dependency injection

Angular makes browser smarter and makes developers happy, productive and innovative. Really great!

Ah, back button just work on angular apps (routers)!





Angular oh yeah

Check cloud9 IDE, an online one.
Igor insist on declarative vs imperative style as introduction.
Vision to bring databinding as a browser feature in the future.
Again, web components could become a browser feature in a near future. Preview chrome builds implement that already.
ng-click vs. onclick: correct scope and no direct evaluation.
Guideline: no dom manipulation in controllers.

HTML 5 fragmentation

Android versions in use
2.3 35%
4.0 45%
html5e.org to find supported features by browsers, caniuse.com has a complete matrix
Websockets: check atmosphere
Lawnchair to abstract web storage

Mobile fragmentation

How big fragmentation is? How to deal with it? http://onslyde.com/reveal/devoxx12.html#

Distributed systems



The actor model is an dated model for building distributed system without dealing with complex and tricky shared state. At the basis it's quite simple: you model the system in term of unit of code (actors) receiving, elaborating and sending messages.

Each actor encapsulate state and behavior.

The system is made of millions of actors which are location trasparent..... Can run anywhere.

The system is build with the principle of http://letitcrash.com/.

Typesafe has an open source actor implementation called akka (providing both java ans scala API are every Typesafe product right now)

JavaScript testing


http://pivotal.github.com/jasmine is a behavior driven testing frameworks that can be integrated in eclipse (jasmine-junit-testrunner).

Using http://phantomjs.org/ (Headless webkit based browser) and maven-exec-plugin you can run your tests from maven and thus from Jenkins.

At the end you get a normal surefire report so that Jenkins shows the correct status....

Note that Browsers quirks can only be tested with selenium....

Web mobile performance

Not only true for mobile,... Here the presentation http://www.samdutton.com/devoxx2012/#1

Json schema

This is in my opinion something that will grow because enterprise development need that.
From validation to documentation and tooling. An RFC is filed.
In java some jackson based validator already exists. Let's see which support there are in js and tools.
This will surely make sj smile ;)

Auth protocols for modern apps

Great introduction to OAuth: https://oauth2-pres.appspot.com/

Need to look into it for client side apps (mobile or client side JavaScript)

Fast mobile UI tricks

<p dir=ltr> Sam from Google addresses many points to optimize the mobile web. This goes into many directions from compressing to javascript usage. It actually advocates to get more control of the HTML and CSS layer. One argument more for investing in base technologies instead of generated code.
Features ish, a viewport tester to make your apps correctly responsive to various media.
Think about battery APIs.


Dart libraries similar to angularjs

Discussing with Seth Ladd from Google, I learned that the web component of angularjs and dart are part of a common strategy. There is no coincidence if the template language and data binding paradigms are similar.
We can expect an evolution towards a consolidation of web development practices at Google.

Internet of things

It seam the social web is over. The next frontier is the Internet of things. I've never seen so many interest about embedded systems, NFC, robots, and so on.

Of coarse with cheaper standard connected hardware like http://www.raspberrypi.org/ we can imagine thinks that we're never possible before (even machine 2 machine use-cases).

Well, we will see if  the Internet of things will penetrate the real world or not......

Do you know the web?

If you think you know "the web", what about these tow HTTP headers:
x-xss-protection: 1; mode=block
strict-transport-security

Have ever heard about a sandbox attribute of the iframe element?

Web security

More and more applications run on the client side. But you can't really trust browser security: it's quite difficult to proctect against XSS.
Now this is over. The W3C is about to release a spec called Content Security Plolicy which allow you  to specify the minimum set of privileges to make yor content (or application) work. Read this great article from Mike about CSP.

PS CSS just protects you against reflected XSS. You still have to encode your content for stored XSS

Dev tools

Google chrome dev tools are just amazing, they allow you to know eve thing is happening under the cover: http://origin.igvita.com/slides/2012/devtools-tips-and-tricks/

Wednesday, November 14, 2012

SOA Service Versioning

This talk addresses the service versioning from a quite high-level perspective. Opposing design time and runtime versioning which is to be preferred. This later  propose the versioning of endpoints.
We see anti-patterns like coding the version in the schema.
Ideally, we should use rule-based contracts like Schematron instead of grammar based ones (XSD, WSDL).
In a project with the belgian federal government, a mediator (ESB or alike) was introduced to adapt old service contracts to use the new implementations.
Technique like using a client ID or service version to let the mediator to choose the actual service to call.
This must be documented in a soft document as part of the governance strategy.
There is today no standard policy for service versioning. WS-Addressing could be use for that but not completely.
The speaker proposes a WS-Versioning standard containing things like context/content based version routing, SOAP headers for version negotiation.
He deplores the fact that endpoint and schema locations are hardcoded in the contracts (WSDL, XSD). He proposes to delegate this to the mediator. It will dynamically resolve the appropriate one. We could as well pick the version using an additional parameter to endpoint WSDL URLs, e.g. ?WSDL&version=2.

Vert.x

App platform like node.js, akka or play
TCP or HTTP client and servers in many languages (js, java, ruby, ..). Leverages WebSockets.
Verticles: execution units of vert.x. They communicate by message passing (bus).
Strongly based on asynchronous model. Focuses on non blocking interactions.
Threading model using multi-reactor pattern. One event loop per core.
Long running operations not in event loop but use worker verticles to avoid blocking. Allows use of blocking API.
Move away from java-style concurrency model based on threading. No more synchronized, volatile...
It is in fact the actor model...
Provides automatic load balancing for TCP and HTTP.
Vert.x instances are clustered. Event bus is common and also extends to the client. Maybe a candidate for NEMO async communication.
Propose a module system with a repository. Yet another one! It can resolve and download modules even at runtime.
In the future, promises API should help structuring and overcome asynchronous handling issues. Also maybe continuations.
Nice, simple, polyglot.

Lambdas in Java 8

Joe Darcy explains why it is difficult to add such a feature in the language. They decided to use invokedynamic to let the runtime construct the lambda expression so that it can change in the future. Clever move.

JMS 2.0

Much simpler API. They don't want us to use JmsTemplate anymore....
JCA no more mandatory for cross-appserver communication.

Vagrant and Puppet

handy command line tools to easily create and manage vms as well as configurer them.

It even provides support for instanciating vms in junit tests.

SpringSource Ben Hale on designing RESTful services

A resource can be identified by several different URLs.
SpringSource provides a "rest shell" to quickly test your API.
Use PUT for most mutations. Actually by passing a partial representation of the resource.
Ben demonstrate the REST support in Spring.
HATEOAS, a driving principle saying HTTP as the engine of application state. This makes the client discover the URIs while interacting with the server.


Welcome to Devoxx

Organizers like tech. Our wirstbands are equiped with NFC. After sessions, we can vote for the talk using a receiver at the door. The rata is sent by http post to a node.js/mongoDB running on a.... Raspberry Py!

The intro was a nice robot choreography.

Stephan who funded the belgian JUG delivers the welcome keynote. He is also the creator of Parleys.com which has been rewriten from scratch with HTML 5. Interesting use of offline storage and sound device for recording.

Friday, November 9, 2012

Foreword


This year, we attend Devoxx. Be impatient for the whole bunch of cutting-edge hot buzzing stuff we're gonna feed this blog with!

See last years' reports at swisspostjazoon.

Please comment this blog entry to tell us what you're interested in. Check the schedule (wed-fri). We'll try to unveil the darkest secrets.