Version 2 first attempt - High Level Pseudocode


10/10/04
 

Finally...

I've finally decided to have a go at re-engineering my Expiry Checker!

Version 2 first attempt - High Level Pseudocode

With hindsight, I can see that not thinking in terms of functions for the first version was a big mistake. The code just kind of grew and grew, but this time I'm going to start off by trying to think "modular"! I'm also going to use version 4 of PHP; we currently have version 4.2.3 at LSBU. (Version 5 has just been released, but I'm sure it'll be several months before we have that up and running.) I'm also planning to store the expiry data in the form of an XML file. I could use MySQL, but I'd like to take this opportunity to get some experience with XML.

I'm going to re-design the system with the idea that Mondays are expiry message days; so I will re-name the files etc. with this in mind, as I suggested in my last version 1 blog entry.

Here's my first attempt at the high level design:
 
To begin with, we need this...
function CreateFreshExpiryDataFile()
...in order to create a fresh file on first use of the Expiry Checker.

Next, we need this...
function AppendExpiryDataToFile( *parameters* )
...to be called whenever an expired page gets hit.

Finally, we need this...
function SendExpiryMessages()
...which will get executed once, first thing on Monday morning.

Main Program:
If the referring page has expired then
  If ExpiryData.xml doesn't exist, CreateFreshExpiryDataFile
  Append the expired page data (using AppendExpiryDataToFile)
  If ((today is a Monday) but (ExpiryData file is pre-today)) then
     Send out the expiry messages
     Re-name ExpiryData.xml to ExpiryDataLastWeek.xml
  Endif
Endif
 

 
 

<<contents ^top^