Powerful vs Functional
I’ve spent a bit of time this week thinking about strategies for writing code.
It’s my impression (perhaps not altogether accurate) that computer scientists, engineers, developers, and other people who deal with projects in which the primary goal is a code-based product strive for a powerful code. I’m not entirely sure I understand what that means when people say it, but it seems to be a combination of efficiency, flexibility, and speed.
While I think these are worthy goals when creating a code-based product, they clearly take a backseat for some coders. For those of us whose end goal is not the product, but rather the new knowledge that the code will contribute (i.e. computational science), we can certainly sacrifice power in the interest of spending our time doing other things.
For instance, let’s say two scientists are interested in using some code to compile data from multiple different sources. Scientist A elects to spend time ensuring that the code she develops is powerful. That is, once she is able to accomplish the immediate task at hand, she spends some time ensuring that her code is efficient, flexible, and fast. This is good! Ideally, she can share this product with others and they will be able to feed a variety of different file types and data structures into the algorithm and have, as output, a cleaned, compiled file which is easy to work with in order to discover new insights.
Scientist B, on the other hand, elects to simply write some code that works for the immediate problem. It takes the files he has on hand and turns them into a data structure he’s looking for. It probably won’t work for anyone else’s needs without a good deal of modification. The time he could have spent streamlining his code, he instead spends writing a paper on the insights he found, or on starting a new project.
While I’m well aware that setting up dichotomies like these is frequently misleading, I think they can be illustrative as well. This example demonstrates different goals at play between our two scientists. Scientist A is strongly oriented toward making a product which can be shared with others in order to benefit the community. Scientist B, on the other hand, is oriented more toward findings insights in the data and then sharing these insights with the rest of his research community. This isn’t meant to say that one of these is inherently better than the other, or that it is impossible to have some mixture of these extremes. Rather, I’m only pointing out that spending time making powerful code will not always be in the best interest of everyone.
This week, I’ve shifted my approach to go from making something that’s powerful, flexible, and efficient to something that will work for my purposes. I need to find insights in data and communicate these insights to my collaborators and the broader research community. Any time I spend trying to make something powerful (which requires a set of skills which, to be frank, is not really in my wheelhouse) takes away from time I could spend on discovery and communication.