GRANDAD’S DRY CODE

I struggle to walk, am carless and live alone. While living in Hoekwil, I was able to order groceries using an Android app, from a Wilderness supermarket, where they were brought to me by a young motorcycle delivery man, usually within hours.

Later, I moved down the hill and along to Sedgefield, where there was a huge enough supermarket in the same group for me to assume I would be able to do the same thing, but it turned out that for reasons only their retail manager could understand, this large supermarket is somehow not, as he put it, “on the app”.

It didn’t matter. When I told this bright young retail manager how I was able to do things from a Karoo farm, he said “Oh, yes, no, we do that too”.

In the Karoo, observing that I struggled to walk, the manager of that supermarket supplied his email, (the farm had WiFi but was beyond cellphone reach). I would order by email. He printed and passed it to shelf packers to pick my order, load it into a shopping trolley, and leave it in an office. The manager said it suited him, because my goods were sold before ever reaching the shelves. I would drive into the dorp, park outside the front door and head straight for a cashier. The trolley was fetched, items were rung up, my card swiped, and, seemingly from nowhere, a youngster was summoned to pack my car. If I had nothing else to do in the dorp, I would arrive back on the farm just over an hour after setting out. What a pleasure.

Sedgefield was similar but better. I emailed the manager with my order, a pic of the invoice was sent on WhatsApp, I did an EFT, and not long after, I would amble to the gate and collect my packets. A small delivery fee was added, and paid to the staff member for his trouble and petrol. This was hard for the staff at first, but when the scheme grew, one staffer would pack his boot with up to a dozen parcels, scheme out his route, and earn R300 for an hours work in his lunch break. If he planned his route well, he would do a round trip of no more than five kilometres. This is a win for us all. I don’t take up any space in a shopping aisle, the cashier ladies pick my order “to stretch my legs” as one put it, rings up the trolley, only in a lull when nobody is at her till, and WhatsApps the till slip photo. I Whatsapp a screencap of the bank payment advice, and my packets are assembled for the staffer for delivery.

I am precise with my order: I send a list on a spreadsheet with the exact description the [1] supermarket uses for their apps, stating quantity, description, packing, and notes, eg

1  | Zobo Cleaning Fluid, lemon scent | 750ml | Or lavender

I get the details by browsing through the supermarket Android app, which also gives me prices, near enough. Sometimes a thing is not in stock. To make it easy for the ladies picking the order, I told them to simply ignore a thing that was not in stock, but they would not have it. They would take a pic of an alternative, like a no name brand, and text “may I substitute with this?” Clever. They get to sell more, and I get what I want, just not the same brand.

The process was slow at first: I typed my items as per the table above, but in time, I added new things, until I had a list of a hundred items in my “Stock” sheet. Some things, like fruit and bread, are ordered every week. Since they are already listed, I need only to specify a quantity in the first column, (no more typing). When I order afresh, I clear all those quantities down the leftmost column, and read through my list, entering quantities for this weeks items.

Then, I copy, row by row, my order items, into an “Items” sheet. I had a template for an email stored in a note taking app. I created a new email, copied the text from the note taking app into the draft email. The wording is the same for every order. Then, I would copy the “Item” sheet rows, and paste them as a table below the body of my email text, check the whole order, and send.

DRY

As much trouble as this saved me, it became tedious. This is where the title “Dry Code” comes in. Coders abide by the saying “DRY”. The acronym stands for Don’t Repeat Yourself”. The point of automating is to escape repeating identical and frequent activities. It is no fun typing the same letter anew each day.

Coding

I know enough Javascript to have written a program to automate this process myself, but I didn’t. Firstly, because I need to get internet help with Javascript from time to time, and that is also slow, but secondly because I don’t enjoy spreadsheet typing. Letters and articles are free flowing, but a spreadsheet is a more exacting process. So I did what any lazy typist would: I summoned up Gemini (Google’s AI), and asked it to write me program to automate the whole. Having worked on spreadsheets professionally for twenty years, I knew how to specify exactly what Gemini would need, and the result was flawless Javascript, automating the entire process. The program takes anything from “Stock” sheet with a quantity, appends that row to “Items” sheet, opens an email draft, inserts the text I asked for, then copies and pastes the items after my text as a table headed:

Qty | Description | Packing | Notes:

groceries

All that needed to be done was to create a large yellow button on my stock sheet, captioned Order.
order button

Clicking that runs the whole program. All I have to do is check the order and send. The cashier ladies take over when they receive, and the rest goes as described above.

Before automating this, it would take me around 50 minutes to do all the ordering, copying and pasting. It now takes five minutes. The order takes seconds, the email draft a little longer. I cast an eye over it all, and click Send.

I am not saying everyone could get this right. I did need experience in spreadsheets to be able to frame correct instructions for Gemini. Added to that, if things change (headers and columns in the list, or the wording of the letter), I find it very easy to dig into the code and make such changes. If I couldn’t code, I would be stuck. So, coding is ok for this grandad, but maybe not for every grandad. That does not mean I will not share these programs and layouts with someone, but I lack time and resources for support if they do try them.

I spent many years automating both word processing and spreadsheets, and I enjoy “keeping my eye in”. I also enjoy taking minutes to do things to do things instead of hours, I savagely enjoy avoiding boring repetition, and I especially enjoy that once my software has been corrected, there are no mistakes, no typos, nothing like that, ever. It looks squeaky clean, every time.

[1] That is the Sedgefield SPAR