Checklists, Vue, Typescript and Object Oriented JavaScript

Oy, that title was a mouthful. In the last few days I have continued working on porting my checklist app (Check) to an Electron-based desktop version. It’s a paradigm shift for me because as a web developer I don’t usually have to interact with the file system. One of the first things I decided on is that in a desktop app, people would want to be able to save their checklist data to anyplace they prefer, and maybe have more than one. That is: they want the basic File Open, File Save, and File Save as… structure.

That increases complexity dramatically. I have to make sure the file they want to open contains valid data, and if it doesn’t I have to throw some appropriate alert. Obviously, this is the kind of problem that every desktop app programmer has had to solve, so I’m sure there are existing libraries for handling this in the Electron ecosystem. But even if I use a library, I have to hand-write the verification function for my data. I mean: nobody else knows what my data is supposed to look like.

Which brings me to classes. I have rarely if ever needed to make use of the new JavaScript classes. (They are relatively new anyway, compared with how long I’ve been doing JavaScript.) Let me say this a different way. The class syntax is relatively new, but the idea of writing object oriented JavaScript has been around for about as long as JavaScript. I have written in that style sometimes, but not a lot and not recently. In most cases I find object oriented style far too verbose. But I’ll grant that it is useful for handling growing complexity.

That said, the added complexity of needing to verify data structures from a text file lead me to writing classes. And if I’m going to write classes and enforce types, then I may as well use Typescript.

Oh, and I like Vue, so I was already using Vue from the beginning.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s