Hacker News new | ask | show | jobs
by wildebaard 2881 days ago
While I get that it's easy to hate on and make fun of Microsoft, why not applaud them for making stuff like this that apparently is 'a given' in the linux-world.

What's wrong with a good idea, even if, especially if, others are already doing it. It's not like stealing IP; it's about making tooling nicer.

I for one actually like this (granted, I use PowerShell regularly).

3 comments

I get sick of all the downplaying that PowerShell gets. I find interacting with the console a breeze, and just as usable as Bash. I can easily perform an ad-hoc API call into an Object, explorer it and export it into a well formatted .csv file for a report in minutes.

We use it in tooling for tons of things that would otherwise be done in Python and have no issues. Especially once you get it set up on Server Core and run the jobs in Cron.

I just don't get all the negativity towards it. There's a reason so many vendors are providing great PS modules for their products: VMWare, AWS, etc.

I find it horrifically verbose. Granted, there are a decent number of aliases, but some pretty basic stuff requires 3 words separated by hyphens. Way easier to just use bash on WSL on windows 10 machines.
I feel like that makes it readable. Even people who don't know PS very well can read cmdlets and pretty much know what's going on if you use the full verbose cmdlets.
I think when scripts are over 1k LOC the naming of functions can get pretty unwieldly when trying force everything to fit into the approved verb-noun mantra.
Over 1K LOC I'd want to be using a proper programming language rather than shell scripting, whether it was Windows or Linux.
I think it boils down to a lot of people having a fundamental misunderstanding of what makes PS different than Bash, i.e., not understanding how significant it is to have processes communicate through piped objects versus piped text, which is far more brittle.
I think it is simpler than that, it's web and unix devops who just don't want to learn new tooling and are upset that it isn't exactly like bash/core-utils.
Since it is impossible to force all inputs to be well-constructed, text acts as the more predictable interface. Once I learn a bunch of command-line tools for processing text, I know exactly how to compose commands or post-process text from a file or extend the usefulness of a program that doesn’t happen to produce output I want.

While there may be something “brittle” from time to time, in my experience this just means it was possible to tackle the problem with text when the alternative would have been to have no way to do it at all.

PowerShell feels like it wants everything to be structured perfectly, and “perfect is the enemy of the good” applies. Sometimes, I don’t care if there is a way to perfectly structure a particular input because many use cases just don’t have stringent requirements.

> Since it is impossible to force all inputs to be well-constructed, text acts as the more predictable interface.

Disagree. If the program decides to change its output formatting even by a small amount (like going from a GNU version of the program to the BSD version, where such things can happen), e.g. changing the column order of two items, whoops, your script is broken. When you deal with object versus textual output the textual representation of a program can change all day long and you're not affected. The only breaking change is a change to the output object format (like renaming or deleting properties).

Writing scripts that rely on text being output in a specific order with a specific format is very brittle in my opinion.

Robust scripts require diligence appropriate for the environment. If you’ve deployed systems with different default tool versions, you factor this in, e.g. by installing a common version that both can use (or just make scripts that can figure out how to work either way). Two versions of a tool isn’t really any different than two versions of a compiled-in API, except that APIs tend to be more rigid (not always, e.g. some languages allow runtime querying).

There’s a common rule in Unix-like systems that essentially says “inputs are liberal, outputs are conservative”. It matters to have programs that can adapt, because this makes a lot of things more practical.

Assuming the system is put together correctly, all inputs certainly ought to be correct, because whatever component is producing the corresponding output simply wouldn't have compiled if they weren't...
Powershell deals with text too, it just converts it into regex match objects.
Maybe same reason people going to a restaurant are more likely to write a review if they are disappointed? For every "this is lame" there are probably 50 "oh, neat" opinions but fewer of those bother to write comments.

(The above is just a guess. I have zero scientific backing.)

From past experience conducting data analysis on customer survey responses, I can say that you typically get a "barbell distribution" - most responses are either very negative or very positive, with relatively little in the middle. If people were very disappointed or had their expectations exceeded, they tend to actually respond, if the experience is "meh", not so much.
That could be. I also have zero scientific backing for it but for me, I would probably not have commented and indeed thought "oh, neat!" had it not been for the negative comments already made. That is also because "oh, neat!" on its own is not a very useful comment to make on a site like this, imho.
For me it's no so much a "Microsoft is inferior because linux did this first" as it is "Why the hell are they only just copying this now?"
> "Why the hell are they only just copying this now?"

What? PowerShell has been around for 11 years already!

Furthermore, a console scripting language was added precisely because many people were bending Microsoft's ear and asking for one. Say what you like about Microsoft, but they've got a long consistent history of responding to customer requests and feedback; granted it took them years to respond to this request, though (!).

But terminals 11 years ago were already more advanced. So, yeah, I'd echo the "wtf took so long?"

All the resources in the world but absolutely glacial progress.