Goldenseal Pro Progress: Custom Layouts (July 30)

Since the last post, our staff has worked on the Layouts panel. It’s the successor to the Custom Layouts command in the current Goldenseal.

Last week, it took a day to get fields to move around when you click and drag, and to move in groups after shift-clicks.

Getting fields to show little black resizing squares took a few days. Then, two more days to draw the black squares in the right places during a move. The code has to check the mouse position many times a second, and redraw all the boxes in slightly different places. A lot of CPU just to move some dots around.

It took a day to figure how to right-align text, then a couple more days to get drags to resize the boxes properly. Drags were doing some crazy stuff until we fixed all the bad logic.

Spending a week on little dots may sound like excruciatingly slow progress, but actually it’s going quite well. Custom Layouts in the original Goldenseal consumed about two programmer-years. So far the pace is much faster with Qt. It probably only needs another month or two.

I think we can get Layouts functional by the first release. That’s a good thing, because most of the current windows will need tweaking to look good on bigger screens.

Different types of programming work seem to burn out different brain areas. It’s probably time to get away from Layouts, and move on to something else for a while. There are plenty of choices.

Meanwhile, active Covid-19 cases in the county suddenly jumped from 3 last week, to 57 yesterday. That’s worse than anything during summer 2020. It’s a junior version of what’s happening in many other parts of the US. Alas.

Dennis Kolva
Programming Director

Goldenseal Pro Progress: Memory (July 21)

As you run Goldenseal accounting software, the app creates all sorts of things that sit around in RAM. Some last a long time, and some are just temporary.

If we don’t delete temporary items when they are done, the app will gradually consume more and more RAM. It’s called a memory leak. Eventually the computer will get low on memory, and slow down. It may run out entirely, and crash.

If we delete too soon, the app may try to use something that doesn’t exist. That causes an instant crash.

Our code sends thousands of little things flying around on your CPU every second. Keeping them from leaking or crashing is one of the biggest challenges for programmers.

The C++ language does not manage memory automatically. Fortunately, there are ways to do it without much fuss. Thanks to careful programming, the current Goldenseal rarely crashes. It does leak 40 bytes of memory whenever you open a new window, but it will take months of constant use for that to become a problem. That’s an old PowerPlant bug that we’ll lose in Goldenseal Pro.

Qt manages memory by giving a parent to everything but top-level windows. When you quit or close the window, the parent deletes all its children. Those delete their children, and so on down the chain. The system works well. If we forget to give something a parent, it floats all by itself on the screen. Hard to miss.

Newer languages like Java, Python, Swift and Objective-C manage memory automatically. The problem is, there is no guaranteed way to do that unbreakably.

Most languages use some form of reference counting. When something else links to an object, it adds 1 to the count. When they are finished, the count decreases by 1. When there are zero references, it’s time to delete the object. Most languages wait for a while then delete everything at once: it’s called garbage collection. When an app suddenly stalls out for a second or two, it’s probably emptying its trash.

The biggest problem with reference counting is that it can’t handle circles. If two objects reference each other, deleting one of them will leave a dangling reference in the other. It won’t die when it should, which causes a leak.

In Python, you are just supposed to never make circular references. That’s not easy, because often it helps to have a two-way link. We use them all the time.

Cocoa has strong and weak references to handle the problem. We found it to be hard to set up, and even harder to debug. We spent several months tracking down weird memory problems when we used Cocoa, 2016 to 2019. Sometimes ‘easy’ really isn’t any easier.

Qt is completely C++. It’s kind of like going from an automatic transmission back to manual. No need to guess what the gearbox will decide to do.

Meanwhile, our staff took a break from breakdown tables this week, and switched over to Custom Layouts for a while. It’s a nice change of pace. There are plenty of tasks left to do, and no reason to finish them in any specific order.

Dennis Kolva
Programming Director

Category/Item Breakdowns (July 8)

From 1989 until 2007, I taught classes for our estimating and accounting software. It was a good excuse to visit most parts of the US and Canada. The classes covered the Excel-based MacNail, then the current Goldenseal. Over 1000 users attended, and learned how to improve their businesses. I also learned first-hand what people found most confusing.

One problem area in Goldenseal was the two different ways you can itemize things in estimate and expense breakdowns. There are category breakdowns, where you just type stuff in. Also item breakdowns, where each line pops up a list of unit costs (Assemblies or Cost Items).

With hindsight, the split isn’t as useful as we first thought it would be. There still has to be a way to type unlisted things into a item breakdown. And category breakdowns still have to reference items like Bids and Allowances. They really aren’t different enough to be worth the extra fuss. Even worse, the names are rather confusing.

With Goldenseal Pro, we have a chance to fix some of the design flaws in the original Goldenseal. The category/item split is one of the worst. Goldenseal Pro will have just one type of breakdowns for estimates, expenses and sales. That’s one less thing to think about. One less thing to explain.

In Goldenseal Pro, if you want to pop up a material cost item, you’ll use a Material Item. If you want to type in a material, it’s Material Text. Ditto for labor, subcontractors, equipment or other costs. The names are revised from the current version, but they act the same otherwise.

This week we finished the code that converts old-style breakdowns to the new format. That way old data will still be usable. It probably will take a few more weeks to get all the little quirks working for breakdown tables. We can link into existing code for some of them, but some will be easier to just redo in Qt.

At first, testing showed weird errors. Eventually our staff discovered that for expenses, the menu doesn’t include the option to type in materials. For 20 years our testers never noticed it, and nobody ever reported it as a bug. I suspect it was because the whole category/item thing is so confusing. Nobody ever realized it was just a bug with an easy fix. Anyhow, it works properly now for Goldenseal Pro.

Breakdown tables are already further along than we ever got in our previous efforts with Cocoa and MFC. Progress is looking good. It’s just a matter of time.

BTW right now is the perfect time for users to tell us about any other frustrations with Goldenseal. It’s not too late for us to make design changes to improve it.

Dennis Kolva
Programming Director