I noted today how much I like programming - especially when I can try out new stuff. Not necessarily thematically new stuff (it’s not like I haven’t programmed a score manager before), but when I can do it in a stylistically new way. In this case, I tried to do it using dependency injection, something I stumbled over while trying to learn Angular.js – and then subsequently on the Unity blog.
Yes, I will absolutely obsess over these things.
I will read rather dry texts about the merits and problems of a specific pattern, and then meditate over it, as Dragica once so nicely put it. I will then try to use these ideas, immediately, on my next task. Usually failing, at first. I will know myself that it isn’t perfect yet, that it is impure, hobbled and flawed.
So I will rewrite it until it is where I want it. I will rewrite other parts of my code in order to conform to that newly found pattern. (Sometimes, it will make thinks a lot more complicated. Then I’ll have to scrap those changes again.)
I like it when code becomes clean and structured, when each class is nicely encapsulated in itself.
I love it when I can create order from chaos, when I can combine tiny little machines in order to let them make something bigger and way more complex.
That desire for stylistic purity, that poetic grace of code regularly means that I have to rewrite code that I’ve just written few days before. Some details were not yet perfect, some ideas not properly formed out yet, the intricacies of a specific pattern not yet completely understood.
I will do it anyway.
What is curious, though, is the fact that something I considered lost seems to have returned by way of writing code.
15 years ago, I wanted to become an author. I knew back then that becoming an author meant writing, and then editing, rewriting again and again.
These days, I hardly ever write, fiction or otherwise.
But still, I write, and then I edit, and rewrite again and again – until my code has the most clear, concise, pure form. What helped me then will help me now. What fascinated me then keeps on fascinating me.