Owing to some personal problems, it has been two weeks since Tozier and I even tried to work on the iPad program. Today, his wife is buying my Juke, and they’ll both be here a bit late, so it’s probably silly to imagine that we’ll do anything today. Well, since this is part of The Book of Erors, writing about things not working is part of it all.
Last time, T and I were trying to convert the program from its use of the
Dir class to use of
Pathname. We got into deep water and backed out. At that time, my thinking was this:
Anyway, next time I think we’ll try bottom up, if we do the
Pathnamething at all. We’ll find a method that accepts a file name as a string, and we’ll fix him to use a
Pathnameinternally. If he calls out, we’ll leave him calling with a string, not a
Pathname. Once he’s converted to
Pathnamethroughout (and this should be “easy” since our methods are short), we can change his callers to send him a
Pathname, which is, roughly,
string_file_name.to_path. Then we’ll change the callers, one at a time, to use
Pathnameinternally. Rinse, repeat. This “should” be straightforward.
Now the thing is this. Our actual draining the swamp mission is to add a collection of file names and dates, containing the names of all the files whose date is newer than some given date, which will be the date we last built and published the site. While our overall design would be more clean if we do this conversion to
Pathname, it’s not really standing in our way.
We’re torn between two notions. First, we believe that we should always keep the code squeaky clean because grubby code slows us down. But second, we believe that once the code is a bit grubby, we follow the “Boy Scout Rule” of leaving the campground a bit cleaner than we found it. The trick with that is that we clean what we find to be dirty as we do our work, so that the areas that affect us get better and the areas that don’t affect us get left alone until we visit them.
Tozier and I have sort of fallen in love with a “better” design. We imagine that a design around
Pathname would be better than what we have. And we’ve done a few little experiments, which give us a pretty good reason to believe we’re right. So … suppose we’re right. Suppose using
Pathname would in fact be better. So what? It’s not hurting us right now. Our artistic sense tells us to fix it “because it would be better”. But it’s not in the way of our progress right now.
So I’m calling it. When we next get to work, probably next week, we’ll build our “manifest” of files and dates. Maybe we’ll use
Pathname in there, although maybe just a list of strings and dates would be fine as well. I suspect
Pathname is better, because we can ask it for folder strings and basenames and such, and it handles the string manipulation inside. But either way, we build the manifest and plug it in. If we find ourselves passing through the campground that now relies on
FTP classes, and it looks like
Pathname would help us, we’ll see about converting.
If not, then not.