Nevermind, but I really do not know what to fix here.
Development 412
Totally imaginary examples of things which never happen in real world software development projects.
Wednesday, January 25, 2012
Sunday, April 10, 2011
The maximum length of a surname is 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)
Tuesday, March 22, 2011
Keep your code readable
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...?
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... :-)
Saturday, December 11, 2010
When In Doubt, Do Nothing
Like in this example:
void OnItemClick(object sender, EventArgs e)
{
string selected;
try
{
selected = Parse(e.Item.Value);
}
catch (Exception ex)
{
Log("Clicked Item not found", ex);
throw;
}
switch (selected)
{
default:
break;
}
}