Ugly Hacks (Feb 24)

In 1971, I dropped out of Cornell and built a very low-budget house. If you could call it that. It was pentagonal, with five trees as corner posts. 2x4s and plywood in between, with plastic for windows. Freshly-cut maple poles supporting plywood and 15# felt paper on the roof.

Then came a few years of ugly hacks to keep it livable, while building a better house next to it. The rafters sagged dangerously at the first heavy snow. Add a cross beam and post. Trees aren’t great for corner support because they sway in the wind. The tops had to go.  Soon, roll roofing to fix the leaks. Chipmunks, mice and squirrels kept living in the insulation, or they stole it. Many vain attempts to make walls rodent-proof. Etc.

The current Goldenseal accounting software also has some ugly hacks inside. In theory, one should thoroughly think out each problem, do the research, then come up with a robust solution. In practice, sometimes people just git ‘er done with the software equivalent of duct tape.

I mentioned refactoring recently. That’s what happens when you get tired of dealing with ugly hacks, and remodel the code to be clearer. Our staff has already refactored most of the really bad hack zones in the Goldenseal code.

But sometimes, the code isn’t important enough to deserve that much attention. So, more hacks join the pile. Getting screen and print layouts to look good is one of them.

For future use, we already rewrote layouts so they save data in text format. It’s easier to debug, and able to handle font names and file paths for images. That code is hack-free, and we can keep it that way.

Problem is, there are several hundred layouts in the old binary format. Modern fonts, buttons and fields are a little bit different, so fields and captions don’t line up very well. Nothing is terrible, but they aren’t great either. Our life will be easier if we can tweak them to look better before saving them into text. It’s temporary lipstick on a pig, and very hack-worthy. In a few years we can dump that code completely.

What makes it worse is that binary layouts are the last vestige of big-endian data. These days, every common OS is little-endian: it’s a technical detail for how bytes are ordered inside a 4-byte or 8-byte number. Pre-Intel Macs had bytes in a different order. The binary layouts can go either way, so there is rather hacky code to read them. It’s easy to get funky data because it’s backwards.

Meanwhile, I’m healthy and still testing negative. Still a Covid virgin.

Dennis Kolva
Programming Director
TurtleSoft.com

 

Covid-2023 (Feb 21)

Our staff is making gradual progress on the Custom Layouts overhaul. There still are details to work out.

The big news is that I may have caught Covid, after 3 years of avoiding it.

Four Ithaca dancers shared a hotel room at a big dance festival in Saratoga Springs last weekend. They required a negative test for entry. One roommate tested positive, and had to drive home on Friday. Sunday night I drove his car-mate to the Binghamton area since his car was gone. Monday morning he tested positive.

It was a four hour drive with no masks on. Guess I should have been more cautious. Tests are negative so far, but the next two days are likeliest for the virus to kick in. We’ll see.

I gave people Covid tests all weekend during my volunteer shifts. At least the process is second nature now.

Dennis Kolva
Programming Director
TurtleSoft.com

 

Bugs & Refactoring (Feb 13)

A rare but nasty bug has been lurking in Goldenseal for years: one that can erase the data in a record. It happens in our own TurtleSoft accounting file, maybe once every 2 or 3 years.

Last week our staff experienced it while reconciling bank accounts. There were clues to the cause. We started a find for Material Purchases, then switched to Other Costs and posted a payment. It seemed to zap the purchase record that was active before the find. All fields were blanked out.

Later testing could not duplicate the problem. We tried all sorts of things. It must need very specific conditions. There’s still a missing piece to the puzzle.

Rare bugs are always the hardest to fix. For now, the best advice is to not do a Find and then leave it dangling while you do something else.

Yep, even after 20+ years of polishing, Goldenseal is not perfect. The root of the problem: accounting software is complicated. Probably more so than a house or a car. There are thousands of moving parts inside. Sometimes they interact in strange ways. Houses have evolved for a few thousand years, and cars for 150. They still have problems. So, perfection probably is impossible for our accounting software. The best we can do is make it as reliable as we can.

One thing that helps is refactoring. It’s the software equivalent of remodeling: tidying up, modernizing, improving the design.

Whatever causes the Find bug, the new accounting app probably won’t do it. We rebuilt its interface. Goldenseal uses the data entry layout for Finds, and switches everything into find mode. The record is still there, and vulnerable. The new app has a separate Find panel, instead. It’s totally separated, and safer. We couldn’t do that in the original app. Memory was too tight. But now we can throw around an extra 100K of RAM, and get a better design.

Goldenseal is an old app, started back when Macs used 680×0 chips, and Windows ran on 386 and 486s. Screens were small. Hard drives and RAM were tiny. Processors were slow. In house years, it was about 1885. The software equivalent of lead plumbing, knob-and-tube wiring, and 8×8 sill beams rotted to sawdust.

On top of all that, the C++ language was only 5 years old when we started to use it for Goldenseal. Object-oriented programming was very new. We made plenty of design mistakes. Now the language has matured, and our staff is more experienced. The tools and the workers are better, this time around.

Meanwhile, our staff spent most of the past week refactoring code in Custom Layouts. We want to make the new data format 100% reliable. It was a major overhaul. For example, Goldenseal has about 20 different classes for the things you drag around in Custom Layouts. The new app uses one class for everything. It’s simpler code that is easier to debug.

Updating has sure taken a lot of time, but the next generation is more solid.

Dennis Kolva
Programming Director
TurtleSoft.com