What is great code? What characteristics would you describe it having? These questions come to mind as I am reading the first of a four volume series on writing great code. The first work is subtitled, "Understanding the Machine." Before I delve into what I've "learned" by reading this volume, what should one hope to gain? What understanding of modern machines is required for writing code, especially great code?
First, I'd emphasize that great code is more about maintainability and understanding than efficiency. Correctness over performance. And therefore, the text is more about how understanding the machine can clean-up the code, simplify any designs, and ensure correctness.
Second, in the context of the previous post, most programs do not need to "understand" the machine. Most applications will not be constrained by execution time, and therefore the programmer effort should be directed elsewhere. Yet programmers reach their own insights into the application / computer interaction and modify accordingly, and usually, myself included, these insights are irrelevant for the application.
Third, there are specific aspects of modern computer architecture / machine design that is still worth knowing. For example, I find that most programmers have limited understanding of branch prediction, cache usage, NUMA hierarchies, and superscalar processors. (Based on my reading so far, I would also add floating point to this list).
What else should a programmer know? What should I be looking for while I read this book?
No comments:
Post a Comment