Best practice guidelines

Before you can get serious about creating your own reusable code (in the form of functions and modules), you have to think about common best practices and why they exist. You need to get used to following best practices when writing code. In short, applying best practices should come naturally to you.

In an enterprise environment, there are usually code policies already in place. However, they are often tailored to in-house development, using traditional development frameworks like .NET or Java. That should not deter you from adopting the policies as guidelines for your PowerShell code. In this section, you will see that many of the best practices for writing PowerShell code are similar to, if not the same as, other programming languages.

See https://github.com/PoshCode/PowerShellPracticeAndStyle for a community-maintained approach to PowerShell best practices.

The first thing that we need to elaborate on is the general structure of your code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset