DaniWeb IT Discussion Community

Blogs (http://www.daniweb.com/blogs/)
-   Member Blogs (http://www.daniweb.com/blogs/blogs.php)
-   -   Narue's Blog (http://www.daniweb.com/blogs/blog17893.html)
-   -   -   Elements of Programming Style (http://www.daniweb.com/blogs/entry84.html)

Narue Narue's Blog
Oct 29th, 2004, 6:06 pm
I'm a firm believer in the close relationship of written language and programming. There's a good reason that we use a "language" to program computers; the similarity of nouns and verbs to objects and functions is striking. Every time I turn around, I see ways of applying the skills of writing good prose to the task of programming. Because of this I find myself grinding my teeth when somebody asks a programming question using such horrible writing as to cause William Strunk Jr. to turn over in his grave. I'm never surprised to see that the code examples following these poor questions are equally horrid.

Instead of turning this into a rant about the decay of the art of writing good prose, I aim to encourage programmers to practice good writing. Not only does the skill pay off many times over in many unforseen ways, the direct result of being a good writer is that one falls into the habit of good programming as well. Having an eye for both accuracy and aesthetic issues in prose will result in a keener eye for detecting syntactic and semantic errors.

If one is able to compose an essay consisting of sentences, paragraphs, and pages with surgical proficency, the leap to composing statements, functions, and modules with equal ability will arise. These are the foundations of good programming style that result in clear, concise programs that are both correct, useful, and a joy to read.

If you want to become a better programmer then I recommend striving to become a better writer. While the two activities may seem unrelated to the uneducated, programming and writing follow the same principles. Skill with one can be transferred to the other with shocking results.