Friday, November 09, 2018

Improving a solution

I thought that I had written about a problem which I had with loading external files containing Hebrew into Priority; the Hebrew text wasn't being reversed when read by Priority (or rather, it was being reversed but not unreversed). One day, I realised that I could write a program which would reverse the Hebrew in advance (this would have the Hebrew left to right). Once read into Priority, the left to right Hebrew would then be corrected to right to left, which is the way it should be.

The original data flow was:
  1. Copy the external file to a special directory, changing its name (this is so the interface program in Priority can find its input)
  2. Read this file into a holding area within Priority, very basic structure
  3. Move the data from the holding area into another holding area with better defined structure
  4. Convert the data in the holding area to the customer order format.
The problem with the Hebrew was in the first stage: the basic holding area had reversed Hebrew strings. The original program - which stopped working - corrected the data in this holding area, between stages 2 and 3. As I am not able to write a program which accesses data within Priority tables, this option was denied to me, so I decided to attack the first stage: my program ('RevHebrew') altered the original external file prior to its being read into Priority.

At some stage, I realised that I only need create a backup file if RevHebrew actually reversed anything in the file; this cut the number of backup files by at least 50%.

A few days ago, it occurred to me that I could simplify matters if I used RevHebrew at a later stage. I wrote a new version of the program which didn't save its original file with a new extension (this required removing exactly one line from the original program) and set this to work on the file which has been copied to the special directory. 

The benefits of this are two-fold: there is no 'original backup' file, and the file which is backed up by the Priority program has the Hebrew in its correct form, not in reversed form. Thus if we ever need to input the file again (which I sometimes do in order to check where a problem occurred with a file's contents), there won't be a problem with the Hebrew.

The programming house who were supposed to check the original program and write a replacement had the cheek to send me a bill for work done. I returned this, noting that their 'solution' is not a solution and that the assigned programmer obviously did not understand the problem, judging by his solution. This was only yesterday, so of course I have yet to receive any response from them.

No comments: