Zeros & Ones (Nov 19)

You probably start with number one whenever you list things. Generally that is what the Goldenseal code does, too. 1, 2, 3, 4, 5… The current version is based on a framework called PowerPlant, which also starts lists and table rows at number 1.

The C++ language starts lists at zero. 0, 1, 2, 3, 4… Hard-core programmers will give you all sorts of reasons why zero is better than one. The Cocoa framework that we used for 3 frustrating years is also zero-based. So is the Qt framework that we use now.

When two number systems collide, it is very easy to get “off by one” bugs. There are many ways to make those even when you don’t have two different numbering systems, but a mix of 1-lists and 0-lists makes it extremely easy to err that way.

When we set up breakdown tables last spring, our staff solved the conflict by using 0-based rows and columns in the Qt tables that are visible on the screen, with a conversion when they talk to the original Goldenseal tables that lurk in the background. Add one when going down, subtract it when going back. That way the existing business logic still worked OK.

For action commands, it wasn’t worth keeping the original Goldenseal tables. Not enough code in them to justify their existence. So, those dialogs do everything with 0-based tables. Unfortunately, it created many off-by-one errors. Even worse, they often are the nastiest kind of bug. Fix one, and it breaks something else.

It finally was time to refactor the code and make it less prone to off-by-ones. We did that this week. To start, we added a Q to the name of everything that is 0-based. That didn’t solve any problems by itself, but when we fix bugs, now they stay fixed and don’t break something else. It’s more obvious what needs a 0 and what needs a 1.

The deep, deep root of the problem is that computer languages evolved. They are the result of many small short-sighted decisions, rather than a master design. Many details seemed like good ideas at the time. Then they turned out to be monsters later.

It’s kinda like what you face as a vertical human. The standard mammal body plan has four feet on the ground, so your hips and neck each had to rotate 90° to make the new posture work. Backbones were forced into a tight curve, with a painful change of loading direction. Necks rammed into where teeth used to be, pushed them together and made them crooked. For the most part the design works, but it’s buggy.

This is a roundabout way of saying that we are still working on the action commands for TurtleSoft Pro. They are more difficult than expected. We’re making progress, but it’s slower than we’d like.

Dennis Kolva
Programming Director
TurtleSoft.com

Project Billing & Payroll (Nov 10)

Our staff is gradually finishing the action commands that make accounting easier.

One of the hardest is Project Billing. Goldenseal currently has five different menu commands for it. They handle three ways to bill for projects (draw schedules, progress payments or time & materials), plus allowances and change orders.

In TurtleSoft Pro there is just one Project Billing command. After you open the window, you can switch to each type of billing. It’s easier, especially if you don’t remember how a project was set up.

A few weeks ago, we took a huge, cluttered data structure for Deposit Funds and whittled it down. For Project Billing, things went in the opposite direction. Each type of billing used its own data structure that was passed around to all sorts of places. They were similar, but each had its quirks. We merged them all into one.

Another tough one is the Write Payroll command. In fact, payroll is probably the most complicated thing in our accounting software. The window shows a list of employees, with payroll info for one pay period. That’s not hard, but looking at the details is the opposite. Depending on where you click, it will show employee hours, commissions, deductions, employer taxes, benefits, or holiday/vacation pay. There’s also a breakdown for category taxes, mostly used in states that base worker’s comp on the type of work done.

Goldenseal uses seven different breakdown windows for Write Payroll, one for each type of details. TurtleSoft Pro has just one window for everything. It fills in different table columns and different data for each type of display. The data structure didn’t change, but we had to do a lot of copy/paste to get all the code into the same place.

We aren’t yet finished with Write Payroll. Fortunately, once the interface works, it links into well-tested business logic that does not need to change. That’s also the case for the other action commands. Mostly we have to futz with the text for table cells.

Dennis Kolva
Programming Director
TurtleSoft.com