Truly nothing requires more intimate knowledge of a system, than refactoring its components. Familiarity with its internal organization demands familiarity of its creator; their habits and practices, their syntactic and semantic preference, and their logical flow all must be grokked absolutely in order to understand the choices they made and why they made them.
The past two months saw significant changes in my life and it is apparent from reading my old code that I have changed as well. It’s as if I were a different person then, an individual with an obsessive thirst for pre-optimization and style propriety, so much so that the earliest classes I wrote (the rendering component and main loop) have had their line count reduced by half as a result of the refactoring effort. An idealist at heart, the past me sacrificed productivity in search of the programmer’s haven; a paradise with code so elegant to eliminate the need for comments, so simple that even the most inexperienced of Python scripters could read and follow the flow of C++’s cacophonous syntax (yes, that is a jab at scripters, and at Python). It might be construed that this materialized as a consequence of game development (or, more broadly, software engineering) naiveté. I think this is but one of many factors, factors not excluding the absence of the time limitations mentioned in my previous post.
Eventually the pragmatist in me realized that if this attention to detail was afforded to every line of code, we would be here for a very long time. After all, the maths behind a 2D platformer are not so complex that they require rigorous optimization to perform well on a modern platform, especially this early in development. It became my opinion that this form of microscopic scrutiny finds a more meaningful purpose on the outer surfaces of the product: gameplay, story, characters, art, and sound make ideal candidates. It followed logically that functionality should be implemented using minimal effort and focus shifted as quickly as possible away from engineering and towards design.
At least, that was the principle I adhered to following my return from GDC; seeing the excitement and reward generated by a well-designed game at the Indie Games Summit served as the catalyst for a shift in development paradigms (not to place the blame solely on the IGS because it was a wonderful event, but it is MUCH easier and more productive to discuss design than it is to discuss programming with such a broad audience). What I ended up with was a mess of spaghetti code, OOP shortcuts (e.g. returning raw pointers to component classes), and functionality delegated inappropriately among other generally poor programming habits that do not adhere to the entity/component methodology, all in the sake of development speed. The “add functionality on top” attitude I expressed earlier this month caught up with me quicker than I had anticipated, necessitating a refactoring of the entire project.
That is not to say that either extreme is the appropriate answer. Of course, were I one half of a team focused purely on one half of the development, this post would be one half as long and 100% less interesting. But as the sole developer on this project, it falls to me to decide what the most important aspect is, and where to delegate my resources. Am I trying to create a technical masterpiece that a programmer would be proud of? Or do I want to make an artistic experience that a designer would be pleased with? At this point it is too early to tell.