Richard Turere: My invention that made peace with lions

Another TED video of remarkable value, which remember me how simple things can change our and other’s life. Everything around us starts with us.

Advertisements

Fast test, slow test

I found this video quite interesting, here some observations:

  • Why you test? Tests are preventing regression, fear (enable refactoring), bad design.
  • In the video the guy is talking about System tests. The meaning is quite generic for integration and/or functional tests. Normally they are not as fast as Unit tests.
  • If every time you change the code, you have to change the tests, you have clearly problems with tests
  • A way to measure how our test is unit is to measure how many dependencies we have in every of our tests. Every dependency increase the probability to fail the tests if external code is changed, and when it fails cannot tell you exactly where.

Reasons to fail the test strategy:

  • Use selenium as primary test suite – slow – no possibility to use TDD
  • Unit tests are too big. Studies have demonstrate that testing time is growing exponentially from the start of a process development.
  • Write fine grained tests around legacy code is a bad way to design tests.

Suggestions:

  • 90-95% of Unit tests – 5-10% Integration/Functional tests
  • Quick unit Tests allow you to do TDD. If it has to fail, it has to fail fast.
  • When unit tests are failing, they are pointing the fine grain problem, if this is not true, they are not unit tests

Road to FOSDEM 2010

As most of you already know (if you don’t, never mind, I will forgive you :D), I’m going to give a lightning talk in the Free Java Dev room at FOSDEM about Groovy. The title will be “Groovy: the cool side of java” and basically it will be an hand-on speech. No slide, just code. I will start from a simple Java code and I will rewrite it in Groovy. During the demo/live I will give some basics explanation about how is groovy working and we will see the power and the value that Groovy add at the top of JVM compared with a static language like Java.

Here the code that I wrote:

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

class TestJava{
   public static void main(String[] args) {
      new DoStuffs().doIt();
   }
}

class DoStuffs{

   public void doIt(){

   List al = new ArrayList();

   System.out.println("* Initial size of"+al.getClass()+" :  " + al.size() + " with elements "+al);

   al.add("this");
   al.add("is");
   al.add("just");
   al.add("test");

   System.out.println("* Final size of"+al.getClass()+" :  " + al.size() + " with elements "+al);
   System.out.println("* Let's add some stuffs");

   al.add(2,"a");
   al.add(3,"cool");

   System.out.println("* Done "+al);
   System.out.println("");

   System.out.println("- Before ordering"+al);
   Collections.sort(al);
   System.out.println("- After ordering "+al);
   System.out.println("");

   List al2 = al.subList(2,4);

   System.out.println("- Sublisting "+al2);
   System.out.println("");

   if(al.size() > 0){
      for (int i=0; i< al.size(); i++) {
         al.set(i, al.get(i)+" \\o/ ");
      }

      System.out.println("Let's show the element in the reverse order: ");
      for (int i=al.size()-1; i>=0; i--){
         System.out.println("<"+i+"> "+al.get(i));
      }
   }

   if(al != null){
      List sub = new ArrayList();

      for (int i=0; i< al.size(); i++) {
         String el = (String) al.get(i);
         if(el.contains("t")) {
            sub.add(al.get(i));
         }
      }
      System.out.println("- After grep "+ sub);
    }
  }
}

Next meetings :)

Liberamente (19 April)
I will partecipate as LOLUG member and Fedora Ambassador, and I will do a short talk on LTSP technology. LTSP is a killer technology to help schools and PA to migrate on opensouce when an upgrade of large scale system is required.

Pycon 2 Italy (9, 10 and 11 May)
My talk proposal about Func has been accepted and, see you there. Sunday at 17:45 😉 I’m excited and, at the same time, scared. It’s my first official conference, and I’m not so able to speak in public, but on the other hand, never I start, never I learn. Let’s go. 🙂