Giter Club home page Giter Club logo

doc-n-code's Introduction

10 Fast Rules for Documenting Software

  1. Write Comments as You Code
    • Comments are crucial for understanding code later
    • Write comments as you code to capture your thought process
    • Aim for a balanced amount of comments, not too few or too many
# Bad (no comments)
for sequence in parsed_sequences: 
    analyze(sequence)

# Bad (too many comments)  
# iterate over the genes in the genome
for sequence in parsed_sequences:
    # call the analyze function, passing it each gene as argument
    analyze(sequence) 

# Good (just enough)
# Analyze the genome 
for sequence in parsed_sequences:
    analyze(sequence)
  1. Include Examples (and Lots of Them)

    • Examples provide a starting point for experimentation
    • Include examples demonstrating key functionality
    • Examples can also serve as unit tests
  2. Include a Quickstart Guide

    • Help users get started with your software quickly
    • Use examples, tutorials, videos, or other formats
    • Test your quickstart guide to ensure it's effective
  3. Include a README File with Basic Information

    • The README acts as the homepage for your project
    • Include installation, configuration, documentation links, license, testing, and acknowledgments
    • Consider using badges to show project status
  4. Include a Help Command for Command Line Interfaces

    • Document how to use your CLI with a "help" command
    • Include usage, subcommands, options/arguments, environment variables, and examples
    • Use tools like click (Python) to generate the help command
  5. Version Control Your Documentation

    • Keep documentation in your version control repository
    • Archive rendered documentation for each release
    • Provide a changelog to track changes between versions
  6. Fully Document Your Application Programming Interface (API)

    • Document inputs, outputs, errors, methods, and attributes
    • Follow a consistent style guide for API documentation
  7. Use Automated Documentation Tools

    • Tools like Sphinx, Doxygen, and MkDocs can generate documentation
    • Automate API documentation, interactive REST API docs, and more
    • Use services like Read the Docs to keep documentation up-to-date
  8. Write Error Messages that Provide Solutions or Point to Documentation

    • Good error messages state the error, software state, and how to fix it
    • Provide guidance in error messages to save users' time
# Bad
print("Error: Translation failed.")

# Good  
print("Error: Translation failed because of an invalid codon (\"IQT\") "
      "in position 1 in sequence 41. Ensure this is a valid DNA "
      "sequence and not a protein sequence.")
  1. Tell People How to Cite Your Software
    • Include DOI, BibTeX entry, and written reference in the README
    • Use a CITATION file in Citation File Format (CFF)
    • Get a DOI for your software from services like Zenodo or JOSS

Additional Tips

  • Use Consistent Formatting
    • Use a consistent style for headers, code blocks, etc.
    • Markdown allows for consistent formatting across platforms
### Header 3

#### Header 4

`inline code`

```python
# Code block
print("Hello World!")
  • Structure Documentation Well

    • Break documentation into logical sections and chapters
    • Use tables of contents and cross-references where appropriate
  • Include Visual Aids

    • Use diagrams, flowcharts, and screenshots to clarify concepts
    • Reference images using relative paths
  • Make Documentation Searchable

    • Use proper headings and anchor links
    • Consider using a search plugin for websites
  • Keep Documentation Up-to-Date

    • Automate documentation updates when code changes
    • Encourage contributors to update documentation

doc-n-code's People

Contributors

0101011 avatar

Stargazers

Torres avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Taran Baran avatar pdwl.ru Запчасти для иномарок, масло, шины, диски, аккумуляторы (акб), краска и автохимия Тверь avatar  avatar

Watchers

 avatar Taran Baran avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.