Chapter 6. Tool design guidelines
We have a confession to make. When we first started outlining this book, we were just going to jump right into the get-it-done stuff. That’s actually in the next chapter. You see, our original plan was to dig in, and then after it was all over, to explain our design philosophy. One of our early reviewers suggested, very politely, that we were being dumb. We just wanted to get to the fun stuff, but that reviewer was right: We need to explain why we’re going to do what we’re going to do.
We know it’s easy to skip past this philosophy stuff. But we plan to keep it brief and to the point—and honestly, this stuff is important. People really struggle to make PowerShell do the right thing, and they honestly end up working a lot harder than they need to, because nobody wants to cover these basic design guidelines. So here we go.
Here’s a basic tenant of good PowerShell tool design: Do one thing, and do it well. Broadly speaking, a function should do one—and only one—of these things:
- Retrieve data from someplace
- Process data
- Output data to some place
- Put data into some visual format meant for human consumption