It is not a programming question but instead more of a designing question.

Assuming data is stored in json.

For example, Get-Person "John" | Get-Employer or Get-Employer -Person "John"

Both way looks to return John's employer, the former one uses pipeline and later one uses inline parameter. I am sometimes confused: what is the advantage and disadvantage of each? When you guys are designing, what is your preference to use each of them?

For me, the only reason I come up with using the pipeline is that it saves us using variables if the value of the parameter needs to be evaluated.

Anyone has any thoughts on this question too?

有帮助吗?

解决方案

There's no reason you need to pick one or the other. With proper parameter attributes and function design (use begin/process/end blocks) you can allow both options.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top