Early Enough For You?

Interesting post from Jeff Attwood.

He makes good points about not pushing your code the extra mile to get it absolutely perfect before shipping, although the Rumsfeld quote is always unfortunate IMO, and there is a lot of truth in it.
However, it is not that black and white. The correct balance has to be struck. We all know the development paradigm, balancing time, quality and cost; something always has to give. It is invariably quality, and maybe Jeff is right and that is the first thing that should go, but not at any quality. If it is not good enough, then it should be held back, releasing a pile of rubbish will do more harm than being a bit late.

I personally think that Excel 2007 was released before it should have been, and Vista most certainly was. These were development decisions made for marketing purposes, and I don’t think it has enhanced Microsoft’s standing or image.

Conditionally Yours

VBA is a very simple
language and programming environment, very easy to get something up and running
very quickly, but it is showing its age these days, and with Microsoft making
no improvements to the language it will not get better.

Which all means that we
should utilise all of the functionality already available to us. I was using a
particular technique the other day, and I recollected a discussion on one of
the popular Excel forums that I had participated in, one in which I was surprised
at the lack of knowledge of this technique.

The situation I found
myself in was that I had developed some functionality in an application, and
this functionality was quite sophisticated, but was not fully working as I
wanted. I needed to deliver something, so I decided to do it in a simpler way,
but I didn’t want to just lose my previous efforts, I wanted to continue to try
and complete my initial attempts.

I could have just stripped
out all of the old code and added in the new code and save it as a new
workbook, I will still have the original code from the previous workbook. But
this would mean that any other changes that I made to my new workbook, other
than this revised function, would need to retro-fitted into the old workbook
otherwise it would soon be useless. I think the chances of messing this up are

Another way would be to
create a Public constant, and test this variable and execute the code depending
upon this variable, something like this

Public Const NewVersion As Boolean
= True

And then in the modules,
code such

    If Not
NewVersion Then

       ‘old code

        ‘new version code
    End If

This works okay, but of
course all of the code will be compiled, and there are potential problems if
you have variables associated specifically with the old or new versions, if
they are being used incorrectly elsewhere the compiler will not throw them out
as they will still be defined.

The solution is to use Conditional Compilation. This is similar
to the technique above, but a conditional constant is used, and conditional
statements. The code would look like this

#Public NewVersion = True

And then in the modules,
code such

    #If Not NewVersion Then

       ‘old code

        ‘new version code
    #End If

The advantages to this
approach are:

depending upon
the value of the conditional constant, only that part of the code will be

unlike standard
If statements, public variables can be wrapped in #If … #End If statements

VBA contains a
few built-in conditional constants, such as Mac (test for Mac platform), Win
(Windows), VB6, which are available to use

the conditional
statements can help ensure variables are correctly used when compiling

identifying the
code to strip out if and when it is decided that one approach is the preferred
way is facilitated by the #If statements.

I tend to put conditional
constants in each code module, although it is possible to set it in the project
properties. I just find the module approach more intuitive, you can assign
values such as True/False whereas in the project properties you have to set
values of -1/0 (sic!). It also means I can have different values in each module
when I am testing. Note that conditional constants will not accept an explicit
Public declaration, nor will they allow strict data typing.

This is an extremely
useful technique, but just remember to have those values properly set at the


One King Bearing Gifts

I got a new laptop on Friday (my old one gave up the ghost
as explained here).

One of the major pains of a new laptop is re-installing all
of those applications. It takes so long, and inevitably you will be working and
you realise that you need another utility, which means you have to interrupt your
flow to grab it and load it. I was more prepared for this installation than I
usually am, I had compiled a list of those applications that I wanted, my
directory structure, and URLs to the files, but I missed plenty (you just
forget some of those things that you use, such as Inno
until you need them).

I am sure that many of you will be saying that if I had
taken a disk image, re-installing would have been a breeze. That may be so, but
I tend to see re-installing as an opportunity, an opportunity to get rid of
much of the crud that accumulates over time, only install the things that you

As one would expect, some things went so smoothly, some
things did not.

Installing Office 2000 and Office 2003 was a breeze, I
remembered that I wanted VBA loaded (yes, I have forgotten it before), and it
loaded so quickly, so effortlessly. I had to do all of the customisations,
remove those stupid restricted menus and always show the full menus. I did get
caught by not giving Trusted Access to Visual Basic, and one of my VBIDE
routines failed, but that was soon rectified.

Office 2007 was no great problem, it took a lot longer than
2000 or 2003, but I guess that is the way that things progress. One of the
pleasing things is the way that many settings seem to get inherited by all
versions. I know this may seem like heresy, but I have missed 2007. I can’t say
I am a fan of the Ribbon as I think it is a mis-guided concept and is
restrictive and inefficient, and there are many things broken in 2007, but
since I have loaded it I have tended to use 2007 as my default Excel. As I have
said previously, I have enjoyed using Excel
but I heave eased into 2007. I have also adopted Outlook 2007, but one
email client isn’t much different to another is it? Word 2007 still grates with
me, it seems perverse (but Word has always seemed perverse to me, just look at
how it keeps messing bullet lists up). Building the QAT back up was far time
consuming than I would like. I know Jon Peltier doesn’t believe in customising
the QAT, he says that is subverting to MS’ ribbon philosophy, but I find that I
have to have my most frequent functions on hand.

But why oh why do all new applications get added to the foot
of the program list? Why doesn’t it get slotted in alphabetically. The bottom
is usually the last place I want it.

And while we are at it, why is the Quick Launch toolbar
hidden in XP, and locked down to boot?

One thing that went remarkably smoothly was my Firefox
bookmarks. I use XMarks to synchronise my
bookmarks, so a quick login to XMarks, tell it to synchronise with this laptop
and remove all existing bookmarks, and I was up and running. All of my
bookmarks, all of my RSS feeds were re-installed in minutes, and XMarks will
keep me up to date ready for my next laptop crash (thanks Aidan!).

It took me a while, but I am back and active now. I am sure
more things will arise over the next few weeks (I still need to add another
partition and install Windows 7 dual boot), but essentially we are there.

One thing to finish with. Where we would we be without free software,
open source and not. The following is a list f some of the free software I have
loaded and use regularly

Inno Setup
Belarc Advisor
Code Cleaner

Plus others that I am sure that I have missed
(so, Mike
, with quality free products like this, why shouldn’t  corporations trust them?)