Yesterday evening I was working as a freelance Priority programmer when I
had recourse to use a special technique that I had developed a month or two
ago. Unfortunately I only remembered that the technique existed but I
couldn't remember its details. I knew that I had documented it, so I
launched the Blog Manager Program (BMP) for "the other blog", looking for
the specific entry, which I found after a few minutes.
This entry gave the backbones of the technique but not the actual details.
For that, I knew that I would need the name of the procedure in which I had
used the technique, but this essential detail was missing from the blog.
There's no easy way of finding a given procedure in Priority, especially if
one doesn't remember its name, so I had to look through several menus until
I eventually found the procedure and of course, the special technique.
Back in the BMP, the first thing that I did was to edit the saved entry to
include the procedure's name (this doesn't appear on the Internet version of
the blog). Then I thought that it would be a good idea if I could find this
entry without having to search for it, or as I called it, "pin the entry to
the start bar". Of course, the BMP doesn't have a start bar and there's no
concept of pinning, but after a few moments' cogitation, I realised that it
would be very simple to have a list of blogs displayed on program
startup.
At first, I implemented pinning by creating a new table named ... yes, you
guessed it, 'pinned'. This table has only one field, 'blog', and obviously
any blog whose number is in this table is pinned. I wrote the code necessary
to check whether there were any pinned blogs and if so, to display them.
Then I went over several units in order to add code to either pin or unpin a
given blog.
I then took the dog for a walk, and realised that I wasn't thinking totally
straight. As Fred Brooks wrote in his book "The mythical man month",
plan to throw one [implementation] away; you will, anyhow. Obviously, a table with one field isn't a particularly good idea; much
better would be to add a 'pinned' field to the 'entries' table. This way I
don't have to deal with 'insert' and 'delete' statements; instead, the
field's value is updated to either 1 (pinned) or 0 (not). This is much
simpler, and in fact, the updating is done by one central and common
procedure.
It would be nice if this procedure could also check whether there is a list
of pinned blogs being displayed, and if so, update it. Another possibility
would be to display a list of pinned blogs if one is not displayed. This is
slightly problematic, because 'the list' or a rather, a query of entries
whose value of pinned is 1, is not a simple list but instead an invocation
of the 'temp' table with a specific instance number. So I would have to
either insert into this table or delete from it, then cause the pinned
window to update. Not too complicated, but fiddly. The first thing to do is
save the instance number of the pinned window.
This day in blog history:
Title | Tags | ||
---|---|---|---|
44 | Holiday | Holiday, Joni Mitchell | |
187 | Speed, speed, speed/2 | Programming, Office automation | |
614 | Transferring more cassettes | Personal, Old recordings | |
744 | Research proposal accepted | DBA | |
965 | The night manager | TV series, John Le Carre | |
1410 | My father's eyes (song) | Song writing, Father | |
1648 | Exhausted but happy | Song writing, Swimming, Musical group |
No comments:
Post a Comment