Refactoring Goldenseal (Mar 29)

Back in Summer 2014 we realized that Goldenseal needed a major overhaul. Apple stopped updating the Carbon and QuickTime frameworks that we used, so it was just a matter of time until it stopped working.  We searched for and tried out several different subcontractors to rewrite the GUI (graphic user interface).

Meanwhile, our staff finished one additional update to Goldenseal, but then started to refactor the existing code. The first thing was to remove old crud left over from 68K Macs. Then we converted 32-bit code to 64-bit, removed anything dependent on the doomed Carbon and QuickTime, replaced the NeoAccess database, and eliminated most of the old PowerPlant framework.

Last September we gave up on subcontractors, and started GUI programming in-house. For that we use the Cocoa and MFC frameworks for Mac & Windows, respectively. However, we probably still spend half our time refactoring the existing code.

Refactoring is a lot like remodeling an old house. Some things we tear out and replace. Some, we scrape off the crud and leave them. Our rule of thumb for refactoring was expressed very clearly this week in The Daily WTF: “Thinking is hard, and I’m not very good at it. Every block of code should be simple and obvious, because if it makes me think, I’ll probably screw it up and break something.”

This week we are replacing the PowerPlant array classes. The analogy for that is more like tearing out the main beams, because they are used everywhere. We wrote a replacement more than a year ago, and have used it in new code long enough that it’s well-tested.  Now it’s time to shift over entirely.

Refactoring is also a chance to make design changes. The maximum array length is currently a 32-bit number (4 billion max) but we probably will make it 64-bit (9 quintillion).  Nobody will ever need the extra space, but it may help us stay compatible with future CPUs.

Meanwhile, we’ve finished about half of of the Mac data entry interface. It now allows a main window and/or separate windows, and shows almost all of the fields.  The only hard things left are the tables, used in itemized estimates etc. One is starting to work, and we’re gaining on the others.  Best guess is a few more weeks until we release an ‘alpha’ version for folks to try out.

Dennis Kolva
Programming Director

Author: Dennis Kolva

Programming Director for Turtle Creek Software. Design & planning of accounting and estimating software.