Adages II: The Adagening [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2014-07-30 09:30
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.

[xpost |http://simont.livejournal.com/240257.html]

LinkReply
[personal profile] kaberettWed 2014-07-30 11:21

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. :-)

Link Reply to this | Thread
[personal profile] simontWed 2014-07-30 11:46

. o O ( you teach your freshers not to stand around in the kitchen getting in the way?! ;-) )

Link Reply to this | Parent | Thread
[personal profile] kaberettWed 2014-07-30 11:48

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 ;)

Link Reply to this | Parent
[personal profile] sunflowerinrainWed 2014-07-30 20:16

Excellent!

Link Reply to this
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 09:10

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" :)

Link Reply to this | Thread
[personal profile] simontWed 2014-07-30 09:12

"His ambitious plans to use his discovery to send messages, involving the careful rearranging of a small kitchen in order to modulate the signal, were never fully expounded because, at that point, the bar closed."

Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 09:18

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 :)

Link Reply to this | Parent
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 09:11

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? :)

Link Reply to this | Thread
[identity profile] pseudomonas.livejournal.comWed 2014-07-30 11:45

WARNING THIS BOOK CAN SERIOUSLY DAMAGE YOUR HEALTH AND THE HEALTH OF THOSE AROUND YOU.

Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 12:41

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"... :)

Link Reply to this | Parent | Thread
[identity profile] hilarityallen.livejournal.comWed 2014-07-30 16:31

A parametric analysis of applied multi-dimensional entity theories.

Link Reply to this | Parent | Thread
[identity profile] hilarityallen.livejournal.comWed 2014-07-30 16:32

: A discussion of engineering principles, verification methods, cost analysis and control flow mechanisms.

----
That should do it.

Link Reply to this | Parent
[identity profile] hilarityallen.livejournal.comWed 2014-07-30 16:30

WARNING: DO NOT READ THIS BOOK WITH REMAINING BRAIN.

Link Reply to this | Parent
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 09:12

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! :)

Link Reply to this
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 09:16

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.

Link Reply to this | Thread
[personal profile] simontWed 2014-07-30 09:26

Yes. I think git commit -a (another classic example of a "work sensibly" option that you nearly always want to add) is a good example of both your reasons – it made sense when the git UI was intended to be used by porcelains rather than people, and also one could argue that power users are more likely to take advantage of the ability to not commit everything in one go.

(Though, on the other hand, I am enough of a git power user to constantly take advantage of partial committing, and even I still find I nearly always have to remember to add -a – to the point that on the occasions I don't want to commit everything, I still find my fingers have reflexively added the -a and then I wonder what went wrong...)

Link Reply to this | Parent | Thread
[personal profile] fanfWed 2014-07-30 09:29

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.

Link Reply to this | Parent | Thread
[personal profile] simontWed 2014-07-30 10:45

Mmm. In fact I find myself thinking that since git commit -a modifies your index in a way that can wipe out carefully prepared stuff in it, you'd actually quite like it to have the side effect of leaving the prior index state somewhere easily recoverable, in cases where the index was modified.

Perhaps a handy approach would be for it to generate a second commit consisting of exactly what it would have done if you hadn't said -a, and pointed an ephemeral ref at it similar to FETCH_HEAD. Then you could trivially recover from an accidental -a by saying git reset NO_THE_OTHER_ONE, or some such.

Link Reply to this | Parent
[identity profile] deliberateblank.livejournal.comWed 2014-07-30 10:06

I have yet to find a way in which http://git-man-page-generator.lokaltog.net/ (and this (http://git-man-page-generator.lokaltog.net/#4cdbeecda0e1c6b21d841a6d7ca70d9f) is a particularly good one) differs significantly from reality.

Link Reply to this | Parent
[personal profile] pm215Wed 2014-07-30 10:50

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...

Link Reply to this | Parent
[identity profile] cartesiandaemon.livejournal.comWed 2014-07-30 11:12

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...

Link Reply to this | Parent
[identity profile] edge-walker.livejournal.comWed 2014-07-30 16:47

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…))))

Link Reply to this | Parent
[identity profile] alextfish.livejournal.comWed 2014-07-30 12:35

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.

Link Reply to this | Parent | Thread
[personal profile] simontWed 2014-07-30 12:47

Yes, that is a good example!

I don't know for sure why it's like that, but I'd have to suppose that it's some kind of a consequence of DOS's evolution from CP/M which had drive letters but not subdirectories. I bet it'll turn out something like: there was a big and important class of legacy CP/M programs that needed to be easy to port to DOS in order to make DOS sell, which expected to be able to keep opening A:THIS.DAT and B:THAT.DAT, and so if you wanted to actually take advantage of DOS's directory system to keep all the data for those programs somewhere other than the root of your drive(s) then you needed to be able to set a separate persistent cwd per drive before running the legacy program.

Though I suppose even that only explains the idea of having a persistent per-drive cwd and hence some method for adjusting the directory for drive A without also making that the current drive. It still doesn't explain the bizarre idea that the default behaviour of CD A:\THING ought to be to do that specialist operation...

Link Reply to this | Parent | Thread
[identity profile] edge-walker.livejournal.comWed 2014-07-30 17:37

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.)

Link Reply to this | Parent
[personal profile] andrewduckerWed 2014-07-30 18:25

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).

Link Reply to this | Parent
[identity profile] ptc24.livejournal.comWed 2014-07-30 17:32

Which reminds me of Dilbert and setting crimple, thip and spoit to "no".

Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comThu 2014-07-31 09:47

Oh yes! That was so true!

Link Reply to this | Parent
[personal profile] gerald_duckWed 2014-07-30 09:41

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.

Link Reply to this | Thread
[personal profile] simontWed 2014-07-30 09:44

I'm not really sure you're contradicting me – where did I say that if you constantly had to specify the 'work properly' option to find, something was necessarily wrong with find?

Link Reply to this | Parent | Thread
[personal profile] gerald_duckWed 2014-07-30 11:01

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

Link Reply to this | Parent | Thread
[personal profile] simontWed 2014-07-30 11:45

Well, I haven't exactly worked out all the details either, as I'm sure you know perfectly well.

But it seems to me that it ought not to be beyond the wit of humankind to devise a system whereby the list of filenames output by find does not need to be explicitly specified every single time as being in one or another particular serialised representation, when that selection could in principle be automatically inferred by knowing the consumer of the data. Programming languages, for example, have a range of perfectly good mechanisms whereby you can return one type and also provide a default conversion to one or more other types for clients who would have preferred those, and then you don't have to write the conversions out longhand at every call site.

Link Reply to this | Parent | Thread
[personal profile] gerald_duckWed 2014-07-30 15:56

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!

Link Reply to this | Parent
[identity profile] ptc24.livejournal.comSat 2014-08-02 09:58

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"

Link Reply to this
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]