Sep 24 2011

La puissance et le contrôle

En développement, comme dans beaucoup d'arts martiaux, on peut devenir fort assez rapidement. On peut se fixer des objectifs (une ceinture, une victoire / maitriser une technologie ou réaliser un projet perso) et les atteindre rapidement selon le language, le maître et l'implication qu'on y met.

Certains langages, tout comme certains arts martiaux, poussent à l'efficacité, à la rigueur ou aux résultats rapides. En Tae Kwon Doe ou en Jujitsu, on aura tendance à privilégié la rapidité d'execution et les résultats seront assez rapide. Pour utiliser des termes usuels : la courbe d'apprentissage n'est pas très raide, et on peut avoir des résultats imparfait dès le début. En revanche, en Karaté Shotokan, on aura tendance à privilégier un apprentissage long et arride à base de Kata, il suffit de regarder le karaté-kid (vieille version) pour comprendre qu'il y a plus trippant comme apprentissage des bases...

On comprends facilement la parallèle avec la programmation, les langages de scripting (Python, PHP, ...) se concentrant plus sur les résultats et l'execution, et les langages historiques comme Java/C++ étant plus orienté rigueur.

Mon point est le suivant, la puissance s'acquière rapidement à la fois en informatique et en arts martiaux, mais l'évolution et le travail fait qu'on lui substitue la maîtrise de notre art. Je m'explique : si on prends la programmation cette fois, au début on commence par le langage, seulement le langage, on avance et on s'habitue aux design patterns, on prends en main des architectures usuelles, des technologies afférentes, ensuite des méthodes de travails - des méthodes de tests.

Seulement pour un oeil non-averti qu'est ce qui va différencier un développeur sénior qui travaille en TDD - d'un junior "confirmé" qui a acquis la puissance mais pas la maîtrise. Très clairement le développeur sénior mettra plus longtemps, à specs équivalente, pour réaliser le travail, à cause du TDD, à cause de la rigueur et de la précision des gestes qu'il va chercher à atteindre. Vous allez me dire qu'en terme de qualité il n'y aura pas photos, très certainement. Mais un travail parfait sans bug n'existe pas en temps raisonnable et quelques tests basiques (réalisés par la QA) permettent souvent d'élaguer les erreurs usuelles.

La maîtrise, à terme, se substitue, souvent trop, à la puissance et à l'efficacité.

C'est peut-être là le rôle de ré-apprendre de nouveaux langages au fur et à mesure de son évolution, pour avoir non-seulement de nouveaux points de vue à explorer (chaque langage ayant son paradigme), mais aussi pour redécouvrir la puissance que l'on obtient au début en récompense d'avoir appris.

Sur ce,

Vale


May 1 2011

Should i really learn Java ?

So i've been a professional Java developper for a few years now, and the question seems interesting to me. Should, let's say a student, really learn Java even if he does not want to do "Enterprise applications" ?

Short answer, Yes.

Long answer, you've got to know what Java is and what it's not, and i'm not talking about technical specs, but more about the place of Java in the world right now. Let's begin with what it's not, it's not :

  • what the cool kids do right now ! they do ruby, scala, clojure, even erlang (so cool...), but they don't do java unless they have to.
  • what the web is all about right now ! the web is about fast prototyping, agile development, continuous integration and deployment. Java is heavy, not designed for rapid prototyping and deployment is so painful that you need third party drug to ease the pain.
  • what you'll want to be doing for the rest of your life !
  • the best way to create distributed, scalable applications !
  • going to change anytime soon. It may be an advantage or a drawback, depending mainly on your age and goals.

However, Java is :

  • A de-facto standard, that you need to know !
  • running on the best VM out here !
  • the obvious language if you really really need a job ! So treasure it because it's just like Cobol, it's here to stay. You want it or not.
  • maybe the last non-Functionnal language you'll see in the coming years ! At least if we keep on creating languages to leverage the multi-core way.

Maybe i'm wrong, maybe it's all bullshit and i don't know what i'm talking about. Even is so, Learn Java, the hard way if you have to. Because even some of the coolest things out there (Mahoot, Hadoop, Lucene, Solr) are in Java, and Google's main language is still Java. Sur ce

Vale.


Dec 1 2010

Agilité et BuildWall

Le point le plus important de l'agilité reste d'instaurer un climat de communication permanent avec un environnement adapté et une équipe soudée. Dans cette optique voici une initiative de Jean-Baptiste Lemee (@jblemee) : http://www.buildwall.com/

Enjoy et Vale


Nov 16 2010

Etat de l'art de la GED OpenSource

J'ai eu recemment l'occasion de faire un rapide état de l'art des applications OpenSource et non-libre de la GED, et d'en tester quelques une en les déployant. Voici donc une petite liste des deux principaux que j'ai retenu avec un léger brief sur le contexte :

  • Alfresco : application JEE scalable avec un déploiement sous forme d'installation ou un war déployable sur n'importe quel serveur d'application. Pour en savoir plus la documentation est plus accessible sur le wiki : http://wiki.alfresco.com/;
  • Nuxeo : application JEE packagée avec Tomcat pour son installation standalone et disponible sous la forme d'un war avec la possibilité de lié l'authentification à un annuaire ldap. La doc se trouve ici : http://doc.nuxeo.com/.

Bonne journée !

Vale


Oct 29 2010

Moving On...

Ca y est ! Fin de mission aujourd'hui.

C'était ma première mission autour du progiciel financier Calypso, et c'était intéressant ! Pas assez pour que je veuille approfondir, d'autant plus que mes desiderata actuel font que je préférerai faire du JEE Web pour changer un peu du développement du développement J2SE, où je commence à avoir beaucoup d'expérience.

Enfin voilà, une page se tourne et je vais maintenant chercher une nouvelle équipe sur Paris. J'espère trouver une team Agile JEE qui saura me donner ma chance, mais en attendant

Vale


Oct 28 2010

A good oldie : 1996 Java Vs Python

I didn't think i would find something like this one day, but here it is an original 1996 paper on "Two Next-Generation Languages Java and Python".

Makes you really think about time, both languages evolved so quickly, one being now the mainstream multi-purpose language (Java) and the other one being more relevant than ever (Python). It makes you see how much Sun invested on the applets technology, even if it never took off...

Enjoy : http://www.rogermasse.com/papers/java-python96/

Vale


Aug 14 2010

MultiThreaded Test cases – Why ? How ? and What’s for dinner ?

Okay so to make a small introduction (i promise a tiny one) i'm starting to contribute into VirgoRT (ex-SpringSource DM Server) for me it's an opportunity to work with great people, learn more about OSGi and work on a real JEE application server (and more).

So i started to discover the kernel and decided to improve virgo's code coverage, as adding more tests is a great way to learn about how things work. And honestly i've got to say, this is great code ! it's clean, efficient and easily understandable (loose coupling and high cohesion).

But an application server is all about multi-threaded interactions, so as usual when it comes to multi-threading tests are hard, they become irrelevant, sometimes un-predictable and of course MORE COMPLICATED than the code it's supposed to test ( :-/ ).

So with Steve Powell from VMWare we decided to look further into it, came out this wiki page about testing extensions in VirgoRT still under discussion about how to handle these tests. And after a lot of searching and re-reading the 'Java Concurrency In Practice' Book of Brian Goetz (that i recommend as a reference), i found this test framework : MultiThreadedTC from the university of Maryland (that created the infamous FindBugs).

And this is my official tool as of this day.

Let me just show you a real-life example of a Barrier, this barrier can block many threads until one signal a failure (throwing an exception to all waiting threads) or a completed execution. This barrier can be respected ad vitam eternam but most of the times its users (threads) use it with a timeout that will make the waiting method return false when reached. That's this point that needs the most testing.

Here is a test case that tests precisely this functionnality :

  1.  
  2. public final class BlockingSignalTest {
  3.     private static class SignalCompletionFailsAfterWaitingExceeded extends MultithreadedTestCase {
  4.       BlockingSignal signal;
  5.  
  6.        @Override public void initialize() {
  7.          signal = new BlockingSignal();
  8.        }
  9.  
  10.        public void threadFailing() {
  11.          try {
  12.            // awaiting for signal completion flag
  13.            waitForTick(1);
  14.            freezeClock();
  15.            boolean returnSignal =
  16.                signal.awaitCompletion(1, TimeUnit.MICROSECONDS);
  17.            assertTick(1);
  18.            unfreezeClock();
  19.            Assert.assertFalse(returnSignal);
  20.          } catch (FailureSignalledException e) {
  21.            // this code should not be reached
  22.            Assert.fail();
  23.          }
  24.        }
  25.  
  26.       public void threadSignalingCompletion() {
  27.          waitForTick(2);
  28.          signal.signalSuccessfulCompletion();
  29.        }
  30.     }
  31.  
  32.    @Test
  33.   public void signalCompletionFailsAfterWaitingExceeded() throws Throwable {
  34.     TestFramework.runOnce(new SignalCompletionFailsAfterWaitingExceeded());
  35.   }
  36. }
  37.  

You can see here without any more explainations that each thread is created as a method of the TestCase class, the test framework is giving you access to an inner clock that will help you synchronize your threads. Therefor the thread that will signal the completion will only be signalling it at Tick 2 and the first thread is executing all of its job during Tick 1.

The part that needs maybe the most explaination is the freeze/unfreezeClock, well Tick(s) are incremented by the framework only when all threads are waiting, but the awaitCompletion triggers a wait method and we don't want any Tick to be incremented during this period where the only thing we're testing is the timeout.

Therefor we can freeze the clock incrementing all ticks to test our waiting methods.
Okay, now just to compare here is the version i submitted some times ago without this test framework and with a special Thread object that could handle catching exceptions and re-throwing (in order to handle all the AssertionErrors thrown by JUnit) :

  1.  
  2. public final class BlockingSignalTests {
  3.   @Test
  4.   public void signalCompletionFailsAfterWaitingExceeded() throws Throwable {
  5.     final BlockingSignal signal = new BlockingSignal();
  6.     ExceptionCatcherThread testThread = new ExceptionCatcherThread(new Runnable(){
  7.       public void run() {
  8.         try {
  9.           // awaiting for signal completion flag
  10.           boolean returnSignal =
  11.                     signal.awaitCompletion(1, TimeUnit.MILLISECONDS);
  12.           assertFalse(returnSignal);
  13.         } catch (FailureSignalledException e) {
  14.           // this code should not be reached
  15.           fail();
  16.         }
  17.      }
  18.     });
  19.  
  20.     testThread.start();
  21.     Thread.sleep(100);
  22.     signal.signalSuccessfulCompletion();
  23.     testThread.join(10);
  24.     assertFalse("Test thread still alive after delay.", testThread.isAlive());
  25.     testThread.rethrowUncaughtExceptions();
  26.   }
  27.  
  28.   /**
  29.   * Special thread designed to record uncaught exceptions
  30.   * and re-throw the first of them on demand.
  31.   */
  32.   private class ExceptionCatcherThread extends Thread {
  33.     private final Vector uncaughtExceptions = new Vector();
  34.  
  35.     public ExceptionCatcherThread(Runnable r) {
  36.       super(r);
  37.        this.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
  38.          public void uncaughtException(Thread t, Throwable e) {
  39.            uncaughtExceptions.add(e);
  40.          }
  41.        });
  42.     }
  43.  
  44.     public void rethrowUncaughtExceptions() throws Throwable {
  45.       if (!uncaughtExceptions.isEmpty())
  46.         throw uncaughtExceptions.firstElement();
  47.     }
  48.   }
  49. }
  50.  

This is clearly less understandable when you need to "take a look" and the Thread.sleep() methods are definitely a source of error and false negative tests.

I can't say how much this framework seems profitable for me, so i'll let you judge on your own and according to your needs.

Hope you enjoyed it


Jul 28 2010

Building Virgo on MacOsX Leopard

I won't say that my contribution to this work will be tremendous, but it's nice to know a little more if you want to try out building the ex SpringSource DM Server

A lot is already available using the Virgo project documentation : http://wiki.eclipse.org/Virgo/Build

But to sum it up, you just need to install Git, and clone the existing repositories available at http://wiki.eclipse.org/Virgo/Source. The little tweakings you'll need are more about MacOs's profound attachment to Java 1.5 and the Virgo's clear intention to move-on to (at least) Java 1.6 :-)

So to change your default Java 1.5 JDK Configuration you've got the perfect utility tool bundled within Mac's twisted flesh, file:///Applications/Utilities/Java Preferences.app

Just drag and drop Java 6 to the top and you'll be just fine.

Next step is to make Ant understand your intention to move on as well, just export the JAVA_HOME env variable to the right value :

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

And once again you'll be just fine.

Enjoy


Mar 23 2010

Machine-learning empowerment – Apache Mahoot

Maybe we'll soon be able to get more out of machine learning algorithms, Google is communicating a lot, throught the GSOC (Google Summer of Code) and Google Code as a whole, on this project and supporting the Apache foundation.

"Mahout is an Apache Software Foundation project, which aims to create scalable machine-learning libraries using a variety of techniques including leveraging Apache Hadoop"

Let's see what get out of it, for now Apache Mahoo on Google Code and on for the Apache Project.

Enjoy.


Mar 15 2010

Self-Improvement : [Java] – Weak references (Soft/Phantom)

Adding to my series of article for self-improvement (especially) in Java, here's a good link to explain Weak references (vs Strong references). As usual it's open for comment the goal being to give anyone at least an idea of what it is and when it may be useful.

Enjoy.