22
Sun, Dec
3 New Articles

Documentation - Friend or Foe?

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

You may think the Y2K problem was the biggest blunder of the information economy, or you may think it was unavoidable and cost-justified because of all the storage saved when disk space, memory, and processing power were so expensive. No matter what you think about the Y2K problem, we all learned a valuable lesson having lived through it: Development documentation can make IT projects easier or break them.

Y2K fixes are child’s play to implement. The mammoth task is finding all the places where a change is needed. Good documentation, if we have it, can speed up Y2K fixes considerably because finding Y2K bugs comprises some 50 percent of the Y2K work. In this article, I will share with you some of my thoughts (and experiences) on what good documentation is and how to go about generating it.

Why Is Good Documentation So Rare?

First, I must dispel one key myth about documentation—namely, that documentation is simply commenting code. (When I refer to documentation, I am talking about development documentation, not end-user documentation such as help text or manuals.) I suspect that many developers, if quizzed directly, would quickly acknowledge that there is much more to documentation than good comments, but it is surprising how often the only form of documentation is the comments in the code. Even more surprising is the dubious quality of both the comments and other forms of documentation for the programs companies write. Maybe that’s because of the old saying that “real” programmers don’t write documentation because if the code was difficult to write, it should be difficult to read. However, as hard as it was to write the code, it turns out it’s even harder to change it. Just ask a Y2K project manager.

Joking aside, there are many practical reasons that even the little documentation we sometimes have for an application is of poor quality and of little use:

• Documentation is rarely a part of the project plans and schedules. Partly because it is a user deliverable, partly because it is typically done by specialized personnel (technical writers), end-user documentation is a separate project, while internal documentation remains an implicit item on a developer’s plate. As a result, documentation is the lowest item on the totem pole, even lower than testing. When testing gets squeezed between unrealistic estimates and inflexible schedules, guess what happens to documentation?

• Documentation and code quickly get out of sync. There are two ways this problem can happen. First, some (or all) of the documentation is not where the code is, so the code gets changed, but the corresponding documentation doesn’t. Second, the deadline pressures for code changes are often even higher than for base development and, therefore, are often subject to even less process and scrutiny.

• Documentation is usually written by somebody who knows the code inside and out. As all of us who went to school know, it is one thing to know your stuff and altogether a different thing to explain it well to others. There are two major consequences to that. First, it is hard to separate what one can reasonably assume to be known from what needs to be explicitly stated. Intimate involvement in developing the code tends to raise the number of assumptions, simply because of familiarity with the subject. What is clear to someone who has been working for months on a particular application may not be at all evident to a less seasoned developer. Second, programmers tend to document what a programming statement does rather than what it means. Have you ever seen C code like this?

Counter++; /* Add one to Counter *
Wouldn’t something like this be much better?

Counter++; /* Advance to the next product description */

Four Steps to Better Documentation

Any project is more likely to get done properly when responsibility, which goes hand in hand with accountability, is clearly defined. With that in mind, I recommend the following:

1. Identify documentation deliverables in your project plans. Expectations have to be clearly set. Your development process definition should include a definition of the documentation that must be delivered, and project plans might simply refer to your process description.

2. On your project schedules, identify specific documentation tasks and allocate time for them. Setting aside time on the schedule specifically for documentation helps separate it from programming and indicates that this work will be tracked like any other task.

3. Inspect documentation at all inspection stages just as you do with other project deliverables. All too often, documentation is left until the end of the development cycle on the grounds that code will change anyway. The idea is to save effort by writing the documentation only once, after the code is finalized. Sounds wonderful in theory. In practice, it means you just kissed good-bye any chance of getting decent documentation! Yes, the code will change, so the documentation will need to change, too. Consider this documentation process a dress rehearsal for the many years of application support to come. Programmers need to get used to keeping code and documentation in sync, and diligence in documenting code changes will help structure the documentation in a way that will make maintenance (of both documentation and code) less painful.

4. Involve developers who are unfamiliar with the project in the documentation inspection process. For good and valid reasons, code inspections should be done by developers who understand the code very well. Documentation inspections, however, should be performed by someone outside the project because, invariably, some rookie will end up supporting the application. How easy will it be for this person to understand what the code does? Why not get an early answer to this question rather than wait until you have an emergency to find out? If a separate team in your organization does support, involve them early. Your support team will have to become familiar with the new applications anyway, so it is not a question of if, but it is a question of when.

What Is Good Documentation?

Now that I’ve taken a look at how to get good documentation, it is time to try to answer the age-old question: What exactly constitutes good documentation?

Good documentation is complete, easy-to-maintain application information that helps ensure that changes to the application can be done without causing regression problems.

As I mentioned earlier, many people think documentation means programming comments. However, depending on the nature of the change being contemplated, it is often necessary to understand the general design and even the original requirements for that area of the application. Just about any professional programming shop has requirements and design documents for its code, but how many of those documents are still current a few years down the road? Failing to keep documentation current is a mistake that accounts for a lot of regression problems.

Here are some code change scenarios that could really use requirements and design documents:

• Enhancing performance. Going for performance improvements is always tricky. First, performance-enhancing changes tend to make the code more obscure, more difficult to understand. It is essential to document why the performance enhancement was needed, what changes were made to increase performance, under what assumptions the performance gain will materialize, and what the original code was. Second, since getting better performance usually means changing the way things are done in some fairly fundamental way, it is essential to consult design documents (to understand what implications changing the new design might have elsewhere) and requirements documents (to ensure that the new design will deliver on all the requirements).

• Changing the existing behavior of the application. This is a classic! One person’s bug is another’s feature. Every time I made a requested application change in response to a bug report stating that an application did something wrong, I promptly found somebody crying foul because the old way was better. When you change the behavior of an application, it is particularly important to understand what the originally intended behavior was and whether similar functionality with similar behavior exists elsewhere in the application. The requirements and design documents are invaluable in these cases. Even then, you are likely to be better off implementing a change as an optional behavior, but that’s another story altogether.

• Adding new functionality for additional requirements. This scenario arises frequently if for no other reason than that one way of meeting deadlines is to trim the requirements and leave them for a future release. Chances are that by the time you get around to implementing the leftovers, lots of code will have changed, new people may be working on the product, and so forth. To integrate a new function correctly, it is essential to understand an application’s existing requirements and its design. Unfortunately, reading the code is a very unreliable method for achieving functional understanding of an application!

For these and many other reasons, it is important to have requirements and design documents. It follows, therefore, that maintaining them is important, too.

It is a fact of life that the bulk of the documentation is in the code. This part of the documentation has the advantage of being in front of programmers’ eyes as they work on changing an application, making reading it unavoidable. It is therefore extremely important to make the most of this documentation.

I live by the principle that the best commented code is self-documenting code. The major advantage of self-documenting code is that it keeps code and documentation changes in sync. Self-documenting code is based on the principles of naming conventions and programming standards.

Naming conventions have changed. Most modern programming languages allow very long variable and function names. That’s not only because memory is so cheap these days; it’s also because long names enhance comprehensibility. So don’t be a lazy typist; make use of this capability. A name that fully describes the role of the underlying item may

take longer to type, but it is much easier to understand. A lot can go into a name. Naming conventions can help you understand at a glance where the item is defined (e.g., program module, library, or directory), how the item is defined (e.g., static vs. dynamic storage, local vs. global, or data vs. function type), and how the item is used (e.g., function returning a value, constant, or read-only).

Programming standards help document code in two ways. First, each code structure includes templates that define the basic information to be provided, such as a general description of what the code does, what must hold true for the code to execute correctly (i.e., assumptions), and what will hold true after the code has executed (i.e., results). Second, standard code layouts help the reader understand the code. There is a reason that you can find the fridge at night in the dark. It’s that everything in your house is always in the same place. This aspect of understanding code is frequently ignored, yet research consistently shows that good programming standards, particularly when aided by visual cues (colors, fonts, etc.), can enhance the understandability of code by as much as 20 percent.

Following these suggestions will help you generate good documentation, but it will not cover one essential kind of information about your application: the things learned during application support. This information includes the pitfalls you can fall into and tips on how to avoid them, areas of code that are particularly dangerous (such as certain performance techniques), and other tidbits. This type of information can and should be documented in the code itself, but often enough, there is no good place to put it. A good way to avoid repeating the mistakes of the past is to keep a support checklist with this information and insist that consulting it be part of the support process.

Last, but not least, you need process documentation. Of course, it can be argued that process is not part of the application, but particularly during support activities, following process guidelines can make the difference between chaos and regression-free code fixes and upgrades. A good process may not be enough to ensure quality code changes, but the lack of a good process makes regression problems likely. A good process must also be well-known by its users, and updates to it must be easy to publish and distribute to programmers. That takes us back to the support checklist, which can play one final role. It can be a flowchart on how to make changes to the application, with pointers to various process documents in the proper places, acting, in a sense, as a process map guiding programmers step by step on how to make required changes while avoiding potential traps.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: