But, this was one of those not-so-rare occasions where the task at hand would have taken you only a few minutes longer, or in some cases less time to accomplish than writing the code to make it work. You were torn for a moment, "Should I just do it? I'll never have to do this ever again and scripting it will take just as long as doing it manually". To script, or not to script?
If you're reading this blog, you're most likely in the demographic that would answer that question easily. Script it! Even though this is a specific case and the actual code will most likely never get used again verbatim, you still gain a lot from scripting tasks like this. Here is why:
Within every task given us is a problem to solve. Some are easier than others, some are difficult, and some may not seem like problems at all. The fact is though that as simple or as direct as a task may seem there is always some level of problem solving involved with it and as it is with any other skill, practice and repetition always make you better. If you approach every task like a challenge and use it to level up in some way, it makes even the simplest script worth writing!
What can you do to make a simple, easy-to-write script more challenging? Some ideas:
- Write it in another language or application
- Use commands or functions you've never used before
- Make it more robust, so that is becomes useful in other situations
- Write it in as few lines of code as possible (don't count comments or white space lines)
In our line of work, the ones who stop learning are the ones that are left behind. Always seek out new ways to improve your skill-set and keep getting better!