Business Comments on Coding

by Tom Urbanowicz

Have you used Version 1.0 of any software application lately? As business needs, technology, and market trends change, so do the supporting programs. In some cases, the team initially developing an application is not the same to maintain it. From a business perspective, this means that you need developers who consider future maintenance and development. There are at least two ways programmers can help your business for the future: creating thoughtfully-constructed programming code and clearly documenting that code.

First, in scripting and programming languages, developers can include comments that describe the action occurring in the code. This textual information is invisible for application users, but can be invaluable for developers to understand what is occurring programmatically. Consider an oversimplified coding example from a financial application:

IF ($value1 > $value2) THEN PRINT "Warning: $value1 is larger."

Depending on the developer, you may get different comments about what is occurring. Vague Vinnie gives comments that sound busy, but they read like some esoteric text: "User notification of value evaluation." Useless Ulysses' summary reads like some Hemmingway novels: "Compare and print." Techy Tammy explains the programmatic logic, but not always very clearly: "Variable comparison and resultant display message." However, the thoughtful comments of Bonnie Business are most helpful. She understands the code and the business logic behind it. "Compare withdrawal and deposit amounts. Warn user if withdrawal is larger."

If valuable comments are included, it will help developers to understand how to make modifications to the code without breaking other areas of the application. Long-term, this saves your business resources. Comments reduce development time spent in investigation, user downtime from newly-introduced errors, and potential errors.

Second, scripting and programming code can be neatly organized to be easy to follow. Consider that your business needs a product catalog web site of 10 pages. Though it will have a consistent layout, the content describing each product will vary from page to page. Because you have endless money and a strange sense of humor, you hire two developers to produce the same thing.

Modular-Monica works with small sections of code. She isolates the logic for the pages' navigation bar, header, and footer sections. She also separates out commonly-used functions that each of the pages can use (such as displaying a world clock). She creates a database to store the product information. Finally, she creates one "lean" master page that seamlessly ties all these sections together in the web site-showing the header, footer, navigation bar, clock, and selected product details. Of course, her code includes thoughtful comments.

Spaghetti-Code-Slim prefers to code as he goes. First off, he's not going to bother with a product database. "After all, it's only 10 pages" he assures himself. Plus, he reckons that he can make one master page and then simply copy and paste what he needs for the other nine; he'll change the unique product information along the way. When Slim is done, he also ends up with 10 web pages with a professional appearance. Behind the scenes however, the code is a nightmare for another developer to follow. Trying to follow the logic is like tracking a noodle on a heaping plate of spaghetti.

After a week, both Monica and Slim hand off the completed web sites. Both work equally well and appear internally consistent. Now imagine their different responses when you say: "I really like it, but I've got an updated graphic for you to use in the header. Also, can you make the color of the navigation bar to not be so dark? Finally, since you did so well on this phase, I've got another 40 products I'd like you to add." For Monica, these changes can be implemented efficiently with minimal risk of introducing errors. For Slim, he's got to hop back in the saddle again and try not to cut something he should've been pasting.

The true business value of Monica's work is magnified when Slim is no longer available to maintain the web site. When you introduce another developer like Monica, that's when you may hear the words: "I think the website needs an architecture change."

An eloquent conclusion on the importance of well-constructed code with clear comments is provided by computing expert Richard Gabriel in his book, Patterns of Software. He writes: "Programs are written and maintained, bugs are fixed, features are added, performance is tuned, and a whole variety of changes are made both by the original and new programming team members . . . What is important is that it be easy for programmers to come up to speed with the code, to be able to navigate through it effectively, to be able to understand what changes to make, and to be able to make them safely and correctly."

Don't order spaghetti . . .

Tom Urbanowicz is the owner of DataDesignIT, helping businesses operate efficiently and communicate effectively. Tom can be reached at tom@datadesignit.com or at 530.513.1691.