Sunday, November 15, 2009

When technology pisses me off (5)

I went into my local Orange shop today. I simply wanted to upgrade my phone to one with a higher resolution camera. The assistant asked me some details and typed them into a computer. Nothing happened. She asked a colleague if the computer was working. He said try rebooting it. So she did. Then she asked me the same details again. And typed them in again. Still not working. Long pause with nothing happening. Decided not to get frustrated. Looked for a chair to sit down while I waited. No chairs. Sat on a low shelf instead. She asked me for the same details for a third time. This time I wrote them on a piece of paper. I decided to mention something I hadn't been asked - that I was on the Virgin tariff. That seemed to be an important piece of information and the computer was abandoned as she tried to ring someone for help. She couldn't get through. I went to sit down again. She kept trying. Eventually she got through. She passed the phone to me. The man on the other end asked for the same information for a fourth time. Then he asked me the post code of the shop I was in! I remained calm and handed the phone back to the assistant. I sat down again. The call ended. After all that I was told I couldn't upgrade my phone unless I switched to a different tariff. I was near the end of my tether by this point but I decided to at least look at the new tariffs. All more expensive than the one I'm one. I said simply "It's not going to happen. You've lost a sale." and walked out. Orange - today you were RUBBISH.

Wednesday, November 04, 2009

#exclude - a testing idea for C/C++

Suppose you're working on a legacy C/C++ codebase and you want to introduce some characterization tests. One seam you might consider exploiting is #includes. It's quite easy to exclude includes. For example:
# excluder.rb
include = Regexp.new('(\s*)#(\s*)include(.*)')
STDIN.readlines.each do |line|
 if include.match(line)
   line = "#if 0\n" + line + "#endif\n"
 end
 STDOUT.write line
end
This small Ruby program reads in a source file and writes out the same source file, except the #includes are commented out. Each line like this:
#include <stdio.h>
is replaced like this:
#if 0
#include <stdio.h>
#endif

This enables you to create an "isolated" version of a source file. One where all the dependencies arising from the #includes, to any depth, are slashed in one swift cut. One where your tests clearly and visibly have to recreate all those dependencies in a custom mock environment.

This is just an idea. I might not be a good idea. I only thought of it last week. Caveat emptor.

Monday, November 02, 2009

Incomplete types oddity in C

Here's something odd from C. It's to do with incomplete types. This compiles fine in gcc:
typedef struct wibble wibble;
void f(wibble * ptr);
but this does not:
typedef struct wibble wibble;
void f(wibble array[]);
A bit of searching in the Standard reveals

6.7.5.3 Function declarators
paragraph 12 - If the function declarator is not part of a definition of that function, parameters may have incomplete types...

This suggests the [] based declarator is ok. However it's not because...

6.7.5.2 Array declarators
paragraph 1 - the element type shall not be an incomplete type

Which leads you ask what is an incomplete type?

6.2.5 Types
paragraph 22 - An array of unknown size is an incomplete type.

Which is interesting because it says nothing about an array of unknown type being an incomplete type. This is a shame. Particularly because of the new [] array declarator syntax in c99.

Saturday, October 31, 2009

Showers are agile; baths are not

In the shower a few days ago I realized that showering vs bathing is a nice example of being lean-agile or not. Imagine 10 people bathing sequentially vs showering sequentially...

With a bath you have to wait (in a queue) while the bath fills up. Not so with a shower.

If you do something else while you wait for the bath to fill up you're likely to find the bathwater too hot or too cold.

Or the tap turns itself off (I have a hot tap that does that sometimes) and the bath is still virtually empty.

Or that might be the time you discover the overflow pipe is blocked.

Or that a fully on tap releases water faster than an overflow pipe can drain it.

With a bath the water stays in the bath and gets dirty.

With a bath the water gets cold as you lie in it.

With a bath you have to drain the water before you can refill it so the next person can bath in clean water.

With a bath you use more water.

A bath takes up more floor space.

In a shower you stand up, you stay more awake.

A bath is less encapsulated.

Bath leaves a ring of scum that has to be cleaned.

Thursday, October 22, 2009

Birth of the Chaordic Age

is the title of an excellent book by Dee Hock. As usual I'm going to quote from a few pages...

All things, even life itself, are a seamless blending of chaos and order.


By structure I mean the embodiment of purpose, principles, people, and concept.


The results of the best organizations are apparent, but the structure, leadership, and process and transparent.


Information multiplies by transfer and is not depleted by use.


Knowledge becomes understanding when related to other knowledge in a manner useful in conceiving, anticipating, evaluating, and judging. Understanding becomes wisdom when informed by purpose, ethics, principles, memory of the past, and projection into the future.


All knowledge is an approximation.


The information age is primarily an extension of mental power.


We are at that very point in time when a four-hundred-year-old age is rattling in its deathbed and another is struggling to be born.


Monday, October 19, 2009

Out of Our Minds

is the title of an excellent book by Ken Robinson. As usual I'm going to quote from a few pages...

People are not creative in general but in doing something concrete.


Spontaneity sometimes has to be carefully planned.


Creativity is not just a matter of letting go: it involves hanging on.


Creativity is as much a process of finding problems as solving them.


Trying to put some experiences into words is like stringing clothes on a washing line when in practice they are worn one inside the other.


Creativity is a process not an event.


We classify at our peril.


Creativity is incremental.


Creativity relies on the flow of ideas.


Sunday, October 18, 2009

Important - do not rub off

In one of his books Jerry Weinberg mentions a cleaner who wasn’t allowed to wipe the whiteboards. The story conjures familiar images of whiteboards full of stuff labeled “important - do not rub off”. It’s likely the stuff has lain untouched on that no-longer-white-whiteboard for weeks or months. It’s no longer important but there it stays, filling the whiteboard. A whiteboard full of stuff discourages its use in exactly the same way an empty whiteboard encourages it. And a whiteboard with the words “important - do not rub off” positively discourages use. It's really saying "keep away".

The whole purpose of whiteboards is that you wipe them. Perhaps they should be called wipeboards! Buying a wipeboard and its special pens and its special erasers and then filling it with stuff just the once is silly and expensive. If you want something permanent why not use a permanent pen on a big piece of paper stuck to the wall?

Filling a wipeboard with stuff labeled “important - do not rub off” is also silly if the stuff genuinely is still important. Someone might be desperate for a wipeboard and decide their new definitely-important stuff is more important than somebody else’s existing possibly-important stuff. So they wipe it. Wipeboards are so easy to wipe after all!

Le Chatelier's Principle says "[good] systems tend to oppose their own proper function". What is the proper function of a wipeboard? To be written on. How do you oppose being written on? Simple - wipe them completely clean every so often. Ruthlessly. Even if someone's written "important - do not rub off" on them.

With this use-clean use-clean use-clean dynamic set up the wipeboards give a clear visual impression of their dynamic use since anything on a wipeboard must necessarily have be written fairly recently. If they remain mostly unused most of the time you get to see that very clearly too.