<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Self-documenting_code</id>
	<title>Self-documenting code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Self-documenting_code"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Self-documenting_code&amp;action=history"/>
	<updated>2026-05-04T20:26:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Self-documenting_code&amp;diff=1725438&amp;oldid=prev</id>
		<title>204.107.153.65: Removed an uncited claim from 7 years ago. The usage described doesn’t align with the rest of the article, and I’ve never encountered it used that way.</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Self-documenting_code&amp;diff=1725438&amp;oldid=prev"/>
		<updated>2025-04-16T18:31:42Z</updated>

		<summary type="html">&lt;p&gt;Removed an uncited claim from 7 years ago. The usage described doesn’t align with the rest of the article, and I’ve never encountered it used that way.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Source code written to enable use by others without prior experience}}&lt;br /&gt;
{{Refimprove|date=March 2020}}&lt;br /&gt;
{{Use dmy dates|date=March 2020|cs1-dates=y}}&lt;br /&gt;
In [[computer programming]], &amp;#039;&amp;#039;&amp;#039;self-documenting&amp;#039;&amp;#039;&amp;#039; (or &amp;#039;&amp;#039;&amp;#039;self-describing&amp;#039;&amp;#039;&amp;#039;) [[source code]] and [[user interface]]s follow [[naming conventions (programming)|naming conventions]] and [[structured programming]] conventions that enable use of the system without prior specific knowledge.&amp;lt;ref name=&amp;quot;Schach_2011&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Objectives==&lt;br /&gt;
Commonly stated objectives for self-documenting systems include:&lt;br /&gt;
&lt;br /&gt;
* Make source code easier to read and understand&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;/&amp;gt;&lt;br /&gt;
* Minimize the effort required to maintain or extend legacy systems&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;/&amp;gt;&lt;br /&gt;
* Reduce the need for users and developers of a system to consult secondary documentation sources such as [[Comment (computer programming)|code comments]] or [[software manual]]s&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;/&amp;gt;&lt;br /&gt;
* Facilitate [[automation]] through self-contained [[knowledge representation]]&lt;br /&gt;
&lt;br /&gt;
==Conventions==&lt;br /&gt;
Self-documenting code is ostensibly written using human-readable names, typically consisting of a phrase in a human language which reflects the symbol&amp;#039;s meaning, such as &amp;#039;&amp;#039;article.numberOfWords&amp;#039;&amp;#039; or &amp;#039;&amp;#039;TryOpen&amp;#039;&amp;#039;. The code must also have a clear and clean structure so that a human reader can easily understand the algorithm used.&lt;br /&gt;
&lt;br /&gt;
==Practical considerations==&lt;br /&gt;
There are certain practical considerations that influence whether and how well the objectives for a self-documenting system can be realized.&lt;br /&gt;
&lt;br /&gt;
* uniformity of [[naming convention (programming)|naming conventions]]&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;/&amp;gt;&lt;br /&gt;
* consistency&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;/&amp;gt;&lt;br /&gt;
* scope of the application and [[system requirements]]&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Below is a very simple example of self-documenting [[C (programming language) | C]] code, using naming conventions in place of explicit comments to make the logic of the code more obvious to human readers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
size_t count_alphabetic_chars(const char *text)&lt;br /&gt;
{&lt;br /&gt;
    if (text == NULL)&lt;br /&gt;
        return 0;&lt;br /&gt;
&lt;br /&gt;
    size_t  count = 0;&lt;br /&gt;
&lt;br /&gt;
    while (*text != &amp;#039;\0&amp;#039;)&lt;br /&gt;
    {&lt;br /&gt;
        if (is_alphabetic(*text))&lt;br /&gt;
            count++;&lt;br /&gt;
        text++;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return count;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Criticism ==&lt;br /&gt;
[[Jef Raskin]] criticized the belief in &amp;quot;self-documenting&amp;quot; code by saying that code cannot explain the rationale behind why the program is being written or why it is implemented in such a way.&amp;lt;ref name=&amp;quot;Raskin_2005&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Autological word]]&lt;br /&gt;
* [[Code readability]]&lt;br /&gt;
* [[Comment (computer programming)]]&lt;br /&gt;
* [[Controlled natural language]]&lt;br /&gt;
* [[Literate programming]]&lt;br /&gt;
* [[Natural language programming]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Schach_2011&amp;quot;&amp;gt;{{cite book |first=Stephen R. |last=Schach |title=Object-Oriented and Classical Software Engineering |url=https://archive.org/details/objectorientedcl00scha_416 |url-access=limited |edition=8 |publisher=[[McGraw-Hill Professional]] |date=2011 |pages=[https://archive.org/details/objectorientedcl00scha_416/page/n525 505]–507 |isbn=978-0-07337618-9 |oclc=477254661}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Raskin_2005&amp;quot;&amp;gt;{{cite journal |author-first=Jef |author-last=Raskin |author-link=Jef Raskin |title=Comments Are More Important Than Code - The thorough use of internal documentation is one of the most-overlooked ways of improving software quality and speeding implementation. |series=Development |date=2005-03-18 |volume=3 |issue=2 |journal=[[ACM Queue]] |publisher=[[ACM, Inc.]] |url=https://queue.acm.org/detail.cfm?id=1053354 |access-date=2019-12-22 |url-status=live |archive-url=https://web.archive.org/web/20200324185056/https://queue.acm.org/detail.cfm?id=1053354 |archive-date=2020-03-24}} [https://web.archive.org/web/20050505065105/http://acmqueue.com/modules.php?name=Content&amp;amp;pa=showpage&amp;amp;pid=290&amp;amp;page=1][https://dl.acm.org/ft_gateway.cfm?id=1053354&amp;amp;ftid=300937&amp;amp;dwn=1]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Paul_2002_Symbols&amp;quot;&amp;gt;{{cite web |title=Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1 |author-first=Matthias R. |author-last=Paul |work=freedos-dev |date=2002-04-09 |url=https://marc.info/?l=freedos-dev&amp;amp;m=101832534205646&amp;amp;w=2 |access-date=2020-03-24 |url-status=live |archive-url=https://web.archive.org/web/20200324184426/https://marc.info/?l=freedos-dev&amp;amp;m=101832534205646&amp;amp;w=2 |archive-date=2020-03-24 |quote=[…] almost any numeric value in source code should be replaced by a corresponding symbol. This would greatly improve the self-explanatory aspect of source code and significantly ease maintenance of the code in the long run, as it would enable one to search for symbols to find relations between different excerpts of the code. […]}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* {{cite book |author-first=Steve |author-last=McConnell |author-link=Steve McConnell |chapter=High Quality Routines checklist |title=Code Complete |title-link=Code Complete |chapter-url=http://cc2e.com/Page.aspx?hid=218}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Computer programming]]&lt;br /&gt;
[[Category:Software documentation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Compu-lang-stub}}&lt;/div&gt;</summary>
		<author><name>204.107.153.65</name></author>
	</entry>
</feed>