Geek / Technical

Is There Creativity in Programming?


A colleague of mine was complaining about pair programming. He said one of the problems was that it restricted his coding creativity when he had to argue or discuss what he wants to do with someone else.

I was reminded of a forum post I made many years ago in which I similarly said something about creativity in code. Someone replied and said something to the effect of, “No, software development is engineering, not creativity.”

I have since thought about that response often, and it made an impression on me.

So I told my colleague that if you’re being creative while programming, it probably means you don’t know enough or have enough experience to know what to do.

An example I gave to him was some work we had done together in the past. We created a set of classes to handle filtering some data based on some criteria. We had come up with some very good work here. It was test-driven, very clean, and worked well. We spent about a week on it.

It was a creative solution.

But only because it wasn’t until months later that someone pointed out that what we had implemented was already provided by the 3rd party framework most of our software was based on.

Had we known that there was an existing solution, there would be no need for creativity. We would have simply solved the problem and moved on.

On the other hand, we’ve learned that incremental development results in better software. Rather than do the waterfall approach of big design up front, we implement a working piece of value, then build on it.

Often, the process of building the software is the way we learn how to build it. Coding, then, isn’t merely a matter of giving form to requirements, but a way of exploring the problem space. Write some test code, see what happens, and gain a more accurate understanding of what you’re making. Rinse, and repeat.

Software is malleable and allows such experimentation. The end result is a working program to run. We have created.

But can we call it creativity?

Many years ago, I was creating the best RPG ever! a walking demo of an RPG. I wanted the ability to talk to villagers and have conversations instead of merely receiving a single canned message.

I wrote a bunch of logic to load messages, identify if there were branches based on certain things being available such as a quest item, and even provided a way to choose options as replies. You could buy and sell things, which allowed you to change your inventory and your money supply. Inspired by Final Fantasy III‘s thief town, you could even lose money just by talking to certain characters.

I was very proud of the system I came up with and put together in QBasic. I came up with a very creative solution, I thought. It wasn’t until years later that I realized I basically reinvented what’s called a scripting engine.

Had I known about the scripting engine concept, I probably would have realized that it was exactly what I needed. Instead, I stumbled into it over many days of hacking together something that did more and more as I thought of it.

Then again, even if I know the concept, isn’t there some creativity in the specific implementation? Or am I mixing up the roles of the programmer and the game designer here?

If I write some code to calculate mortgage interest for a bank and realize that a side-effect of my effort is that it is easier to get data for some strategic analysis, that’s not programming creativity so much as business insight. Similarly, realizing that I could add another cool feature to the scripting engine is more about adding to my game design capability than about being creative with code. The code was just the way I expressed the creativity of game design, and so therefore incidental to it.

One of the things I believe is that being cute with programming means more headaches than it is worth. There’s a bug in your OS you can exploit to accomplish some data manipulation faster? Great, until it is patched. Best to stick with documented features and not trust that what happens to work today is what is right.

Similarly, writing “creative” code seems like a recipe for disaster. How clear can your code be if you’re being creative when you write it? You want to be creative? Experiment with code katas. Hack away for fun on a side project. Join the The International Obfuscated C Code Contest. But I don’t think “creative” code belongs in released production.

I think creativity in code is just another way of saying, “I’m guessing that this might work. Let’s see what happens.” It’s like throwing things into a fire and observing the results. It’s not creativity so much as experimentation.

When I learned about design patterns, entire concepts were made clearer to me, and my programming capability improved. I didn’t have to be as creative to write code to solve a problem or accomplish a task. If I’m ever trying to be creative while writing code, I think it says more about my lack of knowledge in the area than with the nature of programming.

What do you think? Is there creativity in programming?

(Photo: | CC BY-SA 2.0)

2 replies on “Is There Creativity in Programming?”

I was surprised to read this. It’s pretty clear to me that programming is a creative activity. What I think are the trouble here are the assumptions we use to discuss the idea.

Creativity, in general, is just creating stuff. More often, we speak of the connotation that creativity is creating something novel or in an original way. But to be creative, this concept of being original is very loose and locally contextual.

The examples in this entry kinda assume that learning is an inextricable part of creativity; that you can’t have creativity without learning. Is a master sculptor still creative even if he’s not doing anything novel? Is there much of a difference between programming clay and sculpting code? One seems more discrete than the other, but that may be considered a difference in the tools we use to express our intentions physically. I’m also surprised by the idea that engineering isn’t creative. Define engineering here? Because if problem-solving doesn’t require creativity, then wouldn’t all our problems be solved already?

I think it’s wrong in this context to pull design out of programming by opposing it with game design. Game design is a different level of design than code design is. Putting them against each other this way necessarily diminishes the design that is inherent in programming. If you keep pulling parts of programming away from it, you just have keyboard typing left! Is keyboard typing creative? It’d be hard for me to say ‘yes’ unless you have an interesting way of moving your hands across the keys… Doing something should be made distinct from creating something. Programming is an art that combines several disciplines because you need to creativity apply them in order to solve problems. If someone is just handing you a page of code to copy down, then of course you’re limited in your creativity! If someone is pair-programming with you and you feel restricted in your creativity, then your focus is in the wrong place. The *pair* is programming, so the focus should be on the pair working creatively, whatever that looks like for your company. Discussion should obviously be a tool to get there.

There’s a big difference to be made between “creative code” and “experimental code”. From a science perspective, experiments are extremely important, but you have to be aware that experiments, by their nature, are allowed to fail. Creativity has nothing to do with that failure. Wrong code is just wrong, whether it was creative or not.

The use of design patterns here is problematic, too. Design patterns aren’t set-in-stone typing tasks. They are higher-level abstractions for use in designing more flexible software faster. The designer (or programmer) has to make fuzzy choices about which design patterns are appropriate and best fit the needs of the program. It must also be said that we can’t discover all possible design patterns. Part of performing the art of programming is internalizing the design patterns you create as you go along.

Um… The End. 😉

I know of very few creative arts (actually, approaching 0) where one does not use skill and intention and internal metacriticism and current techniques and tools and materials. It’s approaching 0 really fast, in fact. And really close.

Artists don’t just start with a scribble in the botton left corner and no idea where they’re going or how they get there. Commercial art is iterative and incremental with a fair degree of user-testing on the way to a final.

Photographers don’t just walk into a field and use whatever is at hand. Nor do they usually take a given photo just once. There tends to be a lot of framing and bracketing and re-set-up and intentional knowledge-guidedexperiments.

I reject the false dichotomy. Knowing how/when to use libraries and OS features is part of the “material science” that engineers and architects know well. Or should, if they desire longevitiy in their careers.

And those things change out from under you. I remember when I stumbled upon an article about docker, and was surprised to find out about all the linux kernel virtualization support and kicked myself in the butt for days for not having at least tried to keep up with the OS. Not knowing that kind of stuff is a death knell for a software architect.

Comments are closed.