Plan to parameterise early
Friday, Mar 29, 2013 · 200 words · approx 1 mins to readMy advice here is quick and simple, and applies mostly to small programs you write that you believe will be specialised and single purpose and probably one-off. Those programs tend to initially operate on a set of fixed inputs and do a single thing. Maybe you only plan to feed one specific set of data in, transform it, and then spit it out.
Invariably you’ll keep using the program and it’ll evolve to accept different data or transform it in slightly different ways depending on some initial state.
Despite the up-front overhead, I find the pattern of repeatedly coming back to programs like that to be easy justification for parameterising the input data and initial state even if you think it’ll be a one shot endeavour.
Become one with a great options parser or your shell’s argument handling, because I bet you always tend to eventually generalise input to those smaller specialised programs.