Documenting Your Code

Learn why properly documenting code is important, and get introduced to Compodoc and SassDoc.

Why is documenting code important?

Some developers love it, most developers seem to hate it, but documenting our code is something that we really should get into the habit of regularly doing.

Nowhere is this more true than when working as part of a team, particularly if we need to hand off our code to another developer. Helping them get up to speed on what we’ve written with clear, concise, and helpful documentation makes everyone’s life easier in the long run,especially where project deadlines are concerned.

If nothing else, it also helps us understand our code should we ever need to return to that in 6 months or more so we can remember what we wrote and why.

Documentation tools

In this lesson, we’ll look into how we can document the following code used in our Ionic apps:

  • TypeScript
  • Sass

To achieve this, we’ll be making use of the SassDoc and Compodoc NPM packages to help document the classes and styles from the animations-app project that we created in the Animations chapter.

Compodoc

Billing itself as “The missing documentation tool for your Angular application,” Compodoc is available as an NPM package which offers a pretty impressive feature set that includes:

Get hands-on with 1200+ tech skills courses.