Kent J. Chen's WebLog

...information technology, internet, and random thoughts

Techniques from Code Complete, Second Edition

Code Complete, Second Edition

(Microsoft Press, 2004), tackles modern-day code construction problems and provides all-new code examples written in C++, Visual Basic (VB), and Java. This book should be on every programmer's desk—read it and you'll write better code. Here are five code-writing concepts:

Class Creation
Building classes is a common programming task that programmers frequently perform incorrectly. Classes, collections of methods that share a given responsibility, usually model real-world objects.

Building Routines
Building good code routines that reduce complexity, make programs easier to read, and avoid code repetition.

Naming Conventions
The way you name the objects that your programs use is the single biggest contributing factor to code readability. The book devotes an entire chapter to showing you how to write variable, class, and routine names that are readable, appropriate, and memorable.

Debugging Techniques
Debugging early in the development cycle can help you test code paths and find logic errors in your code. To help make your debugging more efficient, the new edition presents a scientific method for debugging. You'll learn how to form a hypothesis about an error's source, use testing to prove or disprove your hypothesis, then locate and stabilize the error.

Defensive Coding
Programmers often write code that assumes the data it works with is perfect. While the code might function as it's designed to under typical conditions, it can fail miserably when confronted with bad data or other unexpected conditions. Basically, coding defensively means that you design your code to handle incorrect input and to not pass along bad data. Defensive coding takes significantly more time, but a lack of defensive coding causes poor software quality.

Print | posted on Wednesday, December 15, 2004 11:13 PM |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 4 and 1 and type the answer here:

Other Links

Follow me @twitter

My Recent Posts