Living Documentation

Tu ne le sais pas encore, mais tu l’as deja documenté!

Thanks

Who am I?

marc bouvier rnd 25

Marc Bouvier u.baldir.fr/me

⚠️ Disclaimer

Cette présentation contient des démos foireuses

Au préalable quelques questions

  • Es-tu satisfait de la documentation que tu produis?

  • Quand tu lis de la documentation, est-ce que tu as peur qu’elle soit obsolète?

  • Quand tu utilises des composants tiers est-ce que tu aimerais que leur documentation soit meilleure?

  • Est-ce que tu penses que le temps passé à écrire de la documentation pourrait être mieux utilisé?

La documentation, dans votre contexte actuel…​

Word Cloud

Agenda

  1. The Story of an onboarding

  2. Living Documentation FTW

  3. A ton of examples!

  4. Some Takeaways

An onboarding story

Joining an hypothetical organisation as a consultant

Welcome!

  • Meet with colleagues

  • Fetch laptop

  • You have E-mail 📧

🎉

You shall not pass!

  • No Git credentials…​ yet

  • "It will take some time"

  • Go explore "The Wiki"

  • A shared folder with MS Office files

A ticket for space

  • A ticket for MS Office Licence

  • Browsing "The Wiki"

  • A typo

Trying to help

  • Cannot edit page

  • "Just add a comment to it, we’ll fix it later"

    • Spoiler: it wasn’t

Can’t touch this

  • No license available

  • Human PDF converter 👩🏻‍💻🖨

  • Wrong version

  • "Nobody really reads it anyway"

What’s inside?

  • Windows XP IE9 screenshots…​ 🦖

    • .. in 2020

  • Maybe a little outdated

Git me that source code!

  • Finally Git credentials!

  • Tech stack evolved a lot since spec

    • Versions bumped

    • Even framework is not the same

Folder Structure

Screenshot 20220517 105047
Screenshot 20220517 105103
Screenshot 20220517 105118

Visiting Printers Factories

  • It’s about..

    • Vistors

    • Printers

    • Factories

    • Strategies?…​

Colleague Driven Development

  • Aren’t we in banking business?

  • Design Patterns?

Welcome to the cult!

  • Naming Convention

  • "Technical separation: Tidy!"

  • A reason?

  • "We do it everywhere"

Are we in business?

  • Where is the business

  • "Inside the subfolders scattered around"

Testabili.. what?

  • Must be hard to test?

  • "Well, we tried, but they were always broken"

  • We do End 2 End but they are flaky

    • We hired someone full-time to maintain them

The rewards of hard work

  • "Worth the effort, it tests some behavior"

  • Business complaints about human readability

    • Click

    • Forms

    • Fields

And featuring…​

  • What are the features?

  • "I do caching related stuff, and some DB related stuff"

  • But Business features

  • "We have user stories in Jira tickets, it’s all there"

…​

Astonishment report

Newcomers are great to see what’s missing

What do you think?

Word Cloud

The problem with traditional documentation

Not very reliable

  • Usually external documents

  • Not in sync with the system

  • Versioning hell

Separate activities

Specs 👨‍💼

Code 👩‍💻

️Tests 🕵️‍

Doc 👩‍🏫

Even in Agile teams!

Requires Human dedication

  • A pain to update

  • Requires special tooling

  • Boring manual transcription

Manual transcription

Developer trying to layout code in MS Office

Meme of a crying girl doing her homework.

Do we read it?

  • No one really reads it cover to cover

  • Not easy to engage conversations with

What does it tell us?

  • What the system should have been

  • When it was written

  • Often by a different person

By the way…​

🧐

What is Documentation?

Sharing knowledge

When?

Knowledge needed for a long period of time?

→ Documented

Knowledge needed by a large number of people

→ Documented

Knowledge valuable or critical

→ Documented

Default

Don’t

Generic Knowledge

  • Programming languages

  • Developer tools

  • Software practices

    • DDD

    • patterns

    • CI

  • Mature sector of the business industries

    • Pricing in finance

    • Supply Chain Optimization in e-commerce

    • → Industry standard books

Good news everyone!

The Generic Knowledge is already documented in the industry literature.

→ Learn Generic Knowledge

→ Link to sources of Authority

  • Training

  • Conferences

  • Books

  • Blog posts

  • Standard Vocabulary

…​

Focus on specific knowledge

  • Not (yet) shared with other peers in the same industry.

  • More expensive to learn

  • That takes practice, making mistakes to earn

  • That Deserves more attention

  • Only you can take care about it

Stable vs Unstable

Stable

  • Standards

  • Most of parts of common industry

Not Stable

  • Marketing

  • Company names

  • Dates

  • People

  • Design decisions

How to deal with Stable/Unstable?

Stable

Learn & refer to it

Unstable

Automate it as much as possible when it is useful

Internal vs External

Internal

  • Code

  • Tests

  • Manifests

  • Wiki as code

External

  • External Wiki

  • Ms Office documents

  • Project management tools

Problems with Internal Knowledge

  • Not accessible

  • To many (noise)

  • Scattered everywhere

  • Implicit (e.g. design pattern visible only if we know it exists)

  • Unrecoverable (lost)

  • Unwritten

Augment it, make it accessible for it’s audience.

Stable • Evergreen document

Useful content for a long period of time

  • Short with not much details

  • High Level focus

  • Goals and intention (not implementaion details)

  • More business oriented that technical

Here traditional documentation is OK 👍

It’s already there!

Source Code

  • File names

  • Classes, functions, variables names

  • Folder arborescence

Test Code

  • Automated tests

    • File names

    • Tests names

    • Tests methods names

    • Tests datasets

Colleagues

  • Conversations

  • On their machine

Code documentation : Java

  • Javadoc

    • Comments → website

    • Comments → contextual doc in IDE

Code documentation : Dotnet

  • Xml documentation

    • Comments → website

    • Comments → contextual doc in IDE

    • Generators: DocFX, Sandcastle, Doxygen

Code documentation : JS / TS

  • Jsdoc

    • Comments → website

    • Comments → contextual doc in IDE

Dependencies Manifests

  • Java : Maven / Gradle

  • Js/TS : package.json

  • Dotnet : .csproj .fsproj or .vbproj

Infrastructure Configuration

  • docker-compose.yml

  • Helm charts

  • Terraform

  • Ansible

Pipeline configuration

  • .gitlab-ci.yml

  • Github Actions

The product itself

  • UX

  • Help section

  • Tooltips

Monitoring and traces

  • Exceptions & errors traces

  • Database logs

  • Ticket / Bugs backlog

Tooling outputs

  • git history

  • Task management tools activity

Living Documentation

Helps…​

  • Improving Onboarding Experience 🛥

  • Understanding systems and improving them

  • Communicating better (less misunderstandings) 🗣

  • To build the right things

  • Your team’s morale

  • Against Truck factor anxiety 🚛

  • Reduce Turnover rate

  • Reduce Bugs because of knowledge ignorance

  • Reducing Time writing documentation

  • Reducing time to look for something in documentation

  • Reducing context switching …​

Core Principles of Living Documentation

  • Reliable

  • Low-Effort

  • Collaborative

  • Insightful

Reliable

  • Exploit available knowledge

    • In code, artifacts, tools

  • Accuracy mechanism

    • To make sure knowledge is up to date

Low-Effort

  • Simplicity

  • Standard over custom

  • Evergreen content

  • Refactoring proof Knowledge

  • Internal Documentation

Collaborative

  • Favors conversations over formal documentation

  • Collective Ownership

Insightful

  • Deliberate decision making

  • Embedded learning

  • Reality check

Examples?

I can has cheezburger happy cat meme

Source Code Itself

Conventions, Idioms 🥷

⚠️ Redundant information in naming

Reduce useless noise

Repeated informations

package org.mycompany.worlddestroyer;
/**
* The implementation of the Death Star. (1)
* @author Joe@empire.org (2)
*/
public class DeathStarImpl (3)
             implements DeathStarInterface (4)
{}
  1. Tells nothing more than the class signature

  2. In internal projet, maybe rely on version control history

  3. Of course it is an implementation

  4. Of course it is an interface

Which is more readable?

Domain Driven Design

  • Ubiquitous Language

Domain Specific Languages

  • Code that reads like prose

  • Fluent interfaces

Test Code

BDD Test naming

  • You don’t need more than your testing lib

  • But some features can help

    • Nesting

    • Parameterized tests

BDD Naming examples

class Agile_tour_speaker_should{
  @Test
  void share_screen_to_streamyard(){

    given_a_speaker_ready_to_speak();

    when_the_talk_has_started();

    then_Philippe_is_not_yelling_a_the_speaker();
  }
}

Pick the style you want but make sure it is readable by non technical people

Gherkin Features

Feature: Agile Tour speaker

    Scenario: Share screen to streaming service

        Given A speaker ready to speak.
        When The talk has started
        Then Philippe is not yelling at the speaker

Only Business language (no technical)

Reconciliation mechanisms

Publication mechanisms

  • Pickles

  • Cucumber studio

  • Specflow+ LivingDoc

…​

Test + Docs as test

Doctest

  • Python Doctest

  • Elixir Doctest

  • Rust Documentation test

  • Go Test Examples

Input (Python) 🥷

def sum(a, b):
    """
    Adds two numbers.

    >>> sum(2,2)
    5
    """
    return a + b


if __name__ == "__main__":
    import doctest

    doctest.testmod()

Output (Doctest)

***********************************************************
File ".../python_doctest/sum.py", line 5, in __main__.sum
Failed example:
    sum(2,2)
Expected:
    5
Got:
    4
***********************************************************
1 items had failures:
   1 of   1 in __main__.sum
***Test Failed*** 1 failures.

Input (Elixir) 🥷

defmodule Num do
    @moduledoc """
    Operations on numbers
    """
    @doc """
    Adds 2 numbers
    ## Examples
        iex> Num.sum(2, 2)
        5
    """
    def sum(a, b) do
        a + b
    end
end

Output (mix test)

mix test
Compiling 1 file (.ex)

  1) doctest Num.sum/2 (1) (NumTest)
     test/num_test.exs:3
     Doctest failed
     doctest:
       iex> Num.sum(2, 2)
       5
     code:  Num.sum(2, 2) === 5
     left:  4
     right: 5
     stacktrace:
       lib/num.ex:11: Num (module)

Finished in 0.02 seconds (0.00s async, 0.02s sync)
1 doctest, 1 failure

Input (Rust) 🥷

/// Adds two numbers together:
/// ```
/// # use documentation_test_rust::add;
/// let c = add(2, 2);
/// # assert_eq!(c, 5);
/// ```
pub fn add(a: i32, b: i32) -> i32 {
  return a + b;
}

Output (go test)

   Doc-tests documentation_test_rust

running 1 test
test src/lib.rs - add (line 2) ... FAILED

failures:

---- src/lib.rs - add (line 2) stdout ----
Test executable failed (exit code 101).

stderr:
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `5`', src/lib.rs:6:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



failures:
    src/lib.rs - add (line 2)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.18s

error: test failed, to rerun pass '--doc'

Input (Go) 🥷

num.go
package num

func Sum(a int, b int) int {
	return a + b
}
num_test.go
package num

import "fmt"

func ExampleSum() {
	fmt.Println(Sum(2, 2))
	// Output: 5
}

Output (go test)

--- FAIL: ExampleSum (0.00s)
got:
4
want:
5
FAIL
exit status 1
FAIL    doctest_golang  0.303s

Java 18 Javadoc Code Snippets 🥷

Input • Production code

Javadoc @snippet tag

package fr.baldir.samples.hello;

public class Hello {
    /**
     * Greets someone.
     * <p>Usage</p>
     * {@snippet class="snippets.SnippetTest" region="test-region"}
     *
     * @param name target of greetings
     * @return full greeting sentence
     */
    public String sayHello(String name) {
        return "Hello " + name;
    }
}

Tests

package snippets;

import fr.baldir.samples.hello.Hello;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class SnippetTest {

    @Test
    public void someTest() {
        // @start region="test-region"
        Hello hello = new Hello();
        var greetings = hello.sayHello("JEP 413");
        // @end
        Assertions.assertThat(greetings).isEqualTo("Hello JEP 413");
    }
}

Output

Architecture Tests

ArchUnit test code

layeredArchitecture()
.layer("Controller").definedBy("..controller..")
.layer("Service").definedBy("..service..")
.layer("Persistence").definedBy("..persistence..")
  .whereLayer("Controller").mayNotBeAccessedByAnyLayer()
  .whereLayer("Service").mayOnlyBeAccessedByLayers("Controller")
  .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service")

Interlude

Tools to get insight from code

Word Cloud 🥷

From your code

A word cloud generated from java source code.
  • Do you see mainly domain related names?

  • Or technical related names?

Embedded learning 🥷

  • Code metadata

    • Easily searchable Grepable by tools

    • Conversation starter (better than preaching)

Good Example

@GoodExample

Bad Example

@BadExample

Living glossary

  • Generated from code

  • Make Business Knowledge accessible

  • Makes knowledge mistmatch visible

  • Leads to Ubiquitous Language

Input • Code

Java files with marker annotations (ex. @Aggregate, @Entity). Inspiration for such annotations are shown in Patternity by Cyrille Martraire.

ShoppingCart.java

Input • Code

package com.organisation.domain.order;
/**
 * A shopping cart blah blah blah.
 */
@Aggregate
public class ShoppingCart{
    // ...
}

Input • Code

ShoppingCartItem.java

package com.organisation.domain.order;
/**
 * An item that is hold the shopping cart to be ordered.
 */
@Entity
public class ShoppingCartItem{
    // ...
}

Output • Markdown

# Order

[Link](/src/main/java/com/organisation/domain/order/)

## Shopping Cart

A shopping cart blah blah blah.

[Link](/src/main/java/com/organisation/domain/order/ShoppingCart.java)

### Shopping Cart Item

An item that is hold the shopping cart to be ordered.

[Link](/src/main/java/com/organisation/domain/order/ShoppingCartItem.java)

Diagram as code

  • PlantUml

  • MermaidJs

  • Ditaa

  • Graphviz

…​

MermaidJs

graph TD;
    A-->B;
    D-->B;
    A-->C;
    C-->D;

Mermaid graph output

PlantUml

@startuml

[*] --> State1
State1 --> [*]
State1 : this is a string
State1 : this is another string

State1 -> State2
State2 --> [*]

@enduml

plantuml example

Ditaa Input

                   +-------------+
                   | Asciidoctor |-------+
                   |   diagram   |       |
                   +-------------+       | PNG out
                       ^                 |
                       | ditaa in        |
                       |                 v
 +--------+   +--------+----+    /---------------\
 |        | --+ Asciidoctor +--> |               |
 |  Text  |   +-------------+    |   Beautiful   |
 |Document|   |   !magic!   |    |    Output     |
 |     {d}|   |             |    |               |
 +---+----+   +-------------+    \---------------/
     :                                   ^
     |          Lots of work             |
     +-----------------------------------+

Ditaa Output

Why it is useful?

  • May be supported in some tools

    • Previews in IDE

    • Gitlab/Github/Azure DevOps supports mermaidjs

  • Most of the time focus on content and not layout

  • It’s plain text

    • Easy to version

    • Can be generated from code

Code Analysis

  • Static code Analysis

    • Sonarlint / Sonarqube / Sonarcloud

    • Linters

  • IDEs

  • CI/CD Tools

Input

  • Code

  • Tooling configuration

Output

  • Aggregated Data

  • Visualizations

  • Hints, Warning

  • Learning material

EsLint

Eslint demo
Detail of EsLint rule : No unused variables
  • Detects smells

  • Extensible

  • Quick fixes

Sonarlint in IDE 🥷

Dependency security analysis in IDE

Screen capture of IntelliJ Dependencies security Analysis tooltip on maven dependencies

Gitlab Security Analyzers Input

  • Source Code

  • .gitlab-ci.yml configuration

include:
  - template: "Security/SAST.gitlab-ci.yml"
  - template: "Security/Dependency-Scanning.gitlab-ci.yml"
  - template: "Security/Secret-Detection.gitlab-ci.yml"

[background-color="#3942b0"] 🥷 === Gitlab Security Analyzers Output

  • Pipeline report artifacts

    • Json files, Generated Html

  • Security Dashboard

Gitlab Vulnerability Report 🥷

Screenshot of Gitlab vulnerability report. 6 critical$$

Gitlab Dependencies List 🥷

Screenshot of Gitlab dependencies list. Among the list some go mudules and a lot of javascript dependencies

Guided Code Tour

VsCode Code Tour Extension

  • CodeTour VsCode extension

  • Source Code

VsCode Code Tour Output

  • Json File (machine-readable)

{
    "$schema": "https://aka.ms/codetour-schema",
    "title": "Frontend basic tour",
    "steps": [
      {
        "file": "js/public/index.html",
        "description": "## Html entry point : `public/index.html`\n\nThis `public/index.html` is the first file that is loaded by the browser. \nIt loads the bundled VueJs application as a script.\nThe rendering of the application is then delegated to javascript.\n\nThe VueJs app is \"injected\" inside the `<div is=\"app\"></div>` element.\n\nThe bundled javascript script will be inserted in the `index.html` file in place of the comment : `<!-- built files will be auto injected -->`",
        "line": 19,
        "selection": {
          "start": {
            "line": 20,
            "character": 5
          },
          "end": {
            "line": 20,
            "character": 47
          }
        },
        "contents": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\" />\n    <link rel=\"icon\" href=\"<%= BASE_URL %>favicon.ico\" />\n    <meta name=\"server-injected-data\" />\n  </head>\n\n  <body>\n    <noscript>\n      <strong\n        >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work\n        properly without JavaScript enabled. Please enable it to\n        continue.</strong\n      >\n    </noscript>\n    <div id=\"app\"></div>\n    <!-- built files will be auto injected -->\n  </body>\n</html>\n"
      }
    ],
    "isPrimary": true,
    "description": "A quick overview of how browsing to the default URI translate to VueJs components and behaviours",
    "ref": "09cc5d1bd1ecd24e1e879b0392cf5830b2581c74"
  }

VsCode Code Tour Output

  • Interactive Tour in Vs Code

Animated demo of a guided tour using Vs Code Code Tour extension

Custom Generated Output

Annotations Based Guide Tour

  • Custom Annotations (Meta-data)

    • @GuidedTour(1)

Asciidoc include Code Tour

  • Comments + Asciidoc

Intuitive workflow in REST API

Interlude

Conversations

Coffee machine talks

Drawing of a developper talking with an user at the coffee machine

Code Review

Code review

Pair Programming

Pair programming

Mob programming

Mob programming

3 amigos

Drawing : 3 Amigos. An informal meeting between Business Tester and Developper to define a feature by discovering concrete examples and dataset to verify them.

Notebooks 🥷

Mix markup and code and you obtain interactive notebooks

Input / Output

Mixed Markdown and code

Screenshot of an Jupyter Notebook mixing markdown sections, python code and data vizualisation

Design System

  • Combines both

    • UI component showcase

    • Executable Technical Documentation

Design Systems Examples

  • Clever Cloud UI Components

  • Systeme de design du gouvernement français

cc-map

cc-map

Making of This Presentation

Presentation as code…​

this

...

…​ can be very interactive

...

How? 🥷

  • Included code snippets are real sources

  • AsciiDoctor

  • RevealJs

include::../examples/doctest/python_doctest/sum.py

Interlude

VCS as a source of Knowledge

Doctor Who Tardis time machine animation

Commit messages…​

Good commit messages

Tells the WHY

Conventional Commit

The template

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Example 1

feat: allow provided config object to extend other configs

BREAKING CHANGE: `extends` key in config file is now used for extending other config files

Example 2

docs: correct spelling of CHANGELOG

Generate Changelog

  • Conventional Changelog

Git "blame"

  1. is the new @author

Your code as a crime scene

README : From markdown …​

…​ To Webpage

Wiki as code

VueJs propose de mettre à jour sa documentation par PR

Anyone can contribute with a pull request

Wiki for onboarding

Warm welcome

Capture of Dan North’s

Warm welcome

Interlude

ADR

Architecture Decisions Records

Input

  • Markdown / Asciidoc / PLain text

  • Templates

  • helpers tools

Input markdown example

# Use Markdown Architectural Decision Records

- Status: accepted
- Date: 2020-09-24

## Context and Problem Statement

We want to record architectural decisions made in this project.
Which format and structure should these records follow?

## Considered Options

- [MADR](https://adr.github.io/madr/) 2.1.2 with Log4brains patch
- [MADR](https://adr.github.io/madr/) 2.1.2 – The original Markdown Architectural Decision Records
- [Michael Nygard's template](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions) – The first incarnation of the term "ADR"
- [Sustainable Architectural Decisions](https://www.infoq.com/articles/sustainable-architectural-design-decisions) – The Y-Statements
- Other templates listed at <https://github.com/joelparkerhenderson/architecture_decision_record>
- Formless – No conventions for file format and structure

## Decision Outcome

Chosen option: "MADR 2.1.2 with Log4brains patch", because

- Implicit assumptions should be made explicit.
  Design documentation is important to enable people understanding the decisions later on.
  See also [A rational design process: How and why to fake it](https://doi.org/10.1109/TSE.1986.6312940).
- The MADR format is lean and fits our development style.
- The MADR structure is comprehensible and facilitates usage & maintenance.
- The MADR project is vivid.
- Version 2.1.2 is the latest one available when starting to document ADRs.
- The Log4brains patch adds more features, like tags.

The "Log4brains patch" performs the following modifications to the original template:

- Change the ADR filenames format (`NNN-adr-name` becomes `YYYYMMDD-adr-name`), to avoid conflicts during Git merges.
- Add a `draft` status, to enable collaborative writing.
- Add a `Tags` field.

Output

  • Gitlab/Github Markdown renderer

  • Published Site

  • Human readable plain text files

Example of ADR Website output with Log4Brains tool

Accessibility audit as code 🥷

The problems of traditional auditing

  • Excel files exchanges from emails

    • Versioning hell

    • Hard to show progress from Excel in meetings

Frago helps with

  • Standardization of content (CSV)

  • Versionning with Source control

  • Publication as website

    • During audit: Incremental feedback, support conversations

    • After audit: Ready to be published

Inputs

  • CSV

  • Yaml

  • Markdown

Output site (home)

Accessibility audit report generated with Frago.homepage

Output site (details)

Accessibility audit report generated with Frago.details showing recommendations

Technology radar

Input

  • CSV file

    • Could be sourced from ADRs

  • Google sheet

Technology radar Output Artifacts

  • Generated static site

  • PDF

Technology Radar Output Website

Declarative infrastructure

Docker Compose to diagram

version: 3.8

services:
    backend:
        build:
            args:
                - NODE_ENV=development
            context: backend
        command: npm run start-watch
        environment:
            - DATABASE_DB=example
            - DATABASE_USER=root
            - DATABASE_PASSWORD=/run/secrets/db-password
            - DATABASE_HOST=db
            - NODE_ENV=development
        ports:
            - 80:80
            - 9229:9229
            - 9230:9230
        secrets:
            - db-password
        volumes:
            - ./backend/src:/code/src:ro
            - ./backend/package.json:/code/package.json
            - ./backend/package-lock.json:/code/package-lock.json
            - back-notused:/opt/app/node_modules
        networks:
            - public
            - private
        depends_on:
            - db
    db:
        # We use a mariadb image which supports both amd64 & arm64 architecture
        image: mariadb:10.6.4-focal
        # If you really want to use MySQL, uncomment the following line
        #image: mysql:8.0.27
        command: '--default-authentication-plugin=mysql_native_password'
        restart: always
        secrets:
            - db-password
        volumes:
            - db-data:/var/lib/mysql
        networks:
            - private
        environment:
            - MYSQL_DATABASE=example
            - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
    frontend:
        build:
            context: frontend
            target: development
        ports:
            - 3000:3000
        volumes:
            - ./frontend/src:/code/src
            - /code/node_modules
        networks:
            - public
        depends_on:
            - backend
networks:
    public:
    private:
volumes:
    back-notused:
    db-data:
secrets:
    db-password:
        file: db/password.txt

Output

Gitlab CI file Input

include:
  - template: "Verify/Accessibility.gitlab-ci.yml"
  - template: "Security/SAST.gitlab-ci.yml"
  - template: "Security/Dependency-Scanning.gitlab-ci.yml"
  - template: "Security/Secret-Detection.gitlab-ci.yml"

stages:
  - build
  - test
  - deploy
  - accessibility

build-baldir:
  stage: build
  script:
    - "echo do stuff"

deploy-baldir:
  needs:
    - "build-baldir"
  script:
    - "echo do stuff"

build-next:
  stage: build
  script:
    - "echo do stuff"

deploy-next:
  needs:
    - "build-next"
  script:
    - "echo do stuff"

build-audit:
  stage: accessibility
  script:
    - "echo do stuff"

deploy-audit:
  stage: accessibility
  script:
    - "echo do stuff"

Gitlab CI pipeline Vizualisation

Your tools & IDE features

Integrated documentation in context 🥷

Sample from Int class in kotlin source code

Throwable diagrams 🥷

Screenshot of a quickly generated diagram in IntelliJ Idea

Dependency analysis 🥷

Dependency Matrix in IntelliJ Idea

IDE’s quick fixes 🥷

  • IDE can help you learning by proposing automatic fixes

    • Convert to Lambda expression

    • Convert to switch expression

    • Convert from markdown to asciidoc code listing 🥷

From manual documentation to automation

Write everything you do in a file

# Installation steps

1. Connect to machine A with SSH
2. Move to directory `/www`
3. Delete content
4. Download latest artifact
5. extract artifact in `/www`
6. verify new site is online

Add scripts in file for automating some tasks

# Installation steps

## Prepare

1. Connect to machine A with SSH

## Cleanup content

```shell
rm -rf /www/*
```

## Install latest version

```shell
wget https://where-your-artifact-is/artifact.tar.gz
tar -xvf artifact.tar.gz
# cleanup
rm -f artifact.tar.gz
```

Fill the gaps

# Installation steps

1. Connect to machine A with SSH
2. Run preinstalled script `./full-install.sh`
3. Run healthcheck script `./healthcheck.sh`

Evolve to advanced tools if needed

  • Gitlab CI

  • Ansible

  • Terraform

  • Puppet

Why do it incrementally?

  • Solve one problem at a time

  • Your procedure will be reviewed by those who uses it and evolve

  • Lazy automation costs less

  • When/if you investigate for On the Shelf tools

    • you know what they need to solve

    • you may integrate your own scripts in the tools

Interlude

Et maintenant?

Word Cloud avant

Word Cloud après

Takeways

Documentation is about Knowledge

That is worth sharing

Core Principles of Living Documentation

  • Reliable

  • Low effort

  • Collaborative

  • Insightful

Learn…​

  • Your languages

  • Your tools and what they can produce

  • Generic knowledge

Remember

  • Favor conversations and working together

  • Knowledge is mostly already there

You can begin with…​

Reviewing the quality of your current documentation

  • Where is it? Multiple places? Duplicated?

  • Is it up to date?

  • How many authors of the last updates have left the team?

  • Does documentation explains WHY or just HOW?

  • Can you trust the diagrams?

  • Is some knowledge redundant between the source and

⚠️ Automation has a cost

Automation : Something goes wrong

Automation disaster illustrated by an sequence from the videogame Satisfactory. A really messy factory with hundred of interlaced conveyor belts powered by coal powered generators. They reject a lot of black smoke. The goods are conveyed in a very inefficient and slow way.

But…​

It’s less dangerous to let developer experiment crazy stuff on doc instead of production code

Questions?

Thank You!

logo software crafters lyon

Software Crafters Lyon

logo software craftrers strasbourg

Software Crafters Strasbourg