So, I’ve been working through the book “Clean Code: A Handbook of Agile Software Craftsmanship.” It’s been a massive help and I would recommend it to those who wish to code their own game.
Because the practices it teaches will make coding go faster and easier. It’s the same logic for unit testing–a little extra work up front can save endless work later.
I’d like to make a comment from the perspective of someone coding their own game from scratch–this book will save you a lot of trouble. It teaches you to extract functions and classes, to minimize function arguments by passing needed references into constructors and holding them in private variables, to use descriptive variable and function names, and to use factory methods to make the code clean even with the massive constructors.
If that was mostly gibberish, I’ll sum it up–the book argues that the art of programming has always been and will always be the art of language design. And language permeates design of anything. If you try to constantly extract methods and classes any time your code gets messy, and use descriptive names like “playerCharacter” or “CombatManager” instead of “p” or “cmMng,” you’ll find yourself speeding up in development as time goes on.
This acceleration is due to the fact that you’ll be able to build ideas into each other. The functions and classes you create are parts that can be re-used and built onto each other, and complex problems become simple ones because you’ve already defined the major pieces of the problem. This is huge, because games are complex and if you’re the sole developer you’re going to need to find ways to save yourself extra time and work to succeed.
The one thing I’d add to my readings thus far (I’m in chapter 4 now) is that using the “has-a” pattern instead of the “is-a” pattern pairs really nicely with these teachings. Look up “has-a pattern” and “Composition” to see what I mean. Together they provide a toolset to make life much easier for someone who has a lot of code to write all by themselves.
The latest version of Legend of Luth is available for download here.
All images, writing, characters, artwork and related indicia are (c) Earl Isbell
Feel free to leave a comment, browse the galleries, or contact me if you wanna buy a print, commission me, or just drop me a line. Just navigate using the links at the top ^^.