Monday, March 15, 2010

User controls suck.

I have rcently had occasion to go back to developing windows forms wigets and have reaffirmed my opinion that the UserControl model is a huge mistake for anything other than a one-off solution to a simple problem.
There are many problems with the model. First, the principle of polymorphism in a UserControl is utterly destroyed by the use of events within the user control. As soon as a UC has an initializecomponent that has event subscriptions then it is impossible to derive from the UC in any meaningful way because certain behaviours are set in stone and may not later be modified.
Another problem is the lazy way aggregation of function is treated by developers who utterly miss the boat with simple principles. An example being a job I'm working on now to replace a UC that is designed to emulate the function of a combobox with a datagrid in the dropdown.
This type of aggregation is uneccesary when we go back to the base functionality of the combobox and use the system of messages and overrides to create a real combobox that hosts something other than a lame listbox in the dropdown.
Even when dealing with Windows Forms the immediate reflex seems to be look at as high a level solution as possible and to ignore the underlying elegance of the system.

Sunday, March 14, 2010

The mobile programmer

I am currently sitting in the back of my Land Rover waiting for my daughter who is riding in a show jumping competition.

I have an old UPS which I have silenced by ripping out the beeper, a car battery and my iPhone connected to my laptop.

I am currently getting better internet than I get at home. (See my previous post on how France Telecom is the worst provider in the world)

I should do this more often.

Tuesday, March 02, 2010

Hypermiling

Earlier in this blog I mentioned my Homda Jazz car and the fuel consumption figures attainable from the petrol fuelled motor.
In my recent trips made over the 300 kilometers between my work in Paris and Brittany where I manage a small property development company I have been using some easy to learn techniques to improve milage.
First, I try to accelerate gently and to get into top gear as soon as road speed permits the engine to work smoothly. On the Jazz this can be as slow as 40 KmH on the flat.
Secondly, I try to drive without using brakes. This means guessing distances and momentum to allow me to roll to a stop or to slow in traffic naturally.
Thirdly I coast where possible. Downhill is free! Coasting in neutral to save the clutch too.
Fourthly, I switch off the engine where possible. When coasting I switch off and restart just by selecting fifth gear. At lights I hit the key to start.
Lastly I check tyre pressures and keep them set right. I think that overinflating would damage tyres enough to offset the savings of careful driving.
As a consequence on a run this weekend I obtained 4.5 litres per 100 kilometers. I fit the drive in the time predicted by the GPS. Not slowly and hitting the limit on motorway stretches. That means 62.77 milled per gallon from a petrol engined non hybrid family car.