Software Maintenance
I briefly mentioned it as a possibility in my last post, but I ported ptf & x1804 from their own older copies to the reusable packages in scatcdsk_lib. This also exposed a few further areas for improvement.
Firstly, using Alire for my own software works very well. For the changes described below, the automated tests that I previously added really paid for themselves (adapted from manual tests in the original packages).
There were a few non-trivial code changes that I had to make:
- The command line processor ("getopt"-like) package was simplified. So we need to track the last arg as output file ourselves.
- Another simplification is that the text I/O packages are now generic, and only support one file. So for the few cases where we need >1 open at once, I fall back to Ada.Text_IO
- It's worth a separate bullet, one such simplification was that scatcdsk's Get_Line is now a function returning a String. I originally tried to use Ada.Strings.Dynamic more extensively to cope with this change, but this was a bad idea. It's ok if youre just storing a string, but these were text processing programs that did lots of processing, access as arrays, etc. So I left this old code alone as much as possible and rely on Ada's support for indefinite size types, e.g. as parameters.
- Some features from new versions of the standard help, like Ada.Characters.Handling
Overall, these older Ada systems are very maintainable, as you might expect given that it was an explicit language design objective. I am conscious that I haven't been updating the documentation alongside the code, but am unlikely to do so for non-commercial personal research.
A large motivation for all this was to brush up my Ada skills from a college course so that I could write some new code more interesting to me without shooting myself in the foot. In retrospect, I think this was a good idea, it revives some useful old systems instead of writing toy programs with no real applicability.