Hello everyone,
This is a reminder about the importance of documentation in Elixir projects.
Elixir provides many tools to make documentation easy to write and accessible. However, all those tools and effort will go to waste if we, as a community, don't step up to write good documentation using the appropriate format and guaranteeing it works in our projects.
This does not only apply to open source projects, but to internal projects as well. Once you get the habit of writing documentation, you will find out it not only increases the project quality but it helps with your thought process. For example, if something is hard to document, it is probably doing too much or it is still unclear what its responsibilities are.
Here is a quick refresher:
1. Documentation for Elixir source is written into attributes like @doc (for functions/macros), @moduledoc (for modules) and @typedoc (for types).
2. Documentation is written in
Markdown, which is also handy for writing documentation for your READMEs as many websites will render it correctly. We follow Markdown conventions all the way, so, for example, if you are referring to a variable name or a function in your docs, you should write `this_var` and `some_fun/2` (name/arity). By following this format, tools like ExDoc will also generate correct links and so on.
3. You can type `h Enum` or `h Enum.map` to see the documentation for the Enum module and for the Enum.map function directly in the terminal. This works for any compiled module and function.
5. You can also test and guarantee your documentation is up to date by using
doctests. Not everything is "doctest-able" but the majority of functions are.
José Valim
Skype: jv.ptec
Founder and Lead Developer