Start coding in Evernote

When I start coding a new feature, I typically start in a program like Evernote where my code won't be runnable. It's a bit unconventional, but I really like the results. I've found my architecture and overall code quality improve and I'm able to see bad ideas before I bake them into a code base or test suite.

First, I write down an outline in markdown of what the program should do step by step. Then, I break that into methods and write their method signatures and a brief description of their behavior. Only after I have most of the code outlined do I start writing it down (still outside my dev environment). When I think I've worked out most of the architectural challenges, I copy the code into my normal text editor (currently Atom with Vim bindings), add tests, and commit.

When I write code in my development environment, my desire for results gets the best of me and I work to make the code work. I overlook poor coding style or weak architectures or poorly applied patterns in a rush to make the feature come alive.

When I'm writing outside my development environment, I have the space to ask myself questions about how all the pieces of the code fit together. Specifically:

  • Is this simple or does it feel complex?
  • Are my dependencies clearly defined and reduced?
  • Does my code flow linearly or have I filled it with unneeded abstractions?
  • Can I abstract out this behavior to make the business logic more apparent?
  • Can I push more code into pure functions that act on objects or data structures?

If you haven't tried writing code outside your development environment in a plain text file, give it a shot. I think you'll like the freedom it gives you to analyze and reflect on your work.

Scott Messinger

Read more posts by this author.