8 ms·
I want to like PowerShell, but some basic design decisions really irk me. Specifically Verb-Noun command names seem so backwards. I want to start with the domai
by liminal 5y ago
I want to like PowerShell, but some basic design decisions really irk me. Specifically Verb-Noun command names seem so backwards. I want to start with the domain and then specify the action I want to perform in that domain. Noun-Verb would make so much more sense (and naturally group commands together when sorting alphabetically). Which brings up the other annoyance: long capitalized names with dashes in the middle. It's so annoying to type! Repeatedly typing dash followed by a shift-key combination adds enough friction to notice the burn. Finally, options are also too long. Compare `rm -rf` with `Remove-Item -Recurse -Force`. Capitals, dashes, long words... It's too much!
- AtNightWeCode 5y agoThis would be my first question. Anybody naming things in IT knows that you go from big to small. From large domains to specific actions. Secondly, how are you supposed to learn which of the 40+(?) verbs to use. Store, Save, Put, Add. Update? In many cases it does not make any sense.
- soverance 5y agoHave you tried reading the docs? A full list of approved verbs is available, and describes in detail when you should use them and what synonyms they should replace. It makes sense for anyone willing to spend a moment investigating why it's designed that way. https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7.2 https://docs.microsoft.com/en-us/powershell/scripting/develo...
- AtNightWeCode 5y agoTell that to the people writing PS modules. :) Put, Update, Update, Put? PS is a good example of overdesign imho. Also, one can compare for instance Az CLI with Az PS. Takes at least 5 times longer to do anything in Az PS.
- gruez 5y ago>Specifically Verb-Noun command names seem so backwards I agree that doing noun-verb would be easier for autocompletion purposes, but I suspect that ordering was chosen to align more closely with english grammar, specifically https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93object https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93o... >Finally, options are also too long. Compare `rm -rf` with `Remove-Item -Recurse -Force`. Capitals, dashes, long words... It's too much! but they're far more readable. You might be able to remember what -rf does for rm, but what does -o mean for curl? What's the difference between -o (lower case) and -O (upper case)?
- vips7L 5y agoRemove-Item is aliased on most systems to rm as well and pwsh will fuzzy match switches.. so you end up with: rm -r -fo Not that much more verbose than the unix rm -rf
- AnIdiotOnTheNet 5y agoI like PowerShell, but I'll agree with your first criticism, Verb-Noun makes less sense than Noun-Verb. At least it is pretty consistent about naming. Complaining about long capitalized names with dashes in them is a little weird in a language that is both case-insensitive and has tab complete for everything though.
- pastaguy1 5y agoIMO, the case-insensitivity is peak powershell. Possibly a good idea on paper. In practice, at least as an only occasional PS hacker, it always eats up a couple brain cycles.
- AnIdiotOnTheNet 5y agoI admit the choice of case-insensitivity is questionable, although it is in keeping with Windows's history. I just think it is silly to complain about having to uppercase things when you, you know, don't have to do that.
- liminal 5y agoBut I didn't know I didn't have to do that! I admit to not being competent with it, but all the examples use title-case, so I thought that was required.
- kaba0 5y ago`rm -r -fo` will work just fine on powershell, afaik: there is an alias for remove-item called rm, and flags are fuzzy matched. There are two flags starting with f, so fo is needed here, but I don’t think force is that often needed on windows, so in practise it is just as short.
- psd1 5y agogcm | sort Noun