The Codeless Code: Case 23
Case 23: Shape
In this story we have a nun walking past a monk coding, she looked at the code and declared that it wasn’t right, and walked away. The monk complained to the abbess of the temple that the nun had judged him unfairly. The abbess then goes to the nun seeking to correct her poor behavior, and is then shown the error of her thinking.
The abbess in the story says that the code runs completely satisfactory and saw nothing wrong with it. the Nun then takes the clay pitcher she had been working on, batters it into near oblivion and then pours water into it, the water holds, and thus the nun says that the jug must then be satisfactory.
This story is all about style. You can have code that runs perfectly, with no bugs or errors of any discernable kind, and still have a mass of horribly written mess. This is where nightmare tales of spaghetti code dwell. Stories of applications that work, until they inevitably don’t, or need to be extended in some fashion, and the developers left behind(assuming the coder has smartly left the organization in search of other repositories to defile) are then tasked with making sense of the glob of code, in order to fix/enhance. This results in a lot of swearing and a lot of wasted man-hours spent in analysis.
Code style, the shape the code takes is just as important as it’s functionality. Ultimately the shape of the code is meaningless to the computer, as once the code is compiled, or interpreted by the system, the original shape has typically been optimized and converted into something that probably only barely resembles the code we have written. Code style and shape are important for workplace sanity however, comments on obscure lines, good and consistent indentation style, and placement of braces, are all very important. What is not entirely important are the silly brace placement and tabs vs spaces debates that developers get caught up in, due to their own personal preferences and anal retentiveness. The importance, is that the project have consistent bracing and spacing. Whether you are a tabs guy, or a spaces guy, I could care less, as long as your code is consistently one or the other. you will find my code typically is tabbed with K&R 1TBS bracing, but that doesn’t mean I won’t adapt to whatever is in front of me. The hard rules of coding dictate that you:
Have a style of some kind, absence of style is not a style
It is consistently applied.
That you adapt your style to the existing style of the project if maintaining legacy code.
Respect that other developers may have a different opinion on style.













