Summary: Microsoft Scripting Guy, Ed Wilson, discusses the judging criteria for the 2012 Windows PowerShell Scripting Games.
Microsoft Scripting Guy, Ed Wilson, is here. Today is the day that I reveal the judging criteria for the 2012 Windows PowerShell Scripting Games. In many respects, good Windows PowerShell code is good Windows PowerShell code. So the judging criteria this year reflects this fact.
General criteria for good Windows PowerShell scripts
- You should be able to read and understand your script. If you cannot read and understand your script, you will never be able to effectively modify it or troubleshoot it.
- Use native Windows PowerShell cmdlets and capabilities unless a clear cut reason dictates otherwise.
- Use comment-based Help.
- Format your script to facilitate reading and understanding of the script.
- Line up related items, and indent subordinate or dependent items.
- Use comments, but avoid in-line comments. Instead, place comments on their own line ahead of the code to which the comment refers.
- Avoid aliases in scripts.
- Write your code so that it can be read without requiring horizontal scrolling. To do this, consider using variables and natural line breaks (such as the pipe (|) character). Avoid line continuation marks if at all possible, but not at the expense of creating really long lines of code.
- Leave the pipeline character on the right side of the code.
- Put at least one space between commands.
- Place individual commands on individual lines unless the command is exceedingly short and separating the commands would hinder readability.
- Keep the integrity of an object as long as possible. Avoid using Write-Host.
- Write reusable, self-contained functions.
- Functions should return objects.
- Use Verb-Noun naming for functions.
- Prefer the singular for nouns in function names.
- Functions should accept piped input if it makes sense to the application.
- Do not call a function like a method.
Specific grading criteria
All scripts are graded on a five-point scale.
- One point is awarded for a submission. All scripts will receive at least one point.
- One point is awarded if the script runs and meets the minimum requirements of the scenario.
Therefore, a submitted script that runs and meets the requirements of the scenario will receive two points. If a script runs, but DOES NOT meet the requirements it will only receive 1 point, which is the same score as a script that attempts to meet the requirements of the scenario but does not work.
- The other three points depend on the scenario.
In most cases, there will be four or five specific criteria that a script must meet. To receive all five points, a script must meet all of these criteria. If a script omits one criterion, one point is taken from the total of five. Therefore, a script would receive four points if it met all but one of the criteria and it worked properly.
If a scenario only lists two criteria, and the script worked properly and met both of the criteria, the script would receive five points. A script that only met one of the criteria, would receive only four points.
However, there is an evaluation process on the part of the judge—a judge may decide that a script is only worth 2 or 3 points instead of four or five.
It is the intention that every script will be graded by at least two judges, and that a script will receive at least one comment from a judge. This is not a contract, however, and some scripts may only receive one grade and no comments. It all depends on how busy the judges are, and on the number of scripts submitted for a particular event.
If the last two years are any indication, the first scripts submitted for the first event will in all likelihood be graded 10 or 12 times because the judges are anxious to get on with the 2012 Scripting Games. As the events progress, it is also possible that some scripts will continue to be graded many times, and others will receive only a few. This is because all judges will not be able to grade all scripts all the time (although it is possible that some judges may be able to do so).
Please keep in mind that we will run reports that will point out which scripts need grading and need comments. All the judges have full time jobs, and all are uncompensated volunteers. The real point of the Scripting Games is to learn scripting. For more background about the Scripting Games, see the following posts:
- A Week in PowerShell Geek Haven with the Scripting Guys
- What I learned at TechEd 2011 in Atlanta
- Real-World PowerShell Tips from a 2011 Scripting Games Winner
- Lessons Learned from the 2011 Scripting Games
- Microsoft Scripting Guy Explains Logic Behind Scripting Games
- How I Won the Scripting Games, a Pass to TechEd, and Became an MVP
The 2012 Scripting Games are going to be great. They will be fun, exciting, and a tremendous learning opportunity. Maybe you will win and get a free pass to TechEd, a conversation with Jeffrey Snover, and a chance to write a guest blog post for the Hey, Scripting Guy! Blog. If so WOO HOO! But if not, keep plugging away. Microsoft MVP, Bartek Bielawski, did not win the Scripting Games the first time out either.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy