by craigkerstiens · 8y ago · 0 comments
Yes, it's great to learn Ctrl + D.
But losing out on beginners that aren't familiar in favor of things that are naturally intuitive is a great way to make those who are new to programming and especially databases feel like they're dumb or not capable of it. I still recall the first time I was in vi and I couldn't figure out how to get out of the damn thing, and don't get me started on arrow keys. There are a lot of ways to help others learn things like Ctrl + D, an even better experience might be a 1 second delay with a message informing them of other ways.
We could bikeshed all day on which is the more pristine way to exit a program, paint the shed whatever color you want, being intuitive for beginners is never a bad thing.
Let's look at a typical novice's session with the mighty ed:
golem$ ed
?
help
?
?
?
quit
?
exit
?
bye
?
hello?
?
eat flaming death
?
^C
?
^C
?
^D
?
---Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity.
Yet for me, ctrl-d is my usual first way of trying to exit any shell or cli utility.
Whether it's natural or not, I couldn't say. Arguably the nipple is the first and only intuitive interface, everything after that is learned. After many years on my/maria I find the backslash shortcuts very counterintuitive to 'show databases | tables' etc.
While I think it's great to have both options present, I don't think the demographic of people who work out they want an rdbms, evaluate and select postgresql, work out how to install server and client components, su to the postgres user, and are then likely to abandon in frustration as they can't determine how to exit the cli, is negligible.
Today though many more are coming to development without an academic or linux background. If you install Postgres via Postgres.app there is a chance you're not at all familiar with a commandline. What is intuitive... yes it's relative to your background. I very much hope that the number quit or exit is intuitive for, those that don't come from a linux or academic background, grows of time. This does become a more valuable tool the more beginners there are, and personally from working with a lot of beginners already suspect it's more valuable than many realize.
That's pretty much the summary of my post.
> If you install Postgres via Postgres.app ...
I had to go lookup what postgres.app actually is -- evidently it's an easy way for Mac users to install postgres.
I don't have a Mac -- which is also true for most people -- so I can't speak to the average mac user's experience or expectations.
As I have (had to repeatedly) say a few times now, I think it's great that multiple options to end the program are available.
I'd imagine for Mac users the 'most intuitive' thing would be to find some magic symbol on their keyboard and combine it with the letter Q.
Not complaining about its presence, as per my comment :
"While I think it's great to have both options present,..."
Just observing that claims of 'more intuitive' interfaces are very subjective, and that it was unlikely to be a deal breaker for a new user.
Surely it is when you detect the angry mashing of keys?
There should really be a function for that in the standard library. Distinguishing such inputs from the actions of cats would be the difficult bit.
I disagree with you here, Craig. In my experience I reach for Ctrl + D, Ctrl + C in quick succession to see what succeeds. I've learnt those and it works for most programs that don't trap exits (again, why would you trap exit?). It has saved me from learning how to exit interactive terminals for python, ruby, node, PostgreSQL (psql) without learning their specific instruction. I like that and I'd prefer to have one way of exiting programs that works on all programs on the system than learn what's any programs preferred command.
flush buffers, gracefully close sockets, print the final \LF to the stdout.
I bet you love Vim ;-P
> things that are naturally intuitive
Pick one