Folks, as we dive into Event 2, I want to offer some advice based on the comments I saw for Event 1.
- Don’t overthink the Beginner event. We’re not looking for a script or function - a one-liner, if possible. Don’t overdeliver.
- Avoid aliases and positional parameters - this is a practice outlined in the Competitor Guide.
- TEST YOUR CODE. You can’t modify it. Also, judges can’t see any comment you might leave when “voting” on your own entry, so you can’t use comments to mitigate an error. TEST. Submitting an entry is like pushing a script into production.
- If there’s a straightforward, native way to do something - do it. People seemed to down-vote a lot of entries in Event 1 for using Robocopy. Not that it’s wrong… but the general community opinion seems to be, “use native commands when they exist and can solve the problem.”
Remember, these aren’t my guidelines - this is what I’m seeing in the comments that I’m reviewing, and wanted to pass them along as a sense of what the community seems to favor and disfavor.
Well guys, and gals another year has passed, and the annual scripting games are upon us again. After a week of reviewing submissions for their technique and style I must say that I am truly impressed! As a community the average ability seems to be growing by leaps and bounds. That"™s not to say we"™re all Samurai just yet, but we"™re getting there!
Before I go off and nit-pick I want to congratulate you all on a small mountain of really well written scripts. Some of the things that the community was preaching 5 years ago are now just standard. Stuff like comment your code, format for readability, and Parameters. At this point I"™m convinced those who still aren’t conforming are simply non-conformist and well that"™s a lost cause. For the rest of us great work and keep it up!
**Where is the Help!
**
What I
didn’t
see enough of in the advanced category is help. Honestly if you"™re going to write a 200 line script fill out the help! It"™s not that hard and it is THE difference between a good script and a great solution! It"™s also one of the fundamental differences between hacking and tool building, both are focused around automating a given problem set. The hacker just gets it to work, the tool builder makes it usable by the masses. If you haven"™t figured it out yet the real money is in tool building, I"™m just sayin!
As a follow-up to my previous blog post, I plan to pick out a submission or two or three which stood out as my personal favorite and least favorite and tell you why I think this by pointing pieces of code that was either put together nicely or could have been improved in one way or another. Depending on my time, I will do at least 1 Advanced and 1 Beginner submission for both “˜Favorite”™ and “˜Not so Favorite. I’ll start out by listing the code and then discussing it bullet point style to highlight my thoughts. So with that, lets begin this journey through the Event 1 submissions by following this link to my blog!
As a celebrity judge, I’m not required to blog ““ I’m just here for my good looks :> – but I’m having a great time reading the blogs posted by the Expert Judges about the Event #1 candidate solutions. Much of the judging is subjective, but I’ll add the criteria that I use to distinguish a working solution from a great solution.
Before I do, though, I want to congratulate everyone who submitted an entry. Most of the entries work and you probably learned just from playing with the challenge. Keep it up and come back year after year.
One hint to everyone: TEST! Most of the entries work, but many fail if the directory for the application (e.g. App1 in \NASServer\Archives\App1) does not already exist. And, a few fail with regular expression errors on the Replace operator (more in the blog). There are lots of great test strategies, but you can just run your code on file in your own directories or step through the code in the Windows PowerShell ISE debugger.
A lot of you have been working too hard at solving the problem (both beginner and advanced). Some of this is clearly related to trying to offer a very complete solution but some look like attempts to write extra clever or elegant code. In the “real world”, there"™s probably not enough time or interest in putting lots of effort into these extras. The minimum it takes to achieve the goal is most often good enough. Here are a couple of examples to illustrate this (with the intent of providing a learning opportunity).
Working with the destination folder address.
A common error here was missing the subdirectory. Most folks got this correct by using some version of $.FullName.Replace("˜C:\Application\Log"™,"™\NASServer\Archives"™)_ or Join-Path “˜\NASServer\Archives”™ $.Directory.Name_, but there were a number who just used the root destination folder name without looking for the subfolder. And some others had solutions that (although I thought were innovative), took too much effort. Among them are:
Event 2 is scheduled to open this evening in The Scripting Games - remember, all times on the Scripting Games Web site are GMT. You will need to adjust for your local time zone.
Voting on Event 1 is scheduled to end on May 7th, so you still have 5 days to earn pointlets and leave comments for your colleagues. As of right now, we have over 330 entries, and an astounding 4,900 votes - an average ratio of more than 14 votes per entry. Folks, that’s seven times more than we’ve been able to provide in the past by just having “expert judges” voting.
Those experts are now being put to better use, providing the learning experience we so much want to deliver. They’re posting in their own blogs (list) as well as here on PowerShell.org, and there’s a lot to read. I’m delighted that we’ve been able to provide so much commentary before Event 2 starts, since that’ll doubtlessly help everyone do better.
The average CrowdScore is 2.551 per entry - obviously there’s everything from 1-point entries to 5-point entries. Folks are being pretty critical, and identifying things they don’t like, as well as things they do. With more than 1800 comments (that’s an average of more than 5 per entry), hopefully competitors are starting to get some take-aways from the community as well.
On Mighty Panel of Celebrity Judges will start awarding first, second, and third place in Event 1 very soon, and that process will take a few days. Keep in mind that their decisions are in no way connected to the community-based CrowdScore. Instead, they’re exploring entries on their own, stating with the ones “favorited” by our expert commentary judges.
Also, I’ve heard some concern about people trying to “cheat” the system by simply dropping in random votes in order to rack up pointlets and win prizes. We’re watching for that - we log IP addresses, vote times, and a lot of other data. We’ll be filtering the votes before awarding prizes, so there’s just no value in cheating. You won’t see that filtering - we’re doing it on an offline copy of the data so that there’s no chance of accidentally deleting anything valuable - but you’ll also be happy to know that, right now, there’s very little in the way of anything suspicious, and nothing that’s been confirmed.
I want to re-emphasize that the CrowdScore activity doesn’t become a true learning experience until after the Games are over, which is when we can start mining that data and divining some crowdsourced best practices and patterns - creating our own community sense of “right and wrong” in PowerShell. I also want to point out that, after the Games, we’ll be posting all entries, and their comments, into easier-to-download archives (I know the Web site doesn’t make copy n paste super-easy; that’s largely an artifact of what we need to do to display things properly; we’re not offering downloads at this time mainly to control server load).
Enjoy Event 2!
As promised, today more general thoughts on scripts I’ve seen in both categories in the first event. I’m Polish, so I decided to blog notes both in my own language, and in English, “just in case”. Also, my Polish is much better than my English (I hope!), so for people from Poland: they can read Polish version, without the pain of translating my-English to English-English. Enjoy!
English version
Polish version
With Event 1 in the books for the 2013 Scripting Games, we are now in the voting period where the community gets the chance to play judge on all of the scripts submitted by voting and commenting on the submissions. I aim to take a look at the common items that pose problems and recommendations on what to do to fix this. The full article is available here.
While working on my notes for first event of Scripting Games I was looking around what others wrote, and was surprised that people really think that enabling SupportsShouldProcess is good enough. In my opinion - it is not. And because this is relatively big topic I decided to write separate blog post just about that. You can find it here. I hope it will highlight the difference between enabling this feature and actually implementing it. And remember: do not kill the messenger. 😉 More from me (mainly on other topics related to first event) tomorrow.