Interface Progress (June 27)

Our staff is still working on the human interface for the new accounting/estimating software. It requires lots of testing to get it right. That means running the software many, many times. Small bugs and design flaws sure get annoying if you hit them 10 or 20 times an hour. Those are often the first to be fixed.

The file that we use for our own accounting is password protected. After many hundreds of test runs, the sign-on dialog is now extremely smooth. It’s one click easier than the Goldenseal sign-on.

Data entry screens for Sales and Material Purchases also work well, and look good. We use those the most, so they get the most tweaking.

A lot of formatting details in Qt are handled with style sheets. They are a lot like website coding with css and html. Web programming is less fun than C++. There is no compiler, no debugger, and no error messages to tell you about mistakes. Get a tiny punctuation mark wrong, and it just won’t work. Often it takes trial-and-error to fix problems. Futzing with style sheets is one reason why we test so many times per hour. Add a comma and try again.

Our staff just finished the basic appearance for breakdown tables. Having them in a separate window is a big improvement. Right now we are working on more fancy stuff in tables. For example, when you fill in a Cost Area, it needs to change what shows in the Item column. To make that work, we need to connect the Qt table to our existing code, or else rewrite it entirely in Qt.

Breakdown tables are one of the most complicated parts of our current accounting software. They are in a few dozen files with a few thousand lines of code. Much of it is obsolete. Anything to do with clicks, fields or screen display is now handled by the Qt table. So we started off by clearing out tons of old code.

Removing obsolete code is a gradual process. First we turn it into comments: green text that is easy to ignore. If still unused in a year or two, we move the text to the bottom of the file. A few years after that, it’s safe to delete it entirely. Often we add a note about what’s gone, just in case there’s a reason to retrieve code from archives.

Over the past couple weeks, about half of the table code moved to step 1, or from step 1 to 2. Some really old stuff from OS 9 is now totally gone.

There’s a saying that carpenters never finish work on their own house. The programmer version is that code is never completely done. There’s always something that can be deleted, or replaced, or improved.

Dennis Kolva
Programming Director
TurtleSoft.com

Bits & Bytes (June 17)

In movies, computer programmers often work at a screen full of binary digits. 01110101 01100010 10011011 01011101 01001111. For most people, it just looks like gibberish. For real world programmers it’s gibberish, too. A blur of zeros and ones. We almost never work with raw bits. The smallest size that makes sense is a byte (8 bits), often treated as a text character. Most numbers are 2, 4 or 8 bytes in size.

Yep, raw binary isn’t very useful, but this week we fixed a small mystery problem that was all about the bits. It involved a “bit” of C++ history.

Our accounting software stores hundreds of checkbox values. A single bit is enough for a yes/no choice, but computers are not designed to store anything that small. One byte is their minimum size.

These days, the standard way to store yes/no items is in a full byte. It wastes 7 bits, but who cares about that when there are billions of bytes in RAM, and trillions on the drive.

It wasn’t so easy in the early days of our accounting software. Those PCs only had a few megabytes of RAM, shared with the system and other apps. We had to be frugal. Hard drives only held 100 megs, so file size was also a concern. To save space, we often packed 8 true/false values into a byte.

Back then, the most common way to do that was with bitmasks. They use binary operators to work on individual bits. For example, a binary AND with 4 gets you the third bit. 128 gets you the 8th. Bitmasks are hard to read and easy to screw up: not much better than raw 01110101. They caused many bugs in the early days of Goldenseal estimating/accounting.

When updating to 64 bit, one of the first things we did was replace the bit masks. Modern C++ has a better way to handle them:  bitfields. They also pack bits into a byte, but each value has a name. That makes the code more readable. Debugging is easier.

The obscure error happened because in the mid-90s, some bold TurtleSoft programmer made a bitmask on a 2-byte number. It used mask numbers all the way up to 32768. When we switched it to a bitfield 5 years ago, the byte order was wrong: one of those big/little-endian problems that I talked about a while back.

The bug didn’t show up until we tested with Customer records in our TurtleSoft file. They have a few custom fields, which were disabled improperly because some bits were wrong. While fixing that, we also revised the way we store specs for all data fields. It’s now cleaner and more future-proof.

In case any serious programmers read this blog, I should clarify that it sometimes makes sense to work with raw bits. For example, if you want to multiply by 64, just shift bits to the left by 6 places. It’s a lot faster than regular math. There’s a whole realm of high-efficiency programming that squeezes out extra speed with tricks like that. Games use them a lot.

TurtleSoft builds stodgy old accounting software, with no need to shave any microseconds. Our top priority is accurate, reliable code that is easy to maintain. Not everyone has that luxury.

Dennis Kolva
Programming Director
TurtleSoft.com

 

 

 

 

 

 

Complexity (June 9)

Our staff is making steady progress on the new estimating/accounting software. Lately it has involved a lot of fiddling with the Qt message systems. They often have several ways to do the same thing. Half the battle is figuring which are best to use.

Our staff has worked with the Qt framework for 20 months now. It is starting to be very satisfying. There are visible rewards every hour. Our time spent with Apple’s Cocoa and Microsoft’s MFC were both disasters. Qt has been the opposite. It’s not perfect, but it works without trauma.

It’s still hard to tell when we’ll be ready to ship the new accounting app. There are plenty of small details left to finish. A good guess would be Fall 2022: some time between September and December. The estimate will grow more accurate as we get further along.

Even with familiar tools, programming has not always been fun. During the past month we wasted several frustrating days because of mystery bugs in other apps.

A few weeks ago, SourceTree stopped working on Windows. We finally had to switch to a different source control system. Not long after that, WordPress auto-updated to version 6.0, and lost the ability to write new posts. After some fiddling, it eventually worked again. No idea what fixed it. This week, Qt Creator suddenly gave hundreds of weird errors deep in Qt code. No idea why. It took a complete re-install to get it back to normal.

All three episodes are symptoms of a bigger problem: computer code has become too complex. These days, all software relies on libraries created by other people. In turn, those rely on piles and piles of ancient code created by still other people. It goes many layers deep.

Some parts of the foundation are solid, but many were never meant to be mission-critical. A programmer whipped out code years ago to solve a minor problem, and it gradually became essential. Most likely the original author is long gone. Nobody else understands the code, or has time to work on it. Until it breaks. Computer viruses, worms and other forms of hacking are nearly always based on subtle bugs in that buried code.

We face the complexity problem every day, even working in our own familiar files. There’s no way to fully understand every bit of code. We can get stuff to do what it should. We work hard to make the code rugged and understandable. But there are so many pieces, and ways to go wrong. It will never be perfect. The only consolation is that nobody else is perfect, either.

Dennis Kolva
Programming Director
TurtleSoft.com

 

Covid-19: Super Spreading (June 3)

175 people attended a Biogen conference in Boston on Feb 26, 2020. One of them brought Covid-19 from Europe. Over 100 left with it. They spread the virus to most of Massachusetts and beyond. Eventually, that strain of the virus infected a few hundred thousand people.

The conference was a super-spreader. Early in the pandemic, there were others: Mardi Gras, a choir practice in Seattle, weddings, funerals.

10 days before Biogen, I was at the Dance Flurry in Saratoga Springs NY. It’s five thousand people dancing and having fun in crowded rooms. People mingle, talk, breathe hard. They come from all over the US and Canada, plus a few other countries. Contra dance is the perfect way to spread a virus.

The Flurry dodged a bullet. At the time there only were 15 confirmed cases in the US. However, testing was sparse back then. The actual number probably was in the hundreds or thousands. Pure luck that none of them attended. It would have turned the weekend into a super-super-spreader event. Big enough to totally change the trajectory of Covid-19. The pandemic might have roared into the US a week or two sooner, with everyone even less prepared.

All contra dances shut down in March 2020, along with many other group events. This year they are inching back slowly.

For the first few years of attending dance festivals, I’d always catch a generic cold/flu at them. Then it tapered off. Recently, I was down to just one cold every two years. Maybe being exposed to every possible virus has its benefits. Keep the immune system on its toes.

This summer I’ll attend an outdoor festival and a few smaller events. It will be strange, after more than two years of social distancing. Most likely I’ll catch Covid-19 at some point, as life grows more normal. With luck, masks plus the second booster will be enough to prevent extreme sickness and/or Long Covid.

As many people are finding out, catching this new virus doesn’t add much immunity. It’s easy to have it more than once. Ditto for any respiratory virus. I think that happens because they infect mucous membranes. Those are expendable cells that divide quickly, die young and slough off along with the slime they produce. It’s how your body keeps danger away from the more important bits. Your immune system doesn’t take upper respiratory cells very seriously because their turnover is so fast.

Vaccines are more effective because they inject into the body interior. Your immune system freaks right out when it spots foreign matter in muscle or bloodstream. A hefty bout of pneumonia is another way to ramp up the memory B-cells, but that’s a risky way to become immune. Better to learn it from the fake version.

Meanwhile, it’s tick season. Right now, Lyme Disease is a bigger worry than Covid. A vaccine for it came out in 1998, right when the anti-vax movement started. Sales crashed, and it was discontinued in 2002. I’m resentful about that, every time I find nymphs and/or bulls-eye rashes. It’s growing worse every year.

Dennis Kolva
Programming Director
TurtleSoft.com