Getting Ahead By Deleting Code

By Thomas Rayner

Elevator Pitch

In my career, I’ve written a net negative number of lines of PowerShell, and it’s made me an invaluable part of my team at Microsoft. Optimizing and simplifying old code, and other people’s code is a super skill. Being the one to empower your team’s growth will make you the keystone of your team.

Description

When we’re starting out, we write bad code. It’s okay, and inevitable. We end up with crusty old code supporting critical systems and processes, and team members who are earlier in their PowerShell journey can be known to write some funky code, too.

Optimizing and simplifying code normally means reducing the number of lines of code you’ve got. It turns out that simple, optimized code is usually shorter. Therefore, if you’re counting the lines of code you’ve written (a terrible metric to determine developer impact), less is actually more. Think about it. Which is probably more reliable? A 1500 line script with tons of branches, loops, and duplicated code? Or a 300 line script that susinctly goes about its business?

Reviewing your old code, and the code other people write gives you the chance to make a huge difference to the reliability of your solutions, and to teach your teammates new and useful skills. Make your infrastructure better, and your teammates better by deleti g code.