Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
show-titlefalse
titleDescription

Image ModifiedThis is a short outline on how to bring living documentation to Confluence - the team collaboration platform - with the PDAC1.

We will first define what living documentation is and then show how the tools in the projectdoc Toolbox support it. The journey will take us from the source code artifacts, where the information specified, to the Confluence page, where this information is displayed.

This approach can be used - for instance - to document error and response codes, create examples of usage patterns of APIs, or to expose project and product properties, such as build information or configuration properties.

...

Section
titleProcess

This definition and principles in mind we outline a process based on Confluence and the projectdoc Toolbox where information is

  1. gathered from the source,
  2. refined, packed, and finally
  3. fed to the team collaboration platform.

The information may be

  • copied (imported) in case it is frozen (that is: a release with a version number has been created),
  • transcluded from remote information systems, or
  • referenced in remote information systems.

This way the documentation is

  • reliable - it is in-sync with the information in the source artifacts
  • created at low-cost - it is integrated automatically
  • collaborative - it is available in the team collaboration platform so that each stakeholder has access to (directly or indirectly)
  • insightful - every stakeholder provides feedback and is able to refine information by adding new views on the subjects
Section
titleFrom the Source
smartics Exceptions

The farther documentation is away from the source code, the more likely it is that it is out-of-date and therefore plain wrong. It is beneficial to keep all information as close to the source as possible. This makes it easier for the development team to reflect changes to the source code directly to the documentation in the source file.

smartics Properties

The information may be available in plain configuration files, like the Maven POM file or deployment descriptors such as the web.xml.

Often the information is attached to the source code by the use of annotations (see Java Annotations). The annotations typically have impact on the runtime behavior. So changing an annotation directly takes effect in the execution of the software.

Information may be added as comments, especially as API documentation, such as Javadoc.

Finally information may also be gathered from types (such as interfaces) or members (fields and methods).

Here are some examples for tools and libraries that add information to the source code.

Tour
render-as-definition-listtrue
marker-column-property-nameTitle
replace-title-with-nametrue
TitleShort Description
Javadoc ToolJavadoc is a tool for generating API documentation in HTML format from doc comments in source code.
Java REST AnnotationsA tutorial on writing REST services with Java using annotations.
Mojo AnnotationsOverview over annotations to use for writing mojos of a plugin for Maven.
smartics Exceptions 
smartics Properties 
Section
titleGenerate Reports

Information can be derived from the source code in various ways. An automatic process may simply grab all configuration files and make them available for other information systems. If the information is spread over multiple files, maybe in different formats, a parser may first generate the information in one or multiple normalized files.

Section
Column
width30%

Examples for tools to generate reports:

  1. Buildmetadata Maven Plugin - collects build time information
  2. Maven Javadoc Plugin - creates an API documentation
  3. Maven Surefire Plugin - creates test reports
  4. Maven Checkstyle Plugin - creates a report on static analysis results
  5. Maven PMD Plugin - also creates a report on static analysis results
  6. Exception Codes Maven Plugin - creates a report on exception and error codes
  7. Properties Maven Plugin - creates a report on configuration parameters and their actual values
  8. Maven Plugin Pluging - creates the Maven Plugin Descriptor
Column
width70%
Transclusion
documentBMMP:Buildmetadata Maven Plugin
idsRed Hat Fork

Section
titleBundle Reports to Artifacts

Some information is automatically bundled with the generated artifact during the build process.

Projectmetadata Maven Plugin Configuration

For information that is not automatically attached, the Projectmetadata Maven Plugin allows to create an artifact with any information attached. This artifact is then added to the artifact server for reference. The inclusion of report artifacts is based on descriptors. The plugin provides a number of standard descriptors and allows to define custom descriptors to attach additional formats.

Section
titleMake available

The following techniques make the report information available on the team collaboration platform.

Section
titleImport Artifacts

Create Space for Maven Plugin

Import static information to a space by referencing a POM file or its GAV coordinates.

  1. Create a space to document Maven plugins using projectdoc for Maven Developers
  2. Create a space to document a Java library using projectdoc for Java Developers
  3. Use the Version Doctype of the Core Doctypes to add new versions to an existing space

Java Space with Versions

Caution Box
titleExperimental

The import is based on the Maven Extension which is currently experimental.

We already use it to document our own products. Be aware that we currently only cover some basic use cases.

Section
titleTransclude and Reference

Make reports available on remote information systems, like

  1. Javadoc API reports - using the Javadoc Maven Plugin to generate the report as part of a Maven Site
  2. Diagrams on an image repository - exporting diagrams with the smartics Enterprise Architect Maven Plugin
  3. Artifacts on an artifact repository - by the use of the Maven Deploy Plugin
Section
titleUse in your Documents

Now let's access the provided information.

Section
titleImported Information

Static imported information can be easily accessed using the Display Space Property Macro and Display Document Property Macro (or it's cousins).

Note Box
titleReal-Life Project

The smartics Enforcer Rules for Maven is based on the Java space template and has imported a number of versions via its Maven POM file.

Excerpt of Properties imported from a Maven POM

The screen shot shows an excerpt of the properties from the project's POM.

Refer to Space Properties and Using Space Properties for more information on space properties and to Document Properties for more information on document properties.

Section
titleRemote Information

Information on remote systems can be easily transcluded or referred to using macros of the Information Systems Extension.

  1. Reference Javadoc API reports with the Javadoc Link Macro
  2. Transclude diagrams on an Enterprise Architect repository using the Enterprise Architect Image Link Macro
  3. Reference Artifacts on an artifact repository with the Nexus Link Macro
  4. Reference or transclude remote resources with the System Image Link Macro, System Transclusion Macro, or System Link Macro
Tip Box

References can be easily made with plain Confluence links. The advantage of the macros is that they use space properties to construct the URL to a remote resource. If resources on a server move to another address, the base URL can be easily updated in one place. All links based on this URL are automatically updated.

Transclusion
documentPDAC1:Javadoc Link Macro
idsexample

Section
titleExport - optionally

Not all stakeholders may have access to the team collaboration platform. In this case wiki pages can be exported to Word or PDF using the Scroll Office Add-on by K15t.

The exported page is then treated as a record that does not demand to be updated. But it can easily be transferred to remote parties.

Section
titleSummary
Section
Column

In our short tour we have introduced tools to put information to source files and build tools to aggregate and export this information.

With the use of Confluence as the information hub and the PDAC1 this information can be easily accessed by the team to write documentation in an agile way!

Writing documentation based on living documentation is actually quite easy and a lot of fun!

Give it a try!

Column
Transclusion
documentPDAC1:projectdoc Toolbox
idsmarketplace

...

Section
titleResources

More information on this topic.

Section
titleArticles & Books

A list of articles and books on living documentation and related topics.

Definition List
Living Documentation – Tools at HandArticle on our blog (May 2015).
Specification by ExampleGojko Adzic presents case studies (of over 50 projects) of how successful Lean and Agile teams design, develop, test and deliver software efficiently.
Living DocumentationThe book by Cyrille Martraire explains the theory of living documentation and describes a number of techniques, with illustrations and concrete examples.
Agile Documenation
Display Property
documentPDAC1:Agile Documentation
property-nameShort Description
Section
titlesmartics Plugins for Maven

Plugins for Maven to create or bundle artifacts based on source code information.

Tour
render-as-definition-listtrue
replace-title-with-nametrue
style-classsimpleindent
Section
titlesmartics Libraries for Java

Libraries for Java to export information from the source.

Tour
render-as-definition-listtrue
replace-title-with-nametrue
style-classsimpleindent
TitleShort Description
smartics Exceptions 
smartics Properties