Hacker News new | ask | show | jobs
by lucb1e 1149 days ago
Yeah that's basically it, so thanks for mentioning abbreviations! I knew they had some aliases (e.g. ls, curl) but not that it was commonplace because any powershell tutorial uses the long form and capitalizes everything (indeed I don't interact with PS a lot). It all feels very design-by-committee. Not sure whether it's a good thing that guides never use the short form: long more readable, but the specific choices of words give me weird vibes and run off blog-width line lengths. OP shows that nicely with the bash version fitting on ~60% of the line (on my screen) but the PS version running out of the line.

A lot has been written about naming things and brevity versus clarity, and while I sit very firmly on the programmer's side as opposed to the math people side (single letter variable names, in weird fonts or languages if they (surprise!) run out of available letters), I think I am more of a bash person than a java person in terms of naming things. Word-ish commands like pushd, kill, read, etc. (taking some bash built-ins here as examples, rather than external programs which may be named arbitrarily) seem a lot nicer to me than either very long commands or acronyms where you basically still have to know the long form to remember it. I'd never have guessed that spps stands for stop-process yet that's the portable powershell form of 'kill' (just looked that one up).

4 comments

I think this kinda shows the issue, and why I personally prefer ps (as someone who's bounced off bash and NEVER gotten the time to get decent at it, and who rarely needs to use any of these and never at any serious level, so massive grain of salt).

Kill is intuitive to you because you've probably been around tech your whole life, and tech has just used "kill" ever since. It's essentially as ubiquitous as "bug".

That said, if I had to teach someone brand new with next to no skills (the endless goal of making coding easier for the average person and so on), Stop-Process is a hell of a lot easier to teach, or rather, it's much easier to teach them to help themselves.

Since it follows the same naming template as every other powershell command, if you teach them how to use the basic commands like Get-Help/Get-Command, they're a hell of a lot more likely to figure it out themselves without needing assistance. You know that every cmdlet is verb-noun, and you know you're trying to stop a process, so something like

> Get-Command "*process*"

Gives you a short list that is extremely intuitive to figure out.

Now...for something as simple as "kill" you're not expecting a beginner to run a command with a wildcard search. You'll just tell them. But that entire philosophy is extremely helpful when you're in a situation where you do need to figure out the command and don't have the ability to just spend however many minutes on google, and if you teach PS right you get to a point where it's very easy to teach yourself.

Obviously how much this matters in a world of IDE's and search engines and now AI is questionable, but I think that if you redid bash today, it'd follow similar philosophies. Things like touch, grep, and arguably even echo really strike me as "favorites" just because of the inertia/ubiquity.

The convention is to use the short form whenever you are in a terminal for one-off commands, but go for the full name for script files that has to be maintained/read later — which is an absolutely sane policy in my opinion.

Bash is a write-only-full-of-bugs language, comparatively.

100% and I never thought of that before but I can see how you'd get that impression from tutorials.

The VSCode powershell extensions will also give you suggestion squigglies under all of your aliases in a saved script if they're not long-form, but I usually mix and match based on pragmatism.

My use of alias vs long-form usually comes down to two sort of situations:

* Ad-hoc at the shell: all aliases all the time (and make my own if I need to. welcome to my godless wasteland, population: me) * Shared scripts: Just like any code, do what's idiomatic for the team. Usually it's largely aliases with some long-form

In practice I'd say the formatting consistency situation on teams isn't nearly as bad as SQL but obviously not as good as Go.

For reference, I'm also a huge APL fan, so hit me with arcane symbols in my free-time all day long, but definitely pragmatic balance at work.

I also don't even think of them as acronyms personally. The acronym just sort of means the semantic action in my brain at this point, but I think that's mostly a fluency thing, and can't really speak to it being hurtful/helpful since I'm so removed from when I first started learning it

Regarding not thinking of them as acronyms: yeah I get that. I was wondering how to best phrase that sentence because, indeed, curl also does not stand for C Uniform Resource Locator in my head, or grep for global regular expression perl-style (if I'm remembering that one correctly). It's just curl and grep. However, whereas curl and grep are really treated as names, spps I can currently regurgitate only by thinking of stop-process, and I imagine most such abbreviations will be like that for a while.
totally agree, and yeah, "you eventually memorize all the arcane bits" definitely isn't a point in favor of powershell

there are also some commands I use all the time that don't have built in aliases like the json converters, so that makes cross-machine alias consistency for some important things not great

I think the long form is because people usually tab to complete the names. Personally once you learn them they dont get that hard to type