Pylimitics

Simplicity rearranged

unmonetizable content since 1997


Back to the future

I was recently struggling with Yet Another bloated, unwieldy commercial application when I suddenly remembered the Unix “philosophy.” It’s been codified lots of times, but maybe most succinctly by Peter Salus:
– Write programs that do one thing and do it well.
– Write programs to work together.
– Write programs to handle text streams, because that is a universal interface.

I certainly have the tools to do that; I’ve just gotten out of the habit of creating my own software. I write daily (ish) journal entries, and while I use a text editor to do it, I have to add a date stamp myself, and since I use the same editor to do other things, I have to point it at a different directory to save my journal entries where I want. So I thought I’d make a little journal editor. My first thought, since I use Macs almost exclusively, was to write it in Xcode, which makes something like a text editor quite simple. But as I discovered, Xcode is designed for developers creating “Mac software.” It automatically added a set of menu items and functions well beyond what I really wanted. And the code was instantly bloated — not badly, but it had empty functions sitting there because the templates assume you (the developer) will want to use them. But I didn’t; this editor is just for me, so I’m never going to need a Help menu. And for that matter, I don’t need a formatting menu or a way to view multiple windows, because I don’t want multiple windows.

It turns out that building a text editor is easy in Xcode, but to build the text editor I wanted — just a very personal tool for one specific purpose — it gets much harder.

I switched to Python, mostly because I’m already familiar with it, and I’m not up to speed on Swift, even though it’s not that difficult and Xcode even has an AI assistant (sort of) built in. I mean, at least it’s not C++, which I’d classify as “difficult.”

Python programming becomes even easier when you find the right libraries, and the one best suited to building my little editor with a simple GUI (instead of running it in Terminal) is tkinter.

The whole thing only took a couple of hours, and now I have Jedit.py that opens one file, knows the directory I use for journal entries, knows when and where I want to insert a date stamp, and knows how to name my files. In a lot of ways it’s not a very capable editor; it really only edits one thing, and only for one person. But it’s kind of refreshing to have program that only does one thing, and does it well, can work with the system to store files in the cloud without “knowing” anything about the cloud, and although I haven’t any need (yet?) to use it in connection with other programs, it would be capable of, for example, adding a date stamped comment to other kinds of text files.

In the process I remembered that this approach can be easier than struggling with commercial applications designed to fit thousands of use cases and environments. You need some prerequisites, like being able to write Python code, but this is not core-developer-level coding; it’s more of a beginner- or intermediate-level exercise. Feels good, like the days even before I encountered Unix, when personal computers always came with some kind of programming system (usually a version of BASIC) and you’d just write your own software tools.



About Me

I’m Pete Harbeson, a writer located near Boston, Massachusetts. In addition to writing my own content, I’ve learned to translate for my loquacious and opinionated pup Chocolate Bossypaws. I shouldn’t be surprised, but she mostly speaks in doggerel. You can find her contributions tagged with Chocolatiana.

Check out my other blog, Techlimitics, where I’m grappling with the nature of simplicity.