Sunday, April 10, 2011

The maximum length of a surname is 30 characters

This is an universal law of database design. You will never find a surname longer than 30 characters.

As all database systems are programmed this way it is not even remotely possible that there exists an exception to this law.

You should be aware though, that in Spain people have two surnames. Which is no trouble for their databases as they use two surname columns. Each following the law of maximum characters for surnames.

So be careful or the hiring of Mr. Alphonso Bornemisza Fernandez de Mallorca might cause some trouble.

Monday, March 28, 2011

Documentation is important


/**
* getRows.
* @param inData DataIn
* @param index int
* @return Data
* @throws Exception when something goes wrong
*/
public Data getRows(DataIn inData, int index)

Good to know that an Exception is thrown when something goes wrong.

Tuesday, March 22, 2011

Keep your code readable

Sorry but I still don't get it ....


public void doSomething(Vector items) {
int j = 0;
while (j < items.size()) {
// 50 lines of code
if (0 == j && 1 < items.size()) {
break;
}
// 50 lines of code
j += (j + 1) == items.size() && 1 < items.size() ? -j : 1;
}
}

Friday, January 14, 2011

Deadline? What for?

The scenario:



  • A planned project budget of some 25 million Euros

  • A consortium of 20+ industrial partners (including all the really big global players in this area

  • A project-discussion time of more than 6 months before the meeting described here

  • 5 workdays until the final deadline for submitting the project proposal - no possibility of a late handin

  • No coordinating partner yet

  • Not even a very simple draft or outline of a proposal yet


Excerpt 1 of the consortium meeting: Trying to find a coordinating partner


... we have to agree on the coordinating partner, so please, who is willing to do it?

Why should we have a coordinating partner?

Because this is mandatory!

Are you sure?

Yes!

Sorry, we shouldn't waste our time on that, let's discuss it via email, we don't have to find the coordinator today. Let's just write a name into the proposal and then we'll see. We have more important things to discuss today...


Excerpt 2 of the consortium meeting: Trying to agree on a deadline


... we have 5 days left until we must submit our proposal - so all the partners have to describe their workpackages and send it to the coordinator, who will then compile the proposal

But we don't have a coordinator

Ok, that's right - so I'll coordinate this proposal compilation myself. Please send me your descriptions. And I would say, the deadline is in 2 days

Deadline? I don't think, we should have a deadline. We all do our best and when we're done, we'll send you the results

But when? Keep in mind that there's much work to do to make this proposal look good!

No, I'm against a deadline, what about the rest?

... nobody else said anything ...

Well, ok, then we obviously agree that we don't have a deadline. We'll send you our descriptions as soon as we have finished them


What do you think happened to the proposal? :-)

Thursday, January 6, 2011

Why would you use lock if you can take a bool...?

Some developers have perfect in-depth knowledge about multithreading and synchronization as the following piece of C#-code shows:


while(dangerous)
;
dangerous = true;

// operations in critical section here...

dangerous = false;


... as you can see, the people who invented lock(...) just think way too complicated - in reality it's much easier! You only have to know that one of the very important properties of bool variables is that several lines of code that use the same variable are compiled down to a single atomic operation :-)
Ah - and I forgot to mention the other important property: in case of an exception it is guaranteed that all bools are automatically set to false during stack unrolling... :-)