Wednesday 29 August 2007

Out of subject : Errare Humanum Est

Basically the implementation look like :

if client => send email to client
if enterprise => send email to client
if others => send email to client

BUT this behavior was not as specified. It should be :

if client => send NO email
if enterprise => send email to enterprise
if others => send email to enterprise

And guess what, it was in production because of ME. Yes, ME. I'm gonna kill myself. How it could be, how I could make such a mistake. By focusing too much on code aspect.

This teach me a great thing. Of course the code aspect, the architecture and so on are important, but the business target IS MORE IMPORTANT than every thing.

Today, I was the stupid guy because Errare Humanum Est.

Friday 3 August 2007

What time is it ?


// defined previously
// Date aDate = ...

Date date = new Date();
date = new Date(date.getTime());

if (aDate != null && aDate == date) {
date = new Date(date.getTime() + 10);
}

Hum, the biggest problem with this one is the equality condition test (aDate == date).
In java, == DOESN'T compare value, except for primitive data type, it compares pointer.
That's it, it test if two objects are same. To test if two object are equal (in value) use Object.equals method.


Then, it is trivial that
Date date = new Date();
date = new Date(date.getTime());
is stupid.
Date date = new Date();
is sufficient.