Write functions

24 Dec 2020

There’s a well-known quote by author Michael Pollan: “Eat food. Not too much. Mostly plants.” I like it because it doesn’t attempt to be dogmatic: it encapsulates some basic guiding principles that get you 90% of the way there 90% of the time. Wikipedia describes the book the quote is from :

He explains…the notion that nutritionism and, therefore, the whole Western framework through which we intellectualize the value of food is more a religious and faddish devotion to the mythology of simple solutions than a convincing and reliable conclusion of incontrovertible scientific research.

That…sounds familiar.

###Write code # Code, like food, has value. I think those of us who write it can (hopefully) agree on that. Some, though, are so afraid of writing/eating too much that they avoid writing/eating what they should.

In the context of programming, I think this translates to an unhealthy fear (again, for some) of duplication. A little bit of duplication - writing something in a way that doesn’t completely maximize conciseness - isn’t the end of the world. Sometimes it’s the best path forward. Sometimes it’s okay to copy-and-modify here and there, especially when you’re still figuring out what your application will end up being.