Before writing any piece of code, think to yourself:
- Has someone already done this task before? Can I use a pre-built library to take care of the dirty work for me?
- Is this piece of functionality really important to the goals of the application? Is the task already there, but just through a different user experience?
- Is this an automatable task? Can I spend the same amount of time writing software to write the code instead, so I never have to do it directly again?
- Is there a simpler way to code what I’m coding right now?
As a last resort, write code. In today’s landscape, there are so many opportunities to not write it. When we just go into “writing code” mode, we lose out on the opportunity to think about why we’re really writing it. Instead, when you think in terms of “does this need to be written”, you focus your coding efforts on the elements that, truly, are necessary for your application.