Warm-up for coding

Do you find it difficult to get started with a day of coding, or just to find inspiration to do anything at all? Two things generally work quite well for me:

  1. Write some simple code in a language I already know.
  2. Learn an advanced feature of a language I know, or a simple feature of a language I know less.

For 1) I pick a simple code exercise from any programming book, or make one up myself, and proceed to solve it entirely; the key here is that I know all the “ingredients” well, and just need to go through the motions. My go-to ones are usually Python or C exercises as simple as “sort an array” or “plot a chart with some data points”; just something to get me started with opening an IDE or vim, start typing some raw code, execute – then lather, rinse, repeat, until I'm happy with the results. It's usually a matter of minutes.

For 2) I pick a language feature I don't know too much about, a small one, and come up with an example program to make use of it. For example, it can be a Python module I do not often use, or a basic feature or module in a language I do not use every day (usually Clojure, Julia, or Prolog). The key here is to pick something easy to learn about, and make something out of it.