Export-Driven Development
So I made an app.
I have an egregious amount of 2000s-era PC games that are begging to be catalogued, having fallen head-first into a nostalgia for bygone times. Being a particular sort I didn't want to use just a spreadsheet for this as I very much wanted the experience of scrolling through a grid of cover images to bask in the glory of my indulgence. Now, I am aware that there are a lot of websites out there that will let you catalogue your game collection, but for a myriad of reasons none of them fit my specific needs and of course if I built my own it would give me the opportunity to ~ make something ~. The particulars of why I built the app the way I did can be saved for another time, but what I want to focus on is my philosophy behind its export function.
This app is a personal side-project, and like most personal side-projects its life span is tied up to the intrinsic motivation I have to work on it. I'm making something for myself partially because it would be useful to me, but also because I'm a fucking nerd who thinks programming is fun ♥ All of the side-projects I've worked on the past have followed the same cycle of first being an obsession that I'm distractingly eager to work on, to becoming a bit of a slog when I uncover how much work is actually needed, and finally ending up as either abandoned completely or something that pretty much does what I want it to but has a few bugs or improvements that I never get around to working on.
Being aware of this cycle, and the waning and unpredictable nature of my own motivations, I approached this new project with the understanding that one day it will no longer work. Either through the slow attrition of OS updates I have no interest in keeping up with, or by becoming less-than-useful as a result of the gradual shifting of my fickle needs, its days are numbered from the moment I write the first line of code. However, I didn't want to couple the reason I wanted it to exist with my ability to keep it alive. This app was meant to catalogue my game collection and—barring the potential future where I choose to get rid of it—I would most likely still want to know what games I have and what condition they are in, even if I wasn't interested in maintaining the app.
So to ensure that the lifetime of the data isn't tied up to the lifetime of the app itself I opted for something I like to call "export-driven development". Despite the pithy phrasing it just boils down to ensuring that at all times I can export the relevant data to a text-based format whose structure is completely divorced from the particulars of the platform I'm developing for. In this case I was building a macOS app using SwiftData (whose inner workings are a deep and unfathomable mystery to me), but at any point I could get it to spit out a CSV file that I could read and modify with my regular human brain. This way, the data I've fed into the app is not trapped inside a cage of my own making.
One unrelated bonus to this approach was that it made it a lot easier to determine the data model when I was first starting out. I created a mock spreadsheet containing the columns I would want to have in a theoretical export and used that as a template to base my SwiftData models on. Then as I built out the app I just made sure that the export would create a similar document, refining what it would contain as I discovered what was or wasn't useful.
Another benefit was that building the app around an export functionality was that I could just as easily import data as long as it followed the same format. Before I built this app I had kept track of my collection in the MobyGames website and it was trivial to export my collection from there, massage the data to fit the structure my app needed, and import over 50 entries without having to type it all in manually. Since then my collection has more than quadrupled in size, and the experience of browsing through it with an app of my own making is quite satifsying.
I can't speak for my fellow nerds, but a lot of my side-projects revolve around managing or displaying data about my life, usually filling in the gaps in existing tools and catering to my very particular tastes. But building something myself, without the backing of a team or any monetary motivation to help me when the enthusiasm wanes, comes with the danger of having this data be trapped inside the projects. Either I abandon the data along with the project or I are beholden to maintaining something that isn't fun to work on. So to save future me from this heartache I have wholeheartedly embraced export-driven development, because no matter what programming language or operating system I end up using a decade from now, I know that I can at least read a damn CSV.