Personal Workflow Blog

To content | To menu | To search

Tuesday, 2 June 2009

Efficient Denormalization with Views

Everyone is unanimous that database normalization is considered a Good Thing.

But it usually comes with a cost : writing queries can be very tedious since you always have to join many tables together to be able to retrieve useful human data from all those reference tables.

Continue reading...

Monday, 1 June 2009

Equality in Java is a Hot Topic, but a Hazardous one.

It seems that comparing two objects isn't as a simple task to do as it seems at first.

My concept for smart comparison still holds, but is completed perfectly with the How to Write an Equality Method in Java article posted on Artima soon after mine[1].

2 main points that you have to be careful to (Others are also detailed in this article) :

  • hasCode() has to be redefined usually since otherwise the equality contract on Object.hascode() would be broken.
  • the equals() has to take an Object as parameter since overloading in Java is resolved by the compile-time type of the argument, not the run-time type.

I just got bitten by the second one, but not much (yet) since I mostly rely on compile-time overloading. My purpose here was only to compare objects either to constants or to simple variables. But in the generalization I would certainly have overlooked this and be bitten much more deeply.

Notes

[1] But as much as I wished it to be, it is not related :-)

Friday, 29 May 2009

Synthetic Style for Blog Posts : Presentation Style Blogging

The good

  • With SMS, IM and now Twitter becoming more and more predominant : ideas might be given as bullet points
  • A presentation is much more dense in meaning than a big blob of text, Less time is required to read the post and be inspired by the content
  • Blogging is much less time consuming. As Jeff Artwood said Quantity Always Trumps Quality, it is the commitment that is important (hence the schedule).
  • You might divide a long article in several short and related posts.

The bad

  • Blog articles are usually a medium-depth analysis of a problem whereas presentation are usually a written support of a more detailed oral presentation.
  • Presentation sentences are usually hard to understand since they are just headlines without the underlying context.
  • You can always do a fast-reading version by putting the important sentences in bold for all those hasty readers.

The ugly

  • Longer don't always mean more interesting. Voltaire said Perfection is attained by slow degrees; it requires the hand of time. and Antoine de Saint-Exupery completed Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away..

Conclusion

As concluded by Pascal, I made this letter longer than usual because I lack the time to make it shorter, a good and terse article is therefore much more difficult to achieve. Therefore Presentation Style Blogging may be a false good idea.

Tuesday, 26 May 2009

Compare Efficiently in Java : Embrace Smart Comparison

In Java, comparing things can be quite tricky. Comparing them with a simple == only compares the references, and for example 2 strings could be the same without being the same object. You have to compare them with the equals() method. Now the infamous NullPointerException (NPE) shows its ugly head when the first object to compare is null.

Continue reading...

Tuesday, 19 May 2009

Surrogate Keys : Globally Unique, Application Unique or Type Unique ?

When you just decided to use Surrogate Keys, another problem arises : which value should I use ? It seems to be a very simple problem since the key now is completely in isolation in your application and is not related to any data. The choice is quite bonding, since a change means that every value has to be changed, and you did not let this key leak outside the database did you ?

The keypoint here is isolation. Many differents kinds of isolation are available, and soon you will be able to make a informed decision.

Continue reading...

- page 1 of 6