Sacred Potato Productions

Home      Blog      Chuck & Bernie      Music      Info       RSS
spp > blog > whattamess
< Back to homepage Archive Depressing adventures in generative AI >

Programming annoyances

Published Thursday, November 14, 2024 at 11:27am

I've been programming in one capacity or another since my family got a TI-99/4A in the '80s. I did go to school for programming, but most of my actual learning has been the trial-and-error process of looking at other people's code and modifying it. I think a lot of people do that and if you're exposed to the right materials it can be a very good way to learn to program.

Exposing yourself to the right learning materials was easier, I think, back when we were all learning BASIC out of an intruction manual provided with the computer. From personal experience I know that Texas Instruments, Apple, and Commodore (others too, probably) all provided exceptionally good literature—thick, spiral-bound books with well-written, comprehensive lessons—that would teach you how to use your computer. And if you happened (like I did) to be more interested in studying and modifying the listings than reading thise chapters, then you at least had ideal code to work from. On top of that, the library had multitudes of books of BASIC listings that would take you beyond the essential elements and show you how to put them together into games or useful tools.

There is a part of me that really misses the philosophy behind early computer culture. People accomplish much more with modern, user-friendly technology, but that user-friendliness wasn't possible for the first two or three decades of consumer-grade computers. You actually had to learn things to get any value out of a computer, and doing that empowered you to design bespoke software for your own needs. There was a certain amount of elitism in that, for better or worse, because most people simply didn't have the patience to bury themselves in manuals, or the need to design software tools of any kind.

But I'm losing track of the point of this post.

As mentioned in the past, this website is put together by a shell script which adds HTML tags and other connective tissue to a big pile of text files. It's insanely complicated, at least, by the standards of my own code. It wasn't supposed to be like that; my original plan was extremely simple, and that simplicity suggested to me that the program should be a short Bash script. One thing led to another and I started realizing that if I was doing X, then I could piggyback off that function to calculate Y, which in turn could be used to calculate Z... Long story short, a 20-line script ballooned to 300 lines within a week, and 6,000 lines within a couple of months. It does a lot of different things, and the scope of this project would have scared me off if I'd seen the big picture at the beginning because it would have seemed such a daunting task. Part of me wishes I'd chosen a different language more suited to designing a full-blown application, but most of me appreciates that Linux has extremely versatile built-in commands that probably keep the length of my program down very significantly.

The problem is that I wasn't very experienced at Bash scripting when I started, and though I got a lot of very good advice from places like Stack Exchange, most of the program was written under the assumption that skills I learned in the Windows and pre-Windows world would transfer perfectly, as they had in the past. Not so. Bash has many built-in file-management functions that don't exist in other languages, and I reinvented dozens of wheels before I became aware of that. Every few months I get ambitious about fixing the program (which is called Gustave, by the way, after the character in The Grand Budpest Hotel). I know it would shave at least a couple of hundred lines off the code and make it run faster, but... I never get anywhere with it. Every little piece of the code is tied to multiple functions, and I'd have to write more code to mitigate the effects of fixing any of it. You're not supposed to do that, by the way; this isn't what programmers call "spaghetti", but it's far from being optimally object oriented. Thoughts of scrapping it and rewriting from the ground up (a seriously good idea) are answered with even more pessimism because doing so would be a major undertaking which feels unnecessary when the code currently works. I envy people whose nightmares have them naked in front of a crowd; in mine I've uploaded Gustave to Github.

So what do I do? I think I finally understand the sentiment "if it ain't broke, don't fix it." Gustave is deeply broken in ways that I'm afraid to talk about (even on a blog that nobody reads), but it does what it's supposed to and is unlikely to come tumbling down so... I guess I'm stuck with it.

< Back to homepage Archive Depressing adventures in generative AI >


Creative Commons License

This page available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Some rights reserved, .