Various forms of "directed" programming have become very popular these days. However, I find that many of these are too restrictive and not conducive to what I consider a "human" creative approach to programming. Sometimes, it's nice to have a wild, messy, and non-linear space in which to explore. Consider the following example from some of my work today:
What you see here is a jumble of code. More importantly, it's an intentionally jumbled mess in which we have things spatially arranged, but without being correct at all. I have mutliple different "sketches" of various possible approaches to a solution all sitting in very close proximity.
In other words, what you have above is at least 4 - 7 different possible implementations to a problem, all of which are incomplete, wrong, and depend on one another in incompatible ways. It's non-linear, un-directed, and glorious.
What this allows me to do is continue to brainstorm possible ideas while always having in my mind and in front of me the other options and other possibilities. It allows me to see and steal code from previous attempts without worrying about "losing" anything in the "cache" of my mind. And of course, there are a few things here that make this possible:
- I can see all of my code all at once.
- I can quickly "retype" any given part of this code easily.
- I can visually arrange the code so that various related possible sub-solutions can be visually compared and contrasted against one another.
Notice that the APL language plays a serious role in my ability to do this. In other language that are not as terse, I often will not be able to have even two possible completely solutions right next to one another in a single visual plane (screen). The various sketches are often too long and laborious to quickly type and "sketch" out simply because of sheer verbosity. And finally, often the expression of a single relevant idea is large enough that I cannot easily get a visual "diff" of the various approaches without more heavyweight solutions.
Here I'm leveraging one of the tricks of the HCI/d trade: the sketch. A sketch is something that allows for creative problem solving by instantiating an idea to a sufficient detail that one can think about it concretely, but without the refinement of a more complete reification that often psychologically precludes substantive alteration. In other words, by keeping things messy and unkempt, I am triggering my brain to say, "nothing here is sacred, I can make adjustments, and I need to make adjustments in order to improve the state of the code." Never underestimate the value of hacking your brain to trigger that creative desire to improve something, and consider the value of being messy when you're exploring coding solutions. Even better, consider APL, which was designed with this sort of thing in mind.