vendredi 18 septembre 2009

Veille technologique semaine 38

Pour le bulletin de la semaine 38, je vous propose les articles suivants :
  • Sortie des spécifications 4.2 de la plateforme OSGi : avec les services remote, ....
  • Première implémentation de la norme WebGL dans WebKit : le 3D natif en HTML 5. La vidéo est à voir : http://www.youtube.com/watch?v=2rpKpj6ZO9w&hd=1
  • Un résumé des transactions mémoire : c'est un concept qui commence à ce démocratiser, les articles et les implémentations commence à être en "prime time". C'est donc une deuxième lecture que je vous propose. A intégrer rapidement dans vos socle technique. Un zoom sur le pattern MVCC : Multi Version Concurrent Control qui permet de faire des transactions sans vérrou pour les lecteurs, mais uniquement pour les écrivanis. Le COTS JBossPojoCache en version 3 utilise ce pattern très performant (plus de 10 000 transactions par seconde par instance cache ! Cela nous laisse de la marge).
  • Un bulletin spécial sur le langage de programmation Scala : c'est un langage dont le compilateur génère du byte code JVM ou DotNet, proposé comme remplacement du langage Java ? Scala le futur de Java ?
  • Le JDK 7 et les NIO : nouvel accès au système de fichier.
  • Le JDK 7 et une proposition de fournir une implémentation par défaut des méthodes de la classe Object. Il serait grand temps !

OSGi 4.2 released
The OSGi Alliance has just released the OSGi 4.2 specification. Although early drafts of it have been made available, this is the final release version. Some engines, like Equinox and Felix, have already begun working towards providing 4.2 compatibility with their earlier 3.5 and 2.0 releases (respectively). However, as OSGi 4.2 had not been released at the time, they couldn't claim to be OSGi 4.2 compliant. Now that the release has been done, it's a matter of time before the teams on each determine what still needs to be done (if anything) in order to meet the specs.


WebGL fait son apparition dans Webkit
Les dernières build de Webkit embarquent une pré-version de WebGL. Ce standard chapeauté par le consortium Khronos Group, a pour vocation d'afficher de la 3D dans une page web sans plug-in. Pilotable intégralement par JavaScript, et intégrant des liens vers OpenGL ES 2.0, il permet l'affichage de modèles 3D en tirant parti de l'accélération matérielle des machines.

Wolfire
, a publié une petite vidéo montrant ce qu'il est possible de faire avec cette technologie. Si cette dernière s'impose, elle pourrait notamment révolutionner les jeux en ligne.


What is WebGL?

WebGL is basically an initiative to bring 3D graphics into web browsers natively, without having to download any plugins. This is achieved by adding a few things to HTML5, namely, defining a JavaScript binding to OpenGL ES 2.0 and letting you draw things into a 3D context of the canvas element.

What does that mean exactly? Here's a video of the initial WebGL layout tests included in WebKit r48331. Be sure to watch them in HD!

http://www.youtube.com/watch?v=2rpKpj6ZO9w&hd=1

These demos are very simple, but they're a great start. I'm sure we'll see some complicated OpenGL scenes pop up soon, and I'm curious to see how complex they can get before FPS becomes a factor. Maybe I'll make a WebGL mini-game in some spare time!

Why is this cool?

This has a million applications - I'm obviously biased towards gaming though. Basically, imagine playing Lugaru or Black Shades instantly in your browser, on any platform, without having to install anything. In the same way Gmail is killing desktop mail applications, full-fledged 3d video games could start migrating to the web.

Flash gaming would have a serious run for its money as more advanced, standards-based, hardware-accelerated games started popping up. This would have huge implications for the entire PC gaming market, which I might explore in a separate blog post.

Of course, this utopia of browser-based OpenGL gaming will require the cooperation of all major browser vendors. When will we start to see WebGL outside of isolated, developer previews?

When can we actually use it?

This is a brand new web technology, we won't be seeing this for another 10 years right? Well, this actually has the potential to show up in browsers in the not-so-distant future. As you've seen above, this is already significantly developed in WebKit. It will take a little while before it's enabled by default in thenightly WebKit builds and longer still for Safari to adopt it, but that could theoretically be as soon as six months from now.

The same goes for Google, FireFox, and Opera, who are part of the WebGL working group. Google Chrome, of course, is based on WebKit and has pledged to support this (in addition to its own O3D, which hopefully will be standard soon as well). FireFox has an extension which enables an implementation of Canvas 3D, and Opera has supported its own (albeit different style) canvas 3D for a while.

What about Internet Explorer, which hardly supports existing standards, let alone up and coming ones? Given Microsoft's history, I wouldn't hold my breath, but there will undoubtedly be some kind of extension that simulates WebGL, like there is for the canvas element. Until then, it will be yet another awesome WebKit feature for people who are developing specifically on the WebKit platform to brag about.

It will be pretty cool when Awesomium updates to the latest WebKit and we can render 3D scenes inside of our own 3D scene!


Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet


WebKit adding support for GPU-accelerated 3D via WebGL
WebKit developers are adding support for WebGL, a new API designed to deliver hardware accelerated 3D graphics within the web browser without the use of a separate plugin.

According to a report posted by a developer on the Wolfire Blog
, WebGL provides HTML5's Canvas with hardware accelerated 3D rendering features by adding a JavaScript binding for OpenGL ES 2.0, enabling web developers to present 3D scenes and models that tap the full native processing power of the client's graphics hardware.

The open, royalty-free WebGL specification is administered by the Khronos Group, the same organization that manages OpenGL and the new OpenCL API for cross-platform and GPU vender-neutral general purpose computing on GPU hardware.

Being able to render rich 3D content on the web without a proprietary, opaque binary runtime plugin such as Adobe Flash or Microsoft's Silverlight means that any standards-based device can be targeted by web games developers, from a desktop web browser to a mobile device like the iPhone. The technology can also be used to animate complex navigation and data visualizations.

Earlier this summer, WebKit added support for CSS 3D transforms
, which allow web developers to position page elements in a 3D space. Apple rapidly added support for that feature in iPhone 2.0 and Safari 4.0.

Support for WebGL's hardware accelerated 3D rendering is likely to be similarly exposed within desktop and mobile versions of Safari over the next few months, opening up new potential for increasingly sophisticated web apps and rich media
content. A public release of WebGL is scheduled for the first half of 2010.

Google, Mozilla, Opera and various GPU hardware vendors have joined in on the industry consensus to deliver advanced 3D web graphics using open standards, building support behind the Khronos portfolio of technology specifications.


Software Transactional Memory : STM


Overview

Writing software applications in which parts of the application run in concurrent threads introduces many challenges not present in single-threaded applications. Since the order of operations isn't fixed, failures can be difficult to repeat. Also, thoroughly testing the software requires more effort.

The goals of this article are to:

  • spread knowledge about STM
  • support reasoning about the performance characteristics of STM
  • encourage implementations of STM for many programming languages
  • provide developers with enough understanding of the Clojure STM implementation that they can develop tools to help with tuning STM usage (such as tracking the number of times a transaction retries and why it retries)
Conclusion

STM implementations are somewhat complicated. However, developing applications that use STM is less complicated and easier to get correct than using a lock-based approach. It seems likely that over time using STM will become as common and trusted as using garbage collection is today.


Multi-Version Concurrency Control (MVCC)

"MVCC uses timestamps or increasing transaction IDs to achieve serializability. MVCC ensures a transaction never has to wait for a [database] object by maintaining several versions of an object. Each version would have a write timestamp and it would let a transaction read the most recent version of an object which precedes the transaction timestamp."

"If a transaction (Ti) wants to write to an object, and if there is another transaction (Tk) (that also wants to write it), the timestamp of Ti must precede the timestamp of Tk for the object write operation to succeed. Which is to say a write cannot complete if there are outstanding transactions with an earlier timestamp."

"Every object would also have a read timestamp, and if a transaction Ti wanted to write to object P, and the timestamp of that transaction is earlier than the object's read timestamp, the transaction Ti is aborted and restarted. Otherwise, Ti creates a new version of P and sets the read/write timestamps of P to the timestamp of the transaction." (The Clojure STM implementation does not use read timestamps.)

"The obvious drawback to this system is the cost of storing multiple versions of objects [in the database]. On the other hand reads are never blocked, which can be important for workloads mostly involving reading values [from the database]. MVCC is particularly adept at implementing true snapshot isolation, something which other methods of concurrency control frequently do either incompletely or with high performance costs."

"A transaction executing under snapshot isolation appears to operate on a personal snapshot [of the database], taken at the start of the transaction. When the transaction concludes, it will successfully commit only if the values updated by the transaction have not been changed externally since the snapshot was taken."


Scala et avenir de Java
Depuis son apparition en mai 1995, juste avant l'explosion d'Internet, Java a beaucoup évolué. Il est notamment devenu une référence en matière de développement d'applications professionnelles, Web comme Desktop. Après ces 14 ans il convient de dresser un bilan sur l'adéquation de Java aux objectifs et contraintes actuelles.

On constate deux approches distinctes :
Beaucoup se focalisent sur Java 7 : les discussions font rage sur les évolutions qui pourraient composer cette nouvelle version. D'autres considèrent que Java, avec sa spécification de 600 pages, est devenu trop complexe : qu'il ne pourrait donc plus apporter de réelle révolution et qu'il faudrait donc réfléchir à son digne successeur.


Scala as the long term replacement for java/javac?
The long term replacement for javac? Certainly the dynamic languages like Ruby, Groovy, Python, JavaScript have been getting very popular the last few years - lots of folks like them.

Though my tip though for the long term replacement of javac is Scala. I'm very impressed with it! I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy.


Is Scala really more complicated than Java?
After a conversation with a guy at work, I was inspired to take a look at whether
Scala is inherently more complex than Java, and decided it wasn't.


NIO.2 : Accès au système de fichier dans le JDK 7
Dans le cadre de la JSR 203, plus connu sous le nom de NIO.2, Java 7 va enfin être doté d'une toute nouvelle API pour l'accès au système de fichier, en remplacement de la classe File, qui malgré le fait qu'elle soit logiquement très utilisée, reste très problématique et incomplète dans de nombreux cas...
Mais que reproche-t-on à l'API de la classe File ?


JDK 7: What Frequently Rewritten Methods Should be Included in java.util.Objects?
In preparation for the arrival of a new class in JDK7 called java.util.Objects which will contain frequently-written utility methods, Joe Darcy of Sun has put out a request to the OpenJDK core-libs-dev group for ideas on what methods should be contained in this class. InfoQ would like to pass this request along to the wider Java community.

vendredi 11 septembre 2009

Veille technologique semaine 37


Pour le bulletin de cette semaine, je vous propose les sujets suivants :
  • le club Java de Paris, propose une soirée sur la qualité du logiciel : il faut s'inscrire.
  • Le langage scala : prise en charge nativement de la programmation concurrente. Introduction.
  • La compression de pointeurs des JVM 64 bits : la théorie
  • Dans les architectures Event Driven Architecture (EDA), le Complex Event Processing : CEP c'est quoi ?
  • Article d'IBM sur Java temps réel : qui est responsable du non déterminisme dans la JVM et quelles sont les solutions ?
  • Un complément sur les évolutions du JDK 7 : après les évolutions du langage, les évolutions des API avec les Java Specifications Request (JSR) prévus.
  • Le détail de la sérialization Java.

Bonne lecture.


JUG Soirée Qualité du logiciel (15/09/2009)
Mardi 15 septembre 2009
Dans les locaux de l'ISEP

19h15 à 19h30 : Accueil
19h30 à 20h00 : Les frameworks open source

Le monde Open Source Java proposent de nombreux outils d'analyse de code (PMD, CPD, FindBugs, JDepends, CKJM, JavaNCSS, Crap4J, Emma ...). Ces moulinettes produisent des dizaines de métriques (parfois cryptiques, parfois abstraites, parfois élaborées par des docteurs en informatique, barbus!!).
Basé sur ces métriques, des outils comme XRadar, Sonar, QALab vous permettent de créer de joli rapports (parfois même de beaux graphiques) que les esthètes, les clients, les architectes ou encore les chefs projet peuvent apprécier.
Mais, nous, petits artisans (ou grands industriels) du Java/JEE, devrions nous nous soucier des dépendances cycliques, de la complexité cyclomatique de notre code ? du niveau d'abstraction de nos paquets ? de la détection de tel ou tel pattern dans l'arbre syntaxique de nos objets Java ? Que devrions-nous réellement surveiller ? Quelles règles suivre ? Quels moyens pour voir ces règles comprises, acceptées et respectées ? Intervenants : Romain Pelisse, François Le Droff

20h00 à 20h30 : Sonar
Comme toute activité humaine, développer du code source nous expose en continu à la tentation de céder aux 7 péchés capitaux du développeur. Cette présentation ludique et interactive permettra aux participants de (re)découvrir ces 7 péchés et la manière de les chasser avec Sonar.
Pour rappel, Sonar est une plate-forme de qualimétrie Open Source éditée par la société SonarSource.
Intervenant : Olivier Gaudin

20h30 à 21h00 : Buffet
21h00 à 21h30 : SonarJ


Langage Scala
Scala is an object-oriented programming language for the Java Virtual Machine. In addition to being object-oriented, Scala is also a functional language, and combines the best approaches to OO and functional programming.

In Italian, Scala means a stairway, or steps—indeed, Scala lets you step up to a programming environment that incorporates some of the best recent thinking in programming language design while also letting you use all your existing Java code.

Artima is very pleased to publish the first book on Scala, written by the designer of the language, Martin Odersky. Co-authored by Lex Spoon and Bill Venners, this book takes a step-by-step tutorial approach to teaching you Scala. Starting with the fundamental elements of the language, Programming in Scala introduces functional programming from the practitioner's perspective, and describes advanced language features that can make you a better, more productive developer.


A Scalable Language
The name Scala stands for "scalable language." The language is so named because it was designed to grow with the demands of its users. You can apply Scala to a wide range of programming tasks, from writing small scripts to building large systems.

Scala is easy to get into. It runs on the standard Java platform and interoperates seamlessly with all Java libraries. It's quite a good language for writing scripts that pull together Java components. But it can apply its strengths even more when used for building large systems and frameworks of reusable components.


Compressed oops in the Hotspot JVM
What's an oop, and why should they be compressed?
An "oop", or "ordinary object pointer" in HotSpot parlance is a managed pointer to an object. It is normally the same size as a native machine pointer, which means 64 bits on an LP64 system. On an ILP32 system, there is a maximum heap size of somewhat less than 4Gb, which is not enough for many applications. On an LP64 system, though, the heap for any given run may have to be around 1.5 times as large as for the corresponding IPL32 system (assuming the run fits both modes). This is due to the expanded size of managed pointers. Memory is pretty cheap, but these days bandwidth and cache is in short supply, so significantly increasing the size of the heap just to get over the 4Gb limit is painful.


Complex Event Processing (CEP), de quoi s'agit-il?
Depuis quelques années, on assiste à l'émergence de nouvelles solutions logicielles, dont le concept à la base est loin d'être nouveau, mais dont l'offre est de plus en plus riche et perfectionnée, à savoir, Complex Event Processing. Alors de quoi s'agit-il ?


Developing with real-time Java, Part 1: Exploit real-time Java's unique features
Take advantage of real-time Java performance in your application.


JDK 7
This is the list of features being developed by Sun, and others, for JDK 7.


JDK 7 Milestones
The JDK 7 development schedule is divided into a sequence of milestone cycles,
each six to seven weeks in length. There will be no formal beta or early-access
releases, as in the past. Major features and other potentially-destabilizing changes
will targeted for integration early in a specific milestone. For more information,
please see the current draft of the JDK 7 Development Process.


The Java serialization algorithm revealed
Serialization is the process of saving an object's state to a sequence of bytes; deserialization is the process of rebuilding those bytes into a live object. The Java Serialization API provides a standard mechanism for developers to handle object serialization. In this tip, you will see how to serialize an object, and why serialization is sometimes necessary. You'll learn about the serialization algorithm used in Java, and see an example that illustrates the serialized format of an object. By the time you're done, you should have a solid knowledge of how the serialization algorithm works and what entities are serialized as part of the object at a low level.

vendredi 4 septembre 2009

Veille technologique semaine 36

Pour le bulletin de cette semaine, je vous propose les sujets suivant :
  • un concours proposé pour les développeurs JavaFX : faire une application d'ici le 30 septembre JavaFX en 30 lignes de code maximum. A vos NetBeans !
  • la liste courante des évolutions du langage Java prévues pour le JDK 7. Quand pensez vous ?
  • un article sur l'architecture logicielle à base de composants : quelle est la différence entre une architecture modulaire et une architecture à base de composants ? La séparation des préoccupations.
  • La JVM qui devient multi-langages : la plateforme Java (la JVM + les API) est plus importante que le langage Java lui-même.
  • Les cinq conseils pour faire des revues de code efficaces.
  • La JVM et son tuning : explication.
  • Les optimisations du JDK 7 : encore des améliorations de performance possible.
Bonne lecture


Starting Soon: New JFXStudio Challenge for JavaFX Developers
Josh Marinacci has announced a new JFXStudio Challenge: Small is the New Big. JavaFX developers will have from September 8 through September 30 to develop an interesting application in 30 or fewer lines of code (3000 characters maximum), all contained in a single JavaFX file.


Liste finale des évolutions du langage Java apportées par le JDK 7

En début d'année, Sun a initié le Project Coin, un sous-projet d'OpenJDK visant à recueillir les propositions d'évolutions du langage Java pour le JDK 7 prévu pour début 2010. Les soumissions ont été nombreuses et Joseph D. Darcy, leader du projet, informait régulièrement la communauté sur l'avancement du processus de sélection. C'est maintenant la liste finale des évolutionsqu'il annonce. Sauf problème de planning, il s'agit donc là de ce que le langage Java sera dans JDK 7 :

On est loin de la liste d'évolutions très audacieuses initialement prévue pour JDK 7, mais les évolutions finalement retenues ont l'avantage d'être réalistes en terme de temps d'implémentation, tout en apportant un confort supplémentaire au quotidien pour les développeurs Java.

Rémi Forax, très au fait des développements sur l'OpenJDK, propose d'ailleurs son analyse des tâches restant à accomplir et de leur complexité pour chacune des évolutions.


Final list of Project Coin changes for JDK 7
Project Coin got its name because it is about making "small change"(s) to the Java programming language for JDK 7. Sun's Joe Darcy has been leading the project. In his blog post, Project Coin: The Final Five (Or So), has announced which small changes will actually make it into JDK 7.


Project Coin: The Final Five (Or So)


Component-Based Software Engineering
the benefits of components modularity, focusing exclusively on the component based architecture software paradigm. Component's relationship to reuse and touch on how components helps ease maintenance and improve extensibility, also making the system easier to understand, maintain, and extend:

Maximizing reuse complicates use.


Java yields to other languages on the Java Virtual Machine
the JVM is becoming a polyglot platform, where developers can take advantage of different languages for different needs.

Java the platform taking more prominence than Java the language. Sun's Bray emphasizes that the Java platform is becoming more important than the language itself: "I personally think that the Java platform has more strategic importance than the Java language, going forward."



5 tips to make good code reviews
Code reviews are one of the most valuable engineering practices.
1. Code reviews improve the quality of the code through the suggestions from the code reviewer.
2. Code reviews are a great tool to indirectly teach other developers parts of the system they may have to maintain in the future.
3. Code reviews encourage people to learn best practices from other developers.
4. Code reviews can be used as a validation of the clarity and simplicity of the system.

You may have noticed that I have omitted from the list that code reviews help finding bugs and enforce coding standards and that's because:
1. Code reviews SHOULD'T be performed to find errors in the code.
2. Code reviews SHOULD'T be performed to enforce coding standards.



Java Performance Tuning, Profiling, and Memory Management
Java application performance is an abstract word until you face its real implications. It may vary depending on your interpretation of the word 'performance'. This article is meant to give the developer a perspective of the various aspects of the JVM internals, the controls and switches that can be altered to optimal effects that suit your application. There is no single size that can fits all. You need to customize to suit your application. You may be facing one of the issues listed below:

1. The dreaded java.lang.OutOfMemory Error
2. Your application is literally crawling.

Before we take the plunge into solving the issues, we first need to understand some of the theory behind the issues.


Java HotSpot Virtual Machine Performance Enhancements - JDK 7

  • Zero Based Compressed OOPS
  • Escape Analysis Improvements
  • NUMA Collector Enhancements
  • NUMA Performance Metrics

vendredi 28 août 2009

Veille technologique semaine 35

Bonjour à tous,

pour le bulletin de la semaine 35, je vous propose les articles suivants :

  • La société Terracotta achète le produit EhCache : explication marketing et technique de ce rapprochement.
  • La sortie de eclipse galileo version 3.5 : où comment l'outil peut nous aider à coder plus rapidement ?
  • Un article théorique sur les transaction mémoire logiciels : Software Transactions Memory (STM) : c'est quoi et à quoi ça sert ? C'est en premier lieu un problème de productivité.
  • La technologie LINQ (Language Integrated Query : langage de requête intégré à C#) de Microsoft fait-elle du tort à Java ? Les closures qui étaient prévues pour la JDK 7 et qui sont reportées, oblige à faire des solutions comme celle proposé par le projet Quaere : faire des requêtes sur des collections indépendamment de la persistance, et donc sur une collection d'objets en mémoire. A intégrer rapidement dans nos systèmes. Google propose également un projet lambdaj pour généraliser l'exécution d'une opération sur une collection Java. C'est très élégant.
  • Un article sur les painters de JavaFX 1.2
  • Un autre article sur les mixin de JavaFX. JavaFX est une technologie pour réaliser des GUI qui propose également un langage (de script ?) pour programmer l'interaction.
  • Définition wikipedia des mixin.
  • Les fenêtres transparentes et non rectangulaires en Java.
  • Un petit exercice Java : avec l'exemple de code présenté, quel est le résultat du print ?

Bonne lecture.


Terracotta acquires Ehcache
We've been teasing the twitter-sphere for a few days now about some big Terracotta news and now I can finally talk about it.
Terracotta has entered into an agreement with Greg Luck, the copyright owner and primary developer on the Ehcache project. Ehcache is of course the most popular open source Java cache library. The agreement means that Greg Luck will join Terracotta, the Ehcache copyright will transfer from Greg to Terracotta, and Terracotta will take over hosting Ehcache.


Faster Java coding in Eclipse Galileo 3.5
Summary: Learn how to use the new toString() code-generation ability in Eclipse Galileo along with hashCode(), equals(), and setter/getter generation to cut down on the amount of work that goes into building the foundation of a Java class.


Software Transactional Memory
Software Transactional Memory (STM) is an emerging technology for protecting shared state in concurrent programs, based on automatic control of concurrent accesses. Its goal is to provide a more user-friendly and scalable alternative to locks by promoting the notion of transactions as a first-class citizen for component model.
This Software Transaction Memory target «state of the art» services and events oriented multi-tier components based software architecture with separation of concerns. One of the concerns is threading issues. STM propose an answer with a declarative transaction model for services and events.


Does .NET With LINQ Beat Java?
Framework's data query capabilities give it an edge, experts claim.
There is a question some developers are asking:
Has LINQ given Microsoft's latest .NET Framework an edge over Java?
Industry experts say "yes," but with some caveats.


Quaere
Quaere is an open source, extensible framework that adds a querying syntax reminiscent of SQL to Java applications. Quaere allows
you to filter, enumerate and create projections over a number of collections and other queryable resources using a common,
expressive syntax.

Iterable lowNumbers =

from("n").in(numbers).
where(lt("n",5).
select("n");


What is lambdaj for?
How many times have you read or written the same two or three lines of code that
frequently seem to go together, and even though they operate on different objects, feel like
the same thing? And how often these repetitions involve some sort of collections iteration
or more generically manipulation? These repetitions in the code is something that
developers eventually learn to filter out and ignore when reading code, once they figure
out where the interesting parts are placed. But even if the developers get used to it, it
slows them down. Code like that is clearly written for computers to execute, not for
developers to read.

List personInFamily =
asList(new Person("Domenico"),
new Person("Mario"),
new Person("Irma"));

forEach(personInFamily).setLastName("Fusco");


Introducing Custom Paints to JavaFX
In this article, I leverage a couple of undocumented capabilities to support custom paints. You
can use a custom paint to render the outline and fill for any shape (including text), and also to
render the fill for the stage's scene.

Specifically, the article introduces you to TexturePaint, BrownianPaint, and PlasmaPaint.
Each of these javafx.scene.paint.Paint subclasses relies on an undocumented Paint
function to make its underlying java.awt.Paint available to JavaFX. Furthermore, these
classes rely on an undocumented toolkit's subclass for filling a stage's scene.


Mixins in JavaFX 1.2 Technology
With the release of version 1.2 of JavaFX technology, developers have a new style of class inheritance: a mixin. A mixin is a type of class that can be inherited by a subclass, but it is not meant for instantiation. In this manner, mixins are similar to interfaces in the Java programming
language. However, the difference is that mixins may actually define method bodies and class variables in addition to constants and method signatures.


Mixin
From Wikipedia, the free encyclopedia
In object-oriented programming languages, a mixin is a class that provides a certain functionality to be inherited by a subclass, while not meant for instantiation (the generating of objects of that class). Inheriting from a mixin is not a form of specialization but is rather a means of collecting functionality. A class may inherit most or all of its functionality from one or more mixins through multiple inheritance.


How to Create Translucent and Shaped Windows
The article describes a feature that allows creating applications with translucent and shaped windows.
JavaFX Script is a capable new language that offers a set of APIs for creating RIAs. It also provides you with access to the rich features of the the standard Java language. One of the major features introduced in the Java SE 6u10 release is the ability to create translucent and shaped windows.

This includes:
making application windows translucent (tuning the general opacity of the window and using a per-pixel translucency effect) setting shapes on application windows This feature is available for objects of the java.awt.Window class and its descendants, for example javax.swing.JFrame, javax.swing.JFDialog, java.awt.Frame.


Translucent and Shaped Windows in JDK7
Here is another sneak peek at a page that was just completed for the JDK7 update of the Swing tutorial.
How to Create Translucent and Shaped Windows:
As of the Java SE 6 update 10 (6u10) release, you can add translucent and shaped windows to your Swing applications.
This functionality, part of the public AWT package in JDK 7.


The Ultimate Java Puzzler
Why is this particular one the ultimate? Two reasons:
It's at the very core of the Java language, not some obscure piece of API.
It melted my brain when I hit it.

public class /*p1.*/C1 {
/*default*/ int m() {return 1;}
}

public class /*p1.*/C2 extends C1 {
/*default*/ int m() {return 2;}
}

public class /*p2.*/C3 extends p1.C2 {
/*default*/ int m() {return 3;}
}

public class /*p1.*/Main {
public static void main(String[] args) {
C1 c = new p2.C3();
System.out.println(c.m());
}
}

Classes C1, C2 and Main are in package p1. C3 is in package p2.

What is the output of Main.main()?


vendredi 21 août 2009

Veille technologique semaine 34

Pour le bulletin de cette semaine 34, je vous propose les sujets suivants :
  • la société VMWare rachète la société SpringSource qui développe le framework Spring : pourquoi ?
  • la grande bataille du SaaS (Software As A Service) et de l'hébergement d'application, le "cloud computing" avec Google App Engine et autre Azure Microsoft : c'est quoi le "cloud computing" ?
  • le produit Terracotta a reçu le prix Duke Award lors de la conférence JavaOne 2009 qui s'est déroulé début juin à San Francisco. Ce prix est décerné annuellement par SUN pour récompenser une solution innovante dans le monde Java.
  • les architectures orientés événements commence à se faire connaître (EDA : Event Driven Architecture) et déjà le CEP : Complex Event Processing commence à avoir un marché.
  • Une série de livres qui sortent au sujet de :
    • JavaFX: Developing Rich Internet Applications en provenence de la source SUN
    • Real-Time Java Programming: With Java RTS : la programmation Java temps réel
    • Programmation concurrente en Java : un "best of" à lire absolument pour ceux qui font du Java multi-threadés
    • Spring 2.5 Aspect-Oriented Programming Book Review : la programmation par aspect proposé par Spring 2.5
    • Un compilateur Java qui génère du byte code DotNet.
    • Swing et le threading : c'est toujours un sujet compliqué qui doit être respecté
    • Le JDK 7 : ou en est-il ?
    • Les énumérés et la sérialisation.


    Bonne lecture



    Pourquoi VMWare / SpringSource ? Virtualisation matérielle vs. Cloud

    Pourquoi VMWare a racheté SpringSource dont le métier et la culture sont si différents ?
    Pourquoi un tel prix ?
    Mon analyse est que VMWare a racheté SpringSource parce que le cloud computing de forme Platform As A Service (PaaS) à la Google App Engine va bientôt mieux répondre que la virtualisation matérielle aux besoins d'optimisation des data centers Java. Selon l'adage "Si quelqu'un scie la branche sur laquelle je suis assis, mieux vaut que ce soit moi", VMWare s'est dotée de l'expertise de SpringSource sur Tomcat et Hyperic.


    Cloud Computing Demystified: Part-I
    Posted by: bond 124 on août 17, 2009 DIGG
    I recently took part in a panel discussion on Cloud Computing and how it relates to software architecture. The event used an online event organizer for signing up and the website wouldn't let me register for the event. I later found out that I could not sign-up because the event was sold out. This says something about the hype surrounding cloud computing which has become the in-thing to be 'seen with'. The panel discussion was interesting and animated and one takeaway for me was that everybody had their own idea of what cloud computing is and to some it was barely more than a buzzword.

    So, is cloud computing merely hype? While there truly is value in what is provided by Amazon (EC2 and other services), Google's App Engine, Microsoft's Azure and a few others, the providers (or at least their marketing teams), if you ask me, have not helped a whole lot. It seems like every company that used to provide virtual private servers is now a cloud computing provider. So are companies that used to provide hosting solutions, and every company that used to be a destination for an outsourced data center. Soon, we will have clouds of every other conceivable kind! When a term can be applied to pretty much anything, the term starts losing its meaning. Cloud computing, which I would put in the first stage of Gartner's Hype-Cycle (hype followed by disillusionment followed by realization), is the latest buzzword that marketing teams love to apply to anything they can. I asked representatives from several companies that claim to provide cloud solutions what did they really mean when they talked about a "cloud". When pushed, pretty much all of them ended up saying - "its just a buzzword".

    Getting back to the panel discussion, there were several strands of discussion which I would have liked to address in detail but couldn't because of time constraints. So I decided to use this blog to move the discussion online (and to also share it with a wider audience). In this and subsequent posts, I will try to summarize as well as share my view of this technology, starting with some of the points from the panel.

    Cloud computing is nothing new:
    Cloud computing, like most other technologies, is an evolution, not a revolution. If it does end up changing the way we develop, deploy and manage software (and other components), we might start calling it a revolution but at this time, it represents incremental but very useful changes in several existing technologies and how it all comes together. Most offerings use virtualization, deliver services over the Internet and expose HTTP based APIs for accessing and controlling the services. But what is truly important for me is not whether its new or old; but whether it solves my technical and business problems. There are several class of applications and organizations for which EC2, Azure or Google App Engine is the right choice. Moreover, I can not think of a single service in the late 90s or early 2000s where I could provision Linux boxes in a matter or minutes by just signing up on a website using a credit card. If nothing else, the sheer ease of use and affordability (at least in the beginning) is an innovation worth taking note of (and make use of if, it makes sense). My take on it - it works great when you use it to solve the problem it was designed to solve.

    There is no such thing as infinite scalability:
    The use of term "Infinitely Scalable" by the cloud computing service providers, in my opinion, is misguided. A better term to use would be "Sufficiently Scalable" but it does not have the same ring to it. Amazon's or Google's infrastructure can effectively provide "sufficient" scalability for small application. If you are mostly running on a couple of Xeons with 12GB of Ram or so, a typical spike in demand might need you to scale up by 4 or 5 times which can easily be handled by the Amazons of this world. I suspect, however, that you can not run another Amazon on Amazon's infrastructure (especially during Christmas time!). There is a slightly different but related discussion about differences of scale and statistical models which I will not get into.

    What about the security of my data?
    Its no less secure that using a hosting solution of the past. While people like to complaint about Hypervizor breaches and how most cloud computing providers (especially those who provide infrastructure as a service) use virtualization, the reality is that Hypervisors are far more secure that the operating systems they run. The two main and mostly related reasons for this is that the people who build Hypervizors realize this (and they are a pretty smart bunch), and that the Hypervizors are kept as small as possible. While I am not an expert in this area, the last time I was talking to one of the experts in Hypervizor and virtual machine security, he took pains to point out that inspite of the fact that it is bad for his business, Hypervizor breaches are extremely rare and that most Hypervizors are quite secure. I would, however, like to point out that what happens in case of a security breach is still not clear. We simply do not know enough about this stuff. And if you have contractual or legal requirements that prohibit you from moving your data into the cloud, you will simply have to wait until the lawyers catch up with the technology and the providers address these concerns directly through their SLAs.

    The clouds are not interoperable.
    Because every-body's offering of "cloud" services is different, the questions of interoperability while being a very important question, does not make sense at this time. The really compelling offerings today are from Amazon (EC2 being the big one, but there is also SQS and S3 and a few others), Google (app engine) and Microsoft's Azure. EC2 gives you virtual Linux servers (and now windows too) and options of launching pre-configured servers. If all you are truly using is the Linux platform, nothing stops you from moving over to someone else who will also provide you Linux boxes (either virtualized or real). While you may have to make a lot of changes to migrate your Java application over to Google App Engine, taking your application out of the App Engine and deploying it somewhere else should not be a problem (assuming you have appropriately abstracted out the areas that use Google specific APIs). I have heard talks of Azure supporting Java (and a few other platforms) in the future and it will be interesting to see how portable Java applications will be between Google App Engine and Azure.

    What is the real cost of using these services?
    This is a tough one and merits at least a white paper of its own. I do not have a clear answer but I say this - two main advantages of the cloud, the ability to scale up when you need to, and pay only for what you use go a long way in making cloud computing solutions cost effective. If you know your usage and it does not vary much, you do not really need to use a cloud computing provider. There is work needed for moving an existing application either completely or partially into the cloud and you should not, as a matter of basic engineering principle, use a cloud simply because its the in-thing. It will not make sense and it will not be cost effective. You may, however, have other reasons for using Amazon or Google (for example, cloud computing payment models let you convert your capital expenses into operational expenses).

    In my next post on cloud computing, I will list some of the prevalent definitions of cloud computing and try to factor out the characteristics that make most sense to me (especially for providers that we are most interested in) and try to come up with a working definition of the term that is most relevant to us as software architects/designers/engineers.



    Terracotta Wins Prestigious Duke's Choice Award at the 2009 JavaOne Conference
    Sun Microsystems and Java Inventor James Gosling Recognize Ubiquity of Affordable and Scalable Java Infrastructure Software.

    Terracotta, a recognized leader in infrastructure software for enterprise Java scalability, today announced it has been named a 2009 Duke's Choice "Java Everywhere!" Award winner by James Gosling and Sun Microsystems. Terracotta's technology is increasingly adopted by organizations to provide simple scalability and lower operational and capital costs for business-critical Java applications.


    Les acteurs du marché du Complex Event Processing
    Paul Vincent, Tibco, a diffusé un récapitulatif des différents acteurs du marché du Complex Event Processing listant l'ensemble des éditeurs proposant des solutions classés par date d'arrivée sur ce marché.
    Il y fait bien la distinction entre les produits se basant sur un système de requêtes temps réelles et ceux basés sur un système de règles.

    Il est ainsi possible de visualiser l'arrivée successive des nombreux acteurs sur ce marché en pleine croissance. Par ailleurs on remarque qu'Esper est le seul moteur de requêtes CEP Open Source du marché tandis que Drools, grâce à sa récente version 5 est devenu l'unique moteur de règles CEP qui soit Open Source. Ces nouveaux entrants viennent ainsi perturber StreamBase, Coral8 et Progress sur leurs positions investies il y a plusieurs années.


    JavaFX: Developing Rich Internet Applications
    Build Rich Applications that Run on the Desktop, the Web, Mobile Devices...Anywhere!
    Using JavaFX, developers and graphic designers can work together to build robust, immersive applications and deploy them anywhere: on the desktop, on the Web, and on millions of Java-enabled mobile devices. JavaFX lets you maintain your existing graphics and seamlessly integrate them into Java applications. Plus, JavaFX Script is a declarative language that allows you to preserve your investment in the Java platform while allowing more creativity with JavaFX's Rich Internet Application environment.


    Real-Time Java Programming: With Java RTS
    The Definitive Guide to Java RTS for Developers and Architects
    For Java developers and architects moving to real-time, and real-time developers moving to Java Walks through start-to-finish case study applications, identifying their constraints and discussing the APIs and design patterns used to address them Written by the former leader of the real-time Java standards process and one of Wall Street's top real-time developers. Sun Microsystems' Java Real-Time System (Java RTS) is proving itself in numerous, wideranging
    environments, including finance, control systems, manufacturing, and defense.
    Java RTS and the RTSJ standard (JSR-001) eliminate the need for complicated, specialized, real-time languages and operating environments, saving money by leveraging Java's exceptional productivity and familiarity.


    Programmation concurrente en Java
    La programmation concurrente permet l'exécution de programmes en parallèle. À l'heure où les processeurs multicœurs sont devenus un standard, elle est désormais incontournable, et concerne tous les développeurs Java. Mais l'écriture d'un code qui exploite efficacement la puissance des nouveaux processeurs et supporte les environnements concurrents représente un défi à la fois en termes d'architecture, de programmation et de tests.

    Le développement, le test et le débogage d'applications multi-threads s'avèrent en effet très ardus car, évidemment, les problèmes de concurrence se manifestent de façon imprévisible. Ils apparaissent généralement au pire moment – en production, sous une lourde charge de travail.

    Le but de ce livre est de répondre à ces défis en offrant des techniques, des patrons et des outils pour analyser les programmes et pour encapsuler la complexité des interactions concurrentes. Il fournit à la fois les bases théoriques et les techniques concrètes pour construire des applications concurrentes fiables et adaptées aux systèmes actuels – et futurs.

    L'édition française de cet ouvrage a été relue et validée par deux experts Java, Nicolas de Loof (architecte Java) et Eric Hébert (architecte Java JEE).


    Sommaire

    1 Introduction

    I Les bases
    2 Thread safety
    3 Partage des objets
    4 Composition d'objets
    5 Briques de base

    II Structuration des applications concurrentes
    6 Exécution des tâches
    7 Annulation et arrêt
    8 Pools de threads
    9 Applications graphiques

    III Vivacité, performances et tests
    10 Éviter les problèmes de vivacité
    11 Performances et adaptabilité
    12 Tests des programmes concurrents

    IV Sujets avancés
    13 Verrous explicites
    14 Construction de synchronisateurs personnalisés
    15 Variables atomiques et synchronisation non bloquante
    16 Le modèle mémoire de Java


  • Spring 2.5 Aspect-Oriented Programming Book Review
    Spring 2.5 Aspect-Oriented Programming is a good and unique work and it is highly recommended for developers who are focused (or would like to focus) on Spring AOP!


    Java 1.5 for the .NET Platform
    Ja.NET is a port of Java 1.5 SE to the .NET platform. The compiler is based on the Eclipse JDT, which has been modified to generate IL as well as Java Byte Code. Java traditionally compiles each class into a separate file, but this creates an unacceptable overhead for .NET. To address this, a tool based on Cecil is used to create larger assemblies much in the same way Jar files are created for Java.


    Swing Threading
    Desktop applications are often multi-threaded in nature. While adding benefits to responsiveness and performance, multi-threading adds coding complexity. You can write Swing applications without using multiple threads. However, once you cross the line into having a multi-threaded application, you should abide by Swing's threading rules. Otherwise, your application may behave in an unpredictable manner. In this chapter, you'll explore how Swing uses threads. You'll then view a number of threading-related resources in the Swing API. You'll also be introduced to three structured Swing threading solutions: SwingWorker, Foxtrot, and Spin. Finally, you'll learn how to detect incorrect thread usage in Swing with a custom repaint manager.


    Java Development Kit Software 7
    Java Development Kit 7 (JDK 7) is the next major release of the Java SE platform. Through the OpenJDK project, JDK 7 has been a highly collaborative effort between Sun and volunteers from the Java developer community. Sun extends its gratitude to all who have contributed to this release.


    OpenJDK 7
    A new milestone of the next generation JDK has been released, which includes several new features and enhancements in many functional areas, like garbage collection, NIO and more. This is also the first version where OpenJDK and JDK will have (almost) identical code-bases.


    Java Enums Are Inherently Serializable
    More than once, I have seen code such as the following (without the comments I have added to point out flaws), in which a well-intentioned Java developer has ensured that their favorite Enum [1] explicitly declares that it is Serializable [2] and has even provided a serialVersionUID [3] for it.


vendredi 3 juillet 2009

Veille technologique semaine 27

Pour le bulletin de la semaine 27, je vous propose les articles suivants :
  • la fondation eclipse publie le résultat d'une enquête sur l'utilisation d'eclipse.
  • les données, les comportements et l'objet : comment modéliser tout ça ?
  • les nouvelles fonctionnalités de C# 4.
  • JMX 2.0 était prévu pour le JDK 7, mais il est reporté pour plus tard.
  • quelques articles au sujet de l'injection de dépendance, avec la proposition du JSR 330 de Google et Spring.
  • présentation de Groovy à JavaOne 2009 : une des nouveautés intéressante est la délégation : @Delegate
  • toujours à JavaOne 2009, les annotations sur les types Java : JSR 308. Le @ReadOnly sera enfin disponible.

Bonne lecture.


Results of the Eclipse Community Survey
The Eclipse Foundation has conducted a survey in order to discover statistical details about its members: the OS used while developing, the primary database or the main deployment application server, and other information like the level of satisfaction using Eclipse.

Methodology
The survey was promoted through eclipse.org, Eclipse Foundation newsgroup, a blog post on PlanetEclipse and a few tweets during April 14 and May 15, 2009. The survey was addressed to English speaking users and it is biased towards Eclipse users, but any user could take the survey. 1,365 respondents completed the survey.


Objets, données, traitements et modélisation
Ah l'objet ! C'est super !
La réunification des données et des traitements, le tout en un. Fini les données d'un côté et les traitements de l'autre, « has been » tout ça, vive l'avènement de l'objet et de la modélisation objet. Moi, Monsieur, je pense Objet, je modélise Objet, je programme Objet, je dors Objet, je mange Objet, je m'habille Objet, je bois Objet, je… Euh, j'y vais un peu fort là !
On constate souvent ce genre de discours, sauf les quelques derniers mots peut être, et cette opposition qui est faite entre l'objet et le légendaire couple données-traitements. On fait d'ailleurs souvent ce raccourci pour définir ce qu'est un objet : « c'est comme une donnée avec les traitements en plus »
Sommes nous vraiment sûrs que cette explication ou cette opposition soient justes ? Maîtrisons-nous réellement la portée de ce raccourci : « c'est comme une donnée avec les traitements en plus » ? La fusion complète des données et des traitements est-elle réelle en objet ?
Essayons donc de voir quelle est la vraie nature de l'Objet et en quoi l'approche objet a apporté de la nouveauté dans nos pratiques d'informaticiens (et ciennes bien entendu !).


New features in C# 4.0
C# 4.0 The major theme for C# 4.0 is dynamic programming. Increasingly, objects are "dynamic" in the sense that their structure and behavior is not captured by a static type, or at least not one that the compiler knows about when compiling your program. Some examples include
  • a. objects from dynamic programming languages, such as Python or Ruby
  • b. COM objects accessed through IDispatch
  • c. ordinary .NET types accessed through reflection
  • d. objects with changing structure, such as HTML DOM objects

While C# remains a statically typed language, we aim to vastly improve the interaction with such objects. A secondary theme is co-evolution with Visual Basic. Going forward we will aim to maintain the individual character of each language, but at the same time important new features should be introduced in both languages at the same time. They should be differentiated more by style and feel than by feature set.


Explore C# 4's New Dynamic Types and Named/Optional Parameters
Leverage these new features in C# 4.0 to interoperate with new dynamic .NET languages, and simplify your code.


Que devient JMX 2 ?

JMX est une API standard Java permettant le monitoring et le management d'applications, elle est définie par la JSR-3 et étendue par la JSR-160 (Remote JMX). Depuis sa création en 1998, l'API a évoluée au fil des maintenance releases de sa JSR, incrémentant au passage sa version depuis 1.0 jusqu'à 1.4. Au départ disponible sous forme de librairie externe, JMX a finalement été intégré au JDK 5.0 puis mis à jour dans le JDK 6.0, fin 2006, pour s'aligner avec sa dernière version.

La prochaine évolution majeure de JMX est la version 2.0, cette fois-ci définie dans une nouvelle JSR, la JSR-255 (JMX 2.0). Actuellement en statut early draft review, il est dors et déjà possible de se rendre compte des chantiers prévus :

  • Des namespaces permettant de préfixer les noms des MBeans afin d'offrir une meilleure scalabilité lors que de très nombreux MBeans sont manipulés.
  • Le cascading permettant de fédérer un ensemble de MBeans situés sur des serveurs différents.
  • Définition de MBeans standards par annotations (@MBean, @ManagedAttribute et @ManagedOperation) et de leur injecter des ressources telles qu'un MBeanServer ou un ObjectName. Ce principe de définition de MBeans par annotations est calqué sur ce que Spring permet actuellement.
  • Un nouveau langage de requête permettant d'accéder facilement à tous les MBeans dont les propriétés se conforment à certains prédicats.
JMX 2.0 était initialement prévue pour être intégrée au prochain JDK, l'API avait fait son apparition au sein de la Javadoc des previews du JDK 7 mais restait absent de sa liste de features. Eamonn McManus a clarifié cette situation en annonçant sur son blog que JMX 2.0 ne serait pas intégré au JDK 7 tel qu'initialement prévu, qu'il n'était pas pour autant annulé mais reporté … au JDK 8. L'officialisation de ce report est une mauvaise nouvelle, car cette nouvelle mouture de JMX serait arrivée à temps pour apporter un renouveau à cette API, qui bien que très puissante, souffre parfois de lourdeurs à l'usage.



Dependency injection to the rescue!
Dependency injection is probably not as widely useful as regular expressions but is pretty pervasive these days in most applications built on Java EE, Spring, or Guice.
Recently, Google (most prominently Bob Lee and Guice) teamed up with pringSource (most prominently Rod Johnson and Spring) to propose a JSR for standardizing dependency injection annotations for Java SE in JSR 330.



JSR 330: Dependency Injection for Java
We propose to maximize reusability, testability and maintainability of Java code by standardizing an extensible dependency injection API.


Google Guice : Injection avancée
Dans le cadre d'un article d'introduction à Guice, nous avions vu une injection de dépendance simple, répondant à un besoin relativement basique.
Dans ce second article, nous allons découvrir des outils d'injection plus évolués, qui devraient nous permettre de réaliser par la suite notre premier exemple 'réel' d'implémentation Guice.


2009 JavaOne: Groovy/JRuby
The 2009 JavaOne Conference [1] included multiple opportunities to learn about and discuss Groovy [2]. Bill Gloff [3] provides a nice summary of the Groovy-related activities [4] and mentions that Groovy won [5] this year's edition of the Script Bowl [6]. In this blog posting, I will be focusing on two Groovy-related presentations presented at 2009 JavaOne: What's New in Groovy 1.6? [7] (TS-4215 [8]) and Comparing Groovy and JRuby [9] (TS-4955 [10]). What's New in Groovy 1.6?

In late 2008, SpringSource acquired G2One [11], bringing key Groovy developers such as Graeme Rocher [12] and Guillaume Laforge [13] into SpringSource [14]. The latter, Guillaume Laforge, presented Groovy at the aforementioned Script Bowl and was the presenter of "What's New in Groovy 1.6?"

Laforge's presentation was not entirely new to me because I had previously read his article What's New in Groovy 1.6 [15]. He mentions in his presentation slides that the examples in the presentation come from the article and suggests reading the article for more detailed coverage of the topics covered in the presentation.


Delegate transformation with Groovy
Java doesn't provide any built-in delegation mechanism, and so far Groovy didn't either. But with the @Delegate transformation, a class field or property can be annotated and become an object to which method calls are delegated. In the following example, an Event class has a date delegate, and the compiler will delegate all of Date's methods invoked on the Event class to the Date delegate. As shown in the latest assert, the Event class has got a before(Date) method, and all of Date's methods.

class Event {
@Delegate Date when
String title, url
}


JavaOne: Pluggable Type Checking
They have implemented a Checker Framework and a bunch of sample checkers for things like:
@NonNull - finds null dereference errors
@Immutable - detects incorrect mutation and side effects
@Interned - incorrect equality tests (== vs .equals())