Before software engineering, I was an English Teacher, and before that, a wannabe poet.
I’ve always been fascinated by poetry, especially that which attempts to conform to strict patterns of rhyme, rhythm or metre. For a long time I was convinced that such poetry was stale or hackneyed, and that true creative expression could only be found in free verse - that which broke the traditional rules.
However, when I forced myself to write in particular forms, even ones I considered to be cliche, or childish, I discovered that something interesting happened:
I could create more interesting things and have more interesting ideas when there were rules attempting to limit them.
This is what fascinates me.
I can think about something I’ve thought about often and glean no new insights, but ask me to write about the topic in exactly 14 lines, in iambic pentametre and following the English or Italian pattern for such sonnets and I will uncover ways of thinking, feeling, and seeing the topic anew.
It doesn’t have to be a sonnet. Or any recognised form. The simple act of applying a constraint to the task is enough to generate new ideas. You could avoid the letter E, for example.
I don’t know why it leads to creativity. My hunch is that it’s just enough of a jolt to knock your brain out of its usual groove and explore some new pathways.
It doesn’t have to be poetry, either. I think this applies to pretty much any domain.
Consider the act of drawing. You might be asked to draw something simple, like a house.
We can apply arbitrary rules to the activity to see if it uncovers fresh ideas of what the essence of ‘house’ is.
You can only use straight lines. Or, you may not use any straight lines. You may not lift you pen from the paper. Or, you may not use paper.
Anything could be the constraint designed to shake up your routine approach to uncover something novel - perhaps one of the main purposes of art is to provide that outlet for such an activity.
Of couse, you could apply this to programming too: solve this without loops, include regex in your solution, ensure all functions are less than 5 lines long. Arbitrarily introducing constraints could uncover interesting new patterns you may not have stumbled upon relying on your usual tricks.
Programming often comes with it’s own constraints anyway, so you may feel that fabricated ones are a pointless distraction. I still feel they could serve as a useful tool when tinkering with puzzles or side-projects, though.