simont: (Default)
simont ([personal profile] simont) wrote2014-07-30 09:30 am

Adages II: The Adagening

Since I made my adages post last year, I've had a few afterthoughts, so here's a second instalment of things I seem to find myself saying a lot.

I'll start with a more or less frivolous one, which I tend to think of as the Law of the Kitchen: in a kitchen there's nowhere safe to stand, or perhaps no matter where you stand in a kitchen, you're in someone's way. This applies in any kitchen that more than one person is trying to use; no matter how spacious it appears, the one place you pick to try to stay out of the way is inevitably going to turn out to be right in front of the cupboard somebody needs. An office building I used to work in had an absurdly large kitchen, and I still saw this happen all the time. The only way to avoid it is to be alone in the kitchen, and sometimes I think even that doesn't work reliably.

There's a sentence that I always wish I'd put into my old article ‘How to Report Bugs Effectively’, because it makes a nice one-line summary of a lot of it. (Sadly, it's too late, now that it's been translated into so many languages.) The sentence is: Don't just tell me what didn't happen; tell me what did! (For all those times when someone just says it doesn't work, or won't print, or can't save, and doesn't also tell you the vital diagnostic details in the error message that appeared when they tried.)

Also on the theme of computer (and other) troubleshooting, a phrase I shamelessly pillaged from Yes, Minister and adapted slightly to make it work in a totally different context: if you don't tell me exactly what you're doing, I can't tell you which bit you're doing wrong. I often find myself saying that to people who email me asking for detailed advice without giving enough details of their own, and it usually seems to get the message through.

A user-interface principle I keep coming back to is: it's OK to file things in more than one category. In any context where things get filed in categories at all (GUI configuration panels, drop-down menu bars, mail folders, good old-fashioned catalogues and indexes in print), it can be a real pain for users (by which I mostly mean me, with my user rather than developer hat on) to have to try to guess which of the plausible categories a thing might be filed under. I often think people overestimate the cost of just duplicating the thing in both places (especially when that can be done by linking rather than bulk-copying); then, whichever one I look in, I'll be right!

Continuing the topic of user-interface design, after my previous adages post I said a thing in the comments which I then realised was itself a thing I've said on other occasions too: if you always have to remember to specify the ‘work properly’ option, something is wrong with the design. (My usual example is find -print0 | xargs -0.)

If you're trying to persuade people to do one thing rather than another, a thing I've come back to a few times now is that it's better to make the right choice easier, not the wrong choice harder. (Because either action provides an incentive to switch over, but one of them also makes people's lives better whereas the other makes them worse, so it will make a big difference to how annoyed with you they are afterwards.)

An argument I've used a few times to persuade people to actually bother to start backing up their electronic data is to point out that backups are a kind of housework. They actually are, if you think about it: things like hoovering and bathroom-cleaning are tedious and don't come with a great deal of obvious reward at the time you do them, so it's always tempting to occasionally not bother or to simply forget or to accidentally get out of the habit of doing them regularly, but if you never do them then sooner or later something goes badly wrong. Backups are similar on all counts, and also if there's a particular time of week when you do all your other housework, including your backups in that routine is a good way not to forget about them; so whenever I come across someone who doesn't do backups but does do hoovering, I try this as a way of persuading them to start. (It worked particularly well on my mum, who drilled into me the need to actually bother to do housework, so she couldn't really argue when I returned the favour!) If I had children, I'd teach them this.

As before, of course, none of these should be taken as a universal truth or applicable in all circumstances, and all of them have their implicit ifs and buts and unlesses and exceptions. Caveat lector.

kaberett: a patch of sunlight on the carpet, shaped like a slightly wonky heart (light hearted)

[personal profile] kaberett 2014-07-30 11:21 am (UTC)(link)
I am smiling over how many of these I recognise. Also how many of them I've used in teaching my freshers as a direct result of spending time with you. :-)
kaberett: Overlaid Mars & Venus symbols, with Swiss Army knife tools at other positions around the central circle. (Default)

[personal profile] kaberett 2014-07-30 11:48 am (UTC)(link)
Actually I mostly avoid awkwardly making eye contact with them when we're both hanging around in front of the condoms in Boots, but that's another story ;)
sunflowerinrain: Singing at the National Railway Museum (Default)

[personal profile] sunflowerinrain 2014-07-30 08:16 pm (UTC)(link)

[identity profile] 2014-07-30 09:10 am (UTC)(link)
And I guess I'll reflexively make my traditional adage-response of pouncing on the first thing on the list and saying "Wherever you stand in the kitchen, it'll always be where someone needs to be next, I bet you could make some sort of interstellar FTL communication device out of that" :)

[identity profile] 2014-07-30 09:18 am (UTC)(link)
Fictional blowhards always seem curiously resistant to shouting loudly at each other in the middle of the street, neither willing to go home without being sure the other understands their new theory: in real life, I haven't found "the bar closing" such a sure-fire conversation ender. Maybe I just know unusually stubborn people :)

[identity profile] 2014-07-30 09:11 am (UTC)(link)
Caveat lector.

Although, if we put "caveat lector" on any advice you should make sure you understand before blindly following (ie. basically everything in the world), what warning do we put on the necronomicon? :)

[identity profile] 2014-07-30 11:45 am (UTC)(link)

[identity profile] 2014-07-30 12:41 pm (UTC)(link)
Or, come to think of it, if you don't want someone to read the book maybe it should say "Health and Safety Manual" or "How to Get Things Done in a Timely Fashion"... :)

[identity profile] 2014-07-30 04:31 pm (UTC)(link)
A parametric analysis of applied multi-dimensional entity theories.

[identity profile] 2014-07-30 04:32 pm (UTC)(link)
: A discussion of engineering principles, verification methods, cost analysis and control flow mechanisms.

That should do it.

[identity profile] 2014-07-30 04:30 pm (UTC)(link)

[identity profile] 2014-07-30 09:12 am (UTC)(link)
backups are a kind of housework

Yes! Although it took you to point out that that was a reason to do them, not a reason not to do them! :)

[identity profile] 2014-07-30 09:16 am (UTC)(link)
if you always have to remember to specify the ‘work properly’ option, something is wrong with the design

Yes, I'm always so annoyed by this. I remember the photocopier in the Trinity library had a mode: automatically copy whatever you put in, the same size, on the same size paper. What I couldn't figure out is why that mode wasn't the default!

To be fair, this often happens when originally there was some reason to do it a way other than "work properly", or beginners and experts have opposite expectations for "work properly", and you get stuck with the wrong default. But yes, you should be able to make it better somehow.
fanf: (Default)

[personal profile] fanf 2014-07-30 09:29 am (UTC)(link)
I have configured a `git ci` alias and occasionally use it incorrectly in exactly the way you describe :-) Typical failure mode is: prepare partial commit, then type `git ci -m ...`, swear, and spend twice as long unpicking the error.

[identity profile] 2014-07-30 10:06 am (UTC)(link)
I have yet to find a way in which (and this ( is a particularly good one) differs significantly from reality.
pm215: (Default)

[personal profile] pm215 2014-07-30 10:50 am (UTC)(link)
I realised reading this that indeed I *never* use "git commit" (except for the special case of "git commit --amend" for tweaking commit messages after "git am" in one particular workflow), because pretty much all the time I use git via stgit...

[identity profile] 2014-07-30 11:12 am (UTC)(link)
I thought partial committing was great when I first saw it, a much better way for mortals to work, and only experts could make a change in the file system perfect first time and commit it in one go :)

But yes, git is full of things like that where a "do it right" option is added later and people differ in which one they use most commonly. And also yes, it's what your fingers normally type, not what the unadorned command is...

In fact, what I probably want actually is similar to "git commit -a", but shows the proposed changes without changing the index, and only proceeds if I hit return. I should script that...

[identity profile] 2014-07-30 04:47 pm (UTC)(link)

Hmm. I git commit without -a all the time – I would certainly find it more annoying to have to turn it off than I do having to turn it on. But then I always do a git diff as the first thing when I intend to commit, and I follow up with git commit -a only if the diff already is exactly what I want to commit, which often is not the case.

Generally I make commits once I know I have completed a logical step in the evolution of the code, which generally means I am some way into the next step or the one after or even the one after that one before I am certain. Sometimes this is because I’m not sure what the steps even will be before I start. With trivial steps it can happen that I know beforehand exactly what the step will be, and then I do it, and then (after checking the diff!) I can just commit it – in which case I use -a. With any slightly larger task, I often find myself not knowing how to narrate the overall change as a series of patches until after completing (some part of) it. And I never make “here’s how far I got” commits – an atrocious style, as far as I am concerned (which someone once described as using the VCS as a landfill). (Well I do git commit -mwip -a at the end of a day to record my progress. Always followed by a git reset HEAD^ next time I pick up the branch, though.)

The thing that’s so wonderful about Git in all this is how the index lets me decouple the boundaries of the hacking from the boundaries of the resulting commits. If -a were a “work sensibly” option, or even just the default, that would be a constant point of friction to me.

(This is rather different from the example with find | xargs, which no one ever wants to work like they do without the -print0 | -0 switches. (Obviously the problem is that at least find has other uses than being combined with xargs, for which -print0 is wrong. (Note that find has picked up an -exec variant where the command is terminated with a plus instead of a semicolon, for accumulating multiple arguments into a single invocation. So find subsumes the core functionality of xargs, and that issue goes away… at the cost of do-one-thing-well purity. (I assume you are well aware of this – but just in case…))))

[identity profile] 2014-07-30 12:35 pm (UTC)(link)
I think the canonical example of a "work properly" option that you always supply is in the Windows command line cd command, the "/D" option.

You technically don't always need to supply it, because "cd newdir" or even "cd ..\..\path\to\newdir" work. But for some unknown reason, the command line keeps a "cd" for each drive. And so "cd S:\temp" will not change your current directory to S:\temp; it'll just mean that the next time you go "S:", your current directory will be S:\temp.

"cd /D S:\temp", on the other hand, actually changes your current directory.

Why /D isn't the default... I can vaguely picture some trains of thought that could have led to the design, but they're all abysmal and it should never have been let out like that.

[identity profile] 2014-07-30 05:37 pm (UTC)(link)

Back when you’d routinely use multiple floppies to keep all the files you were working on, it was not at all a specialist operation. It was pretty nice to be able to COPY A:*.* C: and have it do what you wanted because each drive had a separate working directory, without having to type so much – a bit like a two-pane file manager, without the file manager. (Remember that DOSKEY.EXE was a late addition; COMMAND.COM by itself had no command history for most of DOS standalone life, so being able to set lots of implicit state at the command line was… vital, almost. And tab completion was an even later addition, not to happen before far into the CMD.EXE era.)

Note that there were several other design aspects. Because DOS itself was single-tasked, there was not a strong separation of process state, and working directories were one of these things: if you invoked a program that changed directories, upon return to the command line, you would still be in that directory – working directories were effectively only per-drive, not (at all) per-process. Along these lines, CD A:\THING not putting you on A: was quite useful, especially to batch files, which did not need to then restore the previous drive if they did not want to touch it, which was actually unreasonably hard (whereas explicitly setting it, if that was desired, was trivial).

Note also that almost all of the commands in DOS initially had no switches, and those that did, very few. Sometimes operations that you might argue to be a variation on the behaviour of existing commands were added as a separate commands, e.g. DELTREE, rather than through switches. It was all quite spartan.

To be clear, I don’t know why CD was designed this way; what I mean to say is that, as a user at the time, it seemed so obvious and sensical to me within the context of all the system’s other design choices, that I actually missed this when I first started using Unix.

(I did not understand most of this until far later, after exposure to other designs.)

Edited 2014-07-30 17:54 (UTC)
andrewducker: (Default)

[personal profile] andrewducker 2014-07-30 06:25 pm (UTC)(link)
Of course, it works the right way in Powershell, where CD takes you directly to any location (including network drives, lists of variables, and the registry).

[identity profile] 2014-07-30 05:32 pm (UTC)(link)
Which reminds me of Dilbert and setting crimple, thip and spoit to "no".

[identity profile] 2014-07-31 09:47 am (UTC)(link)
Oh yes! That was so true!
gerald_duck: (Oh really?)

[personal profile] gerald_duck 2014-07-30 09:41 am (UTC)(link)
I'd agree with everything… except your example of a wrong-defaults command.

While, sure, I'll often do find -print0 | xargs -0 I'll just as frequently be piping a file into xargs, or viewing find's output on-screen. If you want things to Just Work, I fear many other common Unix utilities would have to be re-vamped to work on files with entries delimited by nulls rather than newlines — things like less, sed, etc.

Either that, or make xargs line-oriented by default and prohibit newlines in filenames.

Realistically, I think the best one could hope for, rather than it just working, is an easier way to spell that. My preference would be a -xargs option to find.
gerald_duck: (Duckula)

[personal profile] gerald_duck 2014-07-30 11:01 am (UTC)(link)
Well, a command where one always ends up some specific optionis, I agree, a command that should have better defaults. But both find and xargs, I sometimes use with those options, sometimes without. So I'm not sure what you feel should be improved about the situation, or how.

The reductio ad absurdam would be for the shell to have just one command: dwim (-8
gerald_duck: (warning)

[personal profile] gerald_duck 2014-07-30 03:56 pm (UTC)(link)
If there's a movement to have Unix commands output some form of structured data instead of a raw octet stream that is in many cases assumed to be textual, I just bet people would choose either MIME or XML.

I think I'd rather keep typing -print0 and -0 than take the risk!

[identity profile] 2014-08-02 09:58 am (UTC)(link)
I'm sure I've made this pun before, but if you keep getting more of these adages, you'll need some automated system to process them. I suggest calling it "AdageIO"