I have an idea! Let’s have a “Worst Code Contest.”
Why do this?
Bad code is really fun — at least, when you write it on purpose. And other people’s bad code is even more fun.
But seriously, I’ve needed to write a lot of bad code over the years when creating demos and reproducing various scenarios. It uses your brain in an unusual way, so it’s a fun thing, but it also teaches you a lot!
How to play
The game starts at 5pm BST / Noon Eastern / 9 AM Pacific today. I’ll be livestreaming the contest here, but you can play whether or not you join the stream. Here’s how it works:
- I will post a challenge on Twitter to write your best worst code that either does a specific thing in TSQL or produces a specific result set when run against a SQL Server
- There will be a 10 minute time limit for each challenge.
- You can use whatever resources you want to put your solution together, but you must submit your solution within 10 minutes to compete. The solution needs to be in a set of short scripts (it can’t require cloning a whole repo or restoring a database — the most beautiful awful code is succinct)
- Tweet back a link to your BEST WORST sample code using the tag #BestWorstCode.
- You can save your code anywhere that works, as long as a link works and I can copy it to a clipboard and test it. One easy way to do this is to create a free GitHub account and create a Gist for each sample. But blog posts are fine too, or whatever you like using that is easy to link to.
We’ll do TWO challenges, so the contest will probably take 45 minutes altogether, with time for chatting through different submissions.
You can join for one or both of the challenges. If this is fun, we can do it again sometime soon, too!
What do I need to have installed to compete?
You need three free things:
- A SQL Server (don’t use a production instance, LOL, Developer Edition is free)
- A copy of the pubs sample database (script to create it is here, this is a Microsoft script shared under the MIT License)
- A dream
And truthfully, the dream is optional.
Do I have to play to join the livestream?
Nope. Join the livestream if you wanna chat while you play along, or just chat. You can also play without joining the livestream. It’s all good.
Is there a prize?
You will win the admiration of two corgis and a sense of superiority that will last you all weekend long.
Let’s write some awful code together!
We can make something terrible and beautiful at the same time.