Programming Humor 3

Indeed but “while something” can be semantically cleaner for showing the intent of the code.

Quite so - and clearly showing the intent is important.

There was a fashion some 40 years ago for methods being single-entry-single-exit. Nice in theory but made for convoluted and nested if-then-else. Incomprehensible code, often. My approach is on entry to test for obvious errors first and return an error code. then get into the meat of it, testing all the while and returning errors ASAP. That reduces clutter.

1 Like
While Not rs.AfterLastRow
  // process record
  rs.MoveToNextRow
Wend

I prefer this:

Do Until rs.AfterLastRow
  // process record
  rs.MoveToNextRow
Loop

8 Likes

4 Likes

I prefer:

while  (rs.AfterLastRow=False)
 // process record
  rs.MoveToNextRow
Wend

I dislike constructs as if(bool=false) or if(bool=true).

I’ll try always make it like if(bool) or if(not bool) using proper names as isReady, isWrong, etc

A condition like

(rs.AfterLastRow=False)

results exactly as a

(Not rs.AfterLastRow)

At assembly level.

And the inverse, comparing with “true”, the same thing.

if(bool) or if(not bool), in assembly, just change a jump-if-equal (je) for a jump-if-not-equal (jne)

Zero degradation.

But a

if ( noErrorFound ) Then

Is preferred over

if ( noErrorFound = True) Then
2 Likes

image

The Apple House

I recently upgraded my house to Sonoma (my house had been running Catalina up until then). I didn’t realise it at the time, but this resulted in the side door and the conservatory doors automatically being deleted, and the only way in/out of the house was then the front door. The windows all remained, but perhaps they are implicit instances.

The stairs had also gone, as had all the doors normally visible on entry. Where the stairs were was now a room labelled “Settings”. I went in there, eventually to find one of those long clothes racks you see in department stores, only instead of a rack of as it might be suits or dresses, that was where all my doors were, hung up each on a hanger. A door needed enabling before it could be used, with a large panel that I eventually found entitled “Door Enablers”. Having enabled a door, it was possible to go through it and find oneself in the apprpriate room. Exiting the room took one back to the Settings Room. I also observed that the doors rack included appliance doors where such exist, such as dishwasher, oven, etc.

There was a large panel entitled “Appliance Power”. The on/off switch for all house appliances (not the switch at the wall socket, but that previously on the appliance itself) were to be found here. Not too far from there was another panel with the soap fixtures, such as the slidey clickey thing you put the dishwasher tab in, the tray where you pour the washing machine soap into, and the soap bars or bottles from all the sinks in the kitchen, utility room, toilets and bashrooms with their baths and showers. All here on the one panel, with their trays if needed for such as a bar of soap.

To run the washing machine, then, required that I power it on at the appliance power panel, then go to the doors rack and find the washing machine door amongst all the others, open it and put in the (aggh!, the dirty washing, so a number of side trips to the various rooms (via the doors rack) to collect it) dirty washing. Then off to the Soaps and Related Items panel to add the detergent. After some hunting around, I found the Washing Machine - Misc Controls panel, where I could set the spin rate (but only after pressing the Advanced… button and entering my house password).

I thought that was it, but after visiting the Utility Room (via the doors rack, again), the washine machine appeared to be a featureless cube, and was inactive. So, back to the Settings Room, where after some thought it occurred to me that I hadn’t set the wash duration. More thought and searching led me to a Timers Panel in an obscure corner of the Settings Room. On it were the timer settings for all the house appliances, such as cooker, washing machine, dishwasher, alarm clocks and so on. Finding the Washing Machine Timer I could then set an appropriate value (I think - by then I’d forgotten what it was I was washing).

The washing machine was still inactive, but another panel had Appliance Start Buttons on it so after that, I could see that the washine machine was running.

I’m minded to wonder how this is supposed to work for those actually taking baths or showers. Do they have to continually visit the Settings Room to get a bit more soap? I must say I’m not convinced by all this, and I’m seriously considering downgrading the house to Monterey.

7 Likes

I used to say of OS changes that the accelerator and brake pedals of my car never changed, but now that my car is almost entirely software-defined and over-the-air update-able, that’s no longer necessarily true.

5 Likes

Yeah, I would give them the cookies.

4 Likes

9 Likes

432686370_439164861785786_7951638737979028725_n

3 Likes

It’s to aggravate the old old like me!

8 Likes

pouwahahhaha ! Love it !