DEV Community

Discussion on: What are the best tools/concepts to shoot yourself in the foot again and again?

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

How to quit a program in Unix?

vim has become a meme for being harder to quit than smoking or alcohol

Google

but is it really fair though?

Here is how you can quit vim

:quit
Save changes to "/private/tmp/hello.txt"?
[Y]es, (N)o, (C)ancel:
Enter fullscreen mode Exit fullscreen mode
  • the : part opens a command palette much like in visual studio code or IntelliJ
  • quit seems like... utterly reasonable.
  • then the user may have unsaved change, what's the right thing to do? That's ...asking to save, discard or cancel. Utterly reasonable as well.

So what's the big deal?

One issue is code golf : developers striving to advertize the shortest possible solution that solves a particular problem (quitting without saving). So they will tell you to use :q! . Code golf is bad. Strives for clarity, not for shortness.

But the true issue is UNIX's masterfully simple yet evil decision to let each program decides what it feels is the best way to quit for himself.

That seems high minded. Aren't app developers adults?

Adults don't approach decision making this way. Instead, to evaluate whether a decision is good, they look at and only care about one thing: the effects of that particular decision has in the real world:

Here the decision forces the user to recommeber:

  • want to quit vim? that's :q! for ya'
  • want to quit nano? That's ^X N. Supposedly much easier?
  • want to quit man? that's q. Shorter than vim, code golf win!
  • want to quit emacs? That's C-x C-c
  • want to quit python? That's >>> quit()
  • want to quit node? That's .exit
  • want to quit perl ? That's ^c
  • want to quit telnet? That's ^]. For some reason?
  • want to quit a ssh session? That's exit
  • want to quit echo <<HERE ? That's HERE
  • want to quit a java program? That's sometimes killall java
  • want to quit something with kill? often programs will choose themselves how to interpret your signals, very nice and handy

I am sure I forget some, but it's enough I think to see the masterfully evil decision UNIX made.

The evil decision being to not take any decision.

Which is also a decision.

And often a very bad one.

image

Collapse
 
qainsights profile image
NaveenKumar Namachivayam ⚑

How to quit ed? That's q :)