Versions (Feb 4)

Our staff made several big changes to the guts of our code recently. Layouts, text and money all have new formats. There’s a good reason for doing it now.

Goldenseal has been out for more than 20 years. During that time it evolved. More features, bug fixes, safer programming. Often, that meant changing the data that’s stored for each record.

To handle that, every record has a version number. It started at 1, and is now up to 9 for a few classes. When Goldenseal reads a record from storage, it checks the version number so it can read the proper amount of data. When it saves changes, it updates to the latest version. For both reads and writes, the code double-checks the size of the data. It needs to be exact, otherwise it may overlap neighboring data in RAM or on the drive. That is really bad news.

The code has branches to handle all possible versions. It has grown complicated.

When TurtleSoft Pro opens an existing Goldenseal file, it saves everything over to a new file, with a new database format. From then on, you use the new file and leave the old one behind. In TurtleSoft Pro, everything has the same version (at least for a while). We’re starting over at 10.

This project is pretty much a software gut-rehab. We might as well upgrade the foundation and framing while everything else is being redone. This is a once-in-decades opportunity to make big changes.

After increasing the size of CMoney, we had to look at the code for every data class. Some had comments about things to add in the next big update, so we added them. We also found and fixed a few subtle bugs. Nothing dangerous, but things that might make the database less reliable. The complicated branching for versions made it easy to screw up.

For now, TurtleSoft Pro still must keep support for old versions. It needs to translate Goldenseal files, which may have a mix of everything from 1 to 9. However, in a few years we can remove the converter. Also, lots of old code to support it. Less clutter means fewer headaches, and fewer mistakes. The change won’t be a problem for late adopters, since we can keep an older app handy for the conversion. It’ll just become a two-step process.

One thing we added this week is a text field to store a file path for pictures or other files. Actually, two of them, in every class.

Right now, Goldenseal uses ID numbers for fonts, pictures, and resources. TurtleSoft Pro will use font names and file paths for them, instead. It’s part of an overall trend in computer programming: text instead of binary data. That’s a topic for the next post.

Dennis Kolva
Programming Director
TurtleSoft.com

Author: Dennis Kolva

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