We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Technology

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is Program Comprehension?

By Jessica Susan Reuter
Updated: Feb 04, 2024
Views: 7,505
Share

Program comprehension is the ability of a programmer to understand what a computer program's source code does. In computer science instruction, comprehension of a program is frequently overlooked in favor of learning the mechanics and syntax of the computer language being taught. Writing comprehensible code, however, is a universal need, regardless of the computer language in which it is written. If a programmer writes a library or piece of code, but no one can determine what it does afterward, the algorithm and logic behind that code can easily be lost. It is increasingly common that programmers cannot decipher their own code, since it often isn't written clearly and intuitively.

There are two main strategies programmers can use to improve program comprehension, and each has its own advantages and drawbacks. The first method is to add documentation to code during or after code creation, and the second is to write code with an emphasis on its structure. A combination of both approaches is helpful to most programmers, although there are some code builders who prefer one strategy over another. Which method to use is a matter of personal preference by the programmer, and any attempt to clarify code is far better than none at all.

Adding documentation to code is the simpler of the two methods, and when done well it can be a very useful crutch to a programmer unfamiliar with the language the code is written in. Most computer languages have a specific documentation style to aid in program comprehension. If code documentation is written thoroughly, a new programmer's first step can be to read all the documentation and comments to gain an understanding of how the program works, without having read the code at all. Instead of being dependent on the code syntax and mechanics, the programmer can see what is happening in plain text, then relate the text to precisely what is happening at any given place. When adding documentation to code, however, programmers must be cautious, because too much documentation can be confusing and intrusive, rather than helpful.

When writing code with an emphasis on structure, a programmer assumes that any other maintainers looking at his or her code will have an equivalent knowledge of the language's syntax and mechanics. Sometimes, this is a valid assumption, but it cannot always be relied upon. Program comprehension based largely on structure is possible, but it takes significantly more work on the part of the original programmer to facilitate it. The mechanics and syntax of the language must be followed exactly, as well as all stylistic conventions, and everything must be consistent. When writing code this way, a programmer must always be conscious that what is clear to him may not be clear to another person.

Even when writing code with an eye for later program comprehension, additional documentation or structural modifications may be needed later. This is a natural part of code maintenance, and not a failure at the hands of the programmer. A programmer's job is to anticipate as many comprehension problems as possible, but all of them are not always caught.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Editors' Picks

Discussion Comments
Share
https://www.wise-geek.com/what-is-program-comprehension.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.