Wednesday, July 30, 2008

... some standard design patterns

“Design patterns do not lead to good design. Good design leads to design patterns."
- Alan Shalloway

Friday, July 25, 2008

Intuitive is subjective

You can't tell me something is intuitive.

You can tell me that you think something is intuitive.  Or 8 out of 10 people that used it thought it was intuitive.

Only I can say if I think something is intuitive.

Friday, July 18, 2008

Don't catch NullReferenceException

Consider the function:

private string GetObjectValue(object param)
{
                try
                {
                    return param.value.ToString();
                }
                catch (NullReferenceException)
                {
                    return "";
                }}

It would be much better to do this:


private string GetObjectValue(object param)
{
                if (param != null)
                {
                    return param.ToString();
                }
                else
                {
                    return "";
                }}

Exceptions are expensive. 
Handling the error adds an average of 16 ticks to the execution in my testing. This will add up.

Thursday, July 17, 2008

Make applications understandable

"One of the jobs of the appliaction is to make it easier for you [the user] to understand how to use the application"
- Joel Spolsky

Installshield conditions

The condition for a first time install is:
Not Installed

For a complete uninstall:
REMOVE~="ALL"

For any maintenance operation (repair, modify, uninstall, anything except first time install):
Installed


The above came in handy when I ended up wrting this to not display a messagebox on a silent install:

function WarnUserIfNotSilent(hMSI)
  STRING szProperty;
  NUMBER iSize;
begin  
  iSize = 256;
  if (MsiGetProperty (ISMSI_HANDLE, "UILevel", szProperty, iSize) = ERROR_SUCCESS) then
    if (StrCompare(szProperty, "2") != 0) then
      MessageBox("A message.", WARNING);    
    endif;
  endif;
end;

Wednesday, July 16, 2008

Why do I work in IT?

Because it affords me the opportunity to make things simpler and easier for people. Improving lives through technology.

It's also a relatively new industry and while this can sometimes be frustrating, it's also exciting and there's always something new to learn.

Xobni Setup

This is the last screen on the Xobni installer. A pleasant change from the usual practise of hiding a list of staff names somewhere in an app.

Friday, July 04, 2008

why write unit tests before fixing bugs?

Because it's really satisfying to see the number of failed tests go down as bugs are fixed.  How else can you be sure that you are making progress and actually fixing the bugs?