27 Sept 2007

The Elevator Test cheat sheet

I really like this "elevator test" blog post from coding horror so I decided to make it a cheat sheet, you can get it as a pdf.

Basically you should ask yourself those 5 questions to keep yourself focus one the main goal: "solve the customer problem"

What are you working on?
Why are you working on that?
Why is it on the bug list?
Why was it reported as a bug?
Why does the tester think that?

26 Sept 2007

Dr Who ?

Seen in Hadoop JobClient.class:

String user = System.getProperty("user.name");
job.setUser(user != null ? user : "Dr Who");

25 Sept 2007

To Test or not to Test private methods? That is the question !

We were talking about whether to test or not private methods, making them public to do the tests. I recommend this post of Michael Feathers.

I also recommend the "Mock" testing technique to avoid doing surgery on you objects. Using fake objects to record what methods are call on this object and then trigger the mock.assert() on this object.


Technorati tags:

Reading lines

I know this sound stupid but even if I've been using Java since 2001, reading a file "line by line" has always been a painful experience because java.io just sucks!
Ok may be it's wonderful piece of Object Oriented design but still "simple things are not simple" :(

With apache commons io to the rescue things become "more" simple:
InputStream input = getClass().getClassLoader().
getResourceAsStream("my/package/file.txt");
List lines = IOUtils.readLines(input, "UTF-8");

or
File file = new File("/commons/io/project.properties");
List lines = FileUtils.readLines(file, "UTF-8");

Still not simple enough but much better ;)

24 Sept 2007

Msn Live Search / Virtual earth better than Google Maps ?

Microsoft are testing a new "3D" and "higher resolution" version of there maps tool "Virtual Earth".

Apparently Toulouse is the "test" city, you can check the result by looking at the Capitole.

You need to click on this icon to use the "3D" feature:


The resolution is really impressive and this new "3D" feature with real buildings is great. Well Done!

Update: Here's the same place using the desktop version: Live Earth


Also: Chicago's demo video.
Technorati tags:

21 Sept 2007

Quote of the day

Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem.
-- David Wheeler


Technorati tags:

19 Sept 2007

Flickr hacked ?

Flickr today's logo is weird?
Did someone hacked there logo ?

update: Apparently no, it seems it's the international "talk like a pirate day" ?!

Technorati tags:

17 Sept 2007

Flickr usability delight

I like the Flickr upload system so much, I think it deserve a post :)

Simple, nice little effect (the green mark pop's up) and so simple to use.
You know what is happening, you don't have to look at Ie/Firefox toolbar and wonder: "is it actually uploading something or is it just stuck ?"



Technorati tags:

11 Sept 2007

Bruce Eckel disgressions about languages

Bruce Eckel is the author of Thinking in Java.

Actually the part which I found the most fascinating is the "digression" part :)

But it turned out to be a non-event. The people who didn't want to change stayed with the earlier version of the language, and those who moved forward saw the costs and the benefits, and opted for the benefits.
Apparently Ruby is also planning code-breaking changes to the language, primarily to take out the Perl-isms (a move I heartily applaud, and one that makes Ruby that much more attractive).
And the Java designers should certainly take notice, especially because the people they are so worried about offending with language incompatibilities are still using Java 1.1 with no plans to change; they aren't even paying attention to these discussions.
In the meantime, Java continues to ossify, pursuing its endless quest to produce the perfect program through static type checking, by adding more and more. The good thing is that people are finally beginning to see that static type checking is useful in small amounts and intrusive in large amounts (although I suspect this realization won't reach the main group of Java designers for years to come).
The bad thing is that, in the meantime, we get abominations like Java "generics"; via daily use people are finally beginning to see what I tried to explain years ago -- Java "generics" are far more painful than helpful, just like checked exceptions. But I digress.

I don't have such strong feelings against generics because it make sense in a "java only" world.
Since I discovered (and understand) ruby dynamic typing, my view on typing completely changed but I doubt one can understand what it brings until you actually use it.

Static typing is just for "making the compiler happy" it just make you loose time and productivity, dynamic typing is so much more powerful but like all powerful toys you can burn yourself (put 2 different type of objects in the same var is one of the possible ways).

You should read the rest of the article: Python 3K or Python 2.9? it's really interesting!

Technorati tags:

7 Sept 2007

Java generics and interface

Vincent asked me if it was possible to specify that a generic parameter must implements a specific interface. Well that's possible but instead of writing:
T implements MyInterface
you need to do:
T extends MyInterface
Here's the full code listing:
public interface Toto {
public void execute();
}

public class TotoImpl implements Toto {
public void execute() {
System.out.println("execute");
}
}

public class Foo <T extends Toto> {
private T t;
public void setObject(T t) {
this.t = t;
}
public T getObject() {
return t;
}
public void doSomething() {
t.execute();
}
}

public class Main {
public static void main(String[] args) {
Toto toto = new TotoImpl();
Foo foo = new Foo();
foo.setObject(toto);
Toto notCastedToto = foo.getObject();
foo.doSomething();
}
}


update: thanks to nico to point that > and lt; wasn't display in the code, making it pointless ;)

Technorati tags:

4 Sept 2007

Eclipse Tip of the day

Just discovered the only shortcut you should remember in eclipse: Ctrl+Shift+L.

Bring up the list of shortcuts ;)

ps: Apparently, you need to have an editor open.
ps2: I can't do a print screen because eclipse think I'm trying to do a shortcut :p

New Office, New Desk

The Joost team just moved in a more "spacious" bloc in the building (pictures).

I trade my Vincent H with a Francois G. I won't have flaming discussion about "ligature" ;)
But I'm pretty sure Francois has a lot to say about burgers ;)

Technorati tags: