Skip to content

Commit 40f7bc1

Browse files
committed
Re-org for images
1 parent cf9c2e5 commit 40f7bc1

File tree

2 files changed

+48
-26
lines changed

2 files changed

+48
-26
lines changed
38.2 KB
Loading

content/2024-08-03-documentation-best-practices.md renamed to content/documentation-best-practices/index.md

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ why a behaviour or a pattern exists, future maintainers might be tempted to drop
3636
Not all types of documentation have the same life cycle. Different pieces of documentation are more or less stable, and this determines
3737
which can act as a conceptual and theoretical foundation for your project.
3838

39-
Examples of stable documentation include:
39+
#### Stable documentation
4040

4141
* A README without code
4242
* A vision statement
@@ -45,8 +45,7 @@ Examples of stable documentation include:
4545
These ought not to change much, because they describe the basic problems that your code aims to address, solve or support in the long run.
4646
While it is normal to fiddle around with the boundaries of your project at the beginning, in general these should change infrequently.
4747

48-
Some other documentation is called volatile, like:
49-
48+
#### Volatile documentation
5049
* Documentation generated at runtime
5150
* Code examples
5251
* Tests
@@ -61,18 +60,38 @@ your project.
6160
> -- Cyrille Martraire, Living Documentation, 2019
6261
6362

64-
As such, here is a simplified model of the documentation cascade for a typical Haskell project, from the most volatile to the most stable
63+
#### Documentation cascade
64+
65+
Here is a simplified model of the documentation cascade for a typical Haskell project, from the most volatile to the most stable
6566
sources:
6667

68+
<img src="images/flow-of-documentation.png" alt="flow of documentation" width=70%>
69+
70+
<details><summary>Code for this diagram</summary>
71+
72+
```mermaid
73+
flowchart TD
74+
A[Docs of your project]
75+
B[Architecture document]
76+
C[Official specs for your domain]
77+
D["Docs of a core library (base, text, containers, etc)"]
78+
E[GHC Manual]
79+
F[Official specs for what the core libraries provide]
80+
G[Papers]
81+
82+
A --> B
83+
A --> D
84+
A --> C
85+
86+
D --> E
87+
D --> F
88+
D --> G
6789
```
68-
Haddocks of your library or a third-party library
69-
├──> Official specs for your domain
70-
├──> Architecture Document
71-
└─┬> Haddocks of a core library (base, text, vector, etc)
72-
├──> GHC Manual
73-
├──> Official specs for what the core libs provide
74-
└──> Papers (without paywalls)
75-
```
90+
</details>
91+
92+
> The Haddocks of your library or a third-party library have a dependency on the official specs for the domain, on an architecture document,
93+
> and on haddocks from the core libraries (`base`, `text`, `containers`, etc.).
94+
> The haddocks of these core libraries depend on the GHC manual, official specs for their own domain, and papers.
7695
7796
Keep in mind that while the Haddocks of a project can refer to the project specs, or to an architecture document, these documents should
7897
never refer to the project's current implementation. If you must refer to the code, point to where it's located.
@@ -91,31 +110,34 @@ The [Haddocks for the `Set` datatype](https://hackage.haskell.org/package/contai
91110
(from the `containers` library) are an example of documentation which follows this model well:
92111

93112
* They point to an overview of the API ([here](https://haskell-containers.readthedocs.io/en/latest/set.html): _volatile_)
94-
* They refer to the papers that have informed the design of its implementation: the absence of working links may be annoying,
95-
but the references can still be followed (_stable_)
113+
* They refer to the papers that have informed the design of its implementation (_stable_)
96114

97115
### Understand for whom you write
98116

99-
This section introduces the Diátaxis Framework for documentation:
117+
It is of utmost importance that documentation answers the needs of the users, and for that we must understand these needs.
118+
Users need specific kinds of documentation depending on the situation they are in.
100119

101-
<img src="https://diataxis.fr/_images/diataxis.png" width=100%>
120+
A common framework used for the classification of documentation is the Diátaxis Framework. It defines four types of documentation
121+
where each are a combination of _Acquisition_ or _Application_, and _Action_ or _Cognition_.
102122

103-
> -- Diátaxis Framework, by Daniele Procida, https://diataxis.fr
123+
If a new user in need of actively acquiring some practice with the project, they can safely be pointed to the "Tutorials" part
124+
of your documentation: it is the part that focuses on "_Acquisition_" of knowledge through "_Action_".
125+
The focus of the tutorial is to make a prospective user acquire basic competence in handling the software: It is an ice-breaker.
104126

127+
However someone who is in need of a deeper – but perhaps less immediately applicable understanding of the project –
128+
will be better served by the Explanation, which serves the need for thought (or _Cognition_)
105129

106-
Diátaxis maps out the entire life cycle of one’s interaction with a system. Each of its four quadrants describes a different
107-
situation in which a user may find themselves.
130+
Here is the quadrant:
108131

132+
<img src="https://diataxis.fr/_images/diataxis.png" width=100%>
109133

110-
Diátaxis is not just about filling out all the quadrants like a checklist (although they are all good to have!).
111-
Instead, it is about understanding how each section focusses on a particular combination of user needs and situations.
112-
If a new user in need of actively acquiring some practice with the project, they can safely be pointed to the "Tutorials" part
113-
of your documentation, as it is the part that focuses on "_Acquisition_" of knowledge through "_Action_".
114-
The focus of the tutorial is to make a prospective user acquire basic competence in handling the software. It is an ice-breaker.
134+
> -- Diátaxis Framework, by Daniele Procida, https://diataxis.fr
115135
116-
However someone who is in need of a deeper – but perhaps less immediately applicable understanding of the project –
117-
will be better served by the Explanation, which serves the need for thought (or _Cognition_)
118136

137+
Diátaxis maps out the entire life cycle of one’s interaction with a system.
138+
139+
But is not just about filling out all the quadrants like a checklist (although they are all good to have!).
140+
Instead, it is about understanding how each section focuses on a particular combination of user needs and situations.
119141

120142
In short, the message of Diátaxis is that you are not meant to write The One Documentation that covers everything —
121143
inevitably, this produces documentation which is shallow due to its breadth. Instead, focus on the strategic aspects of your documentation,

0 commit comments

Comments
 (0)