Creating User Friendly Code
As you write PowerShell scripts and functions, I encourage you to think about who will be using your code and their expectations. Even if the user will be you, this is something you need to take into account. There is also a corollary to this suggestion, and that is to write user-friendly code; don’t force the user to do your work for you. I bet you’ve encountered this. Have you ever had to fill out an online form and be forced to enter a value, like a phone number, in a specific format? In my opinion, the friendlier way would be for the developer to handle the formatting on the back end. This same idea applies to writing PowerShell code. Let me give you some examples.
Don’t Force Formatting
Here’s an example similar to my phone number reference. Consider this demonstration function.