# General Coding

### Method Development

#### Development:

1. Implement unit testing for novel method codes.
2. Write documentations! A usage example is always a plus.
3. Keep data compilation scripts well-maintained, and log/store intermediate results.

#### Releasing:

1. Provide a test dataset.
2. Provide a setup requirement file, or conda/pip environment.
3. An interactive demo in Google Colab is great, depending on the specific project.

### Data Analysis

1. Use jupyter notebook whenever and wherever you can.
2. Clean up your Jupyter notebook! Consider using a [Table of Contents](https://stackoverflow.com/questions/21151450/how-can-i-add-a-table-of-contents-to-a-jupyter-jupyterlab-notebook).
3. Provide processed data files as a downloadable Tarball, so that all Jupyter notebooks can run without raw data processing. Consider using Google drive and [google-drive-downloader](https://pypi.org/project/googledrivedownloader/).

### Python

1. Use [black](https://github.com/psf/black) to format your code for better Python code readability.
2. Use [Google style DOCSTRING](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).
3. Write unit-tests, and check code coverage by [Coverage.py](https://coverage.readthedocs.io/en/latest/).

### R

1. Use R [Vectorization](https://bookdown.org/rdpeng/rprogdatascience/vectorized-operations.html) whenever possible; avoid for-loops.
2. Use [tidyverse](https://www.tidyverse.org/) as a workhorse for data processing.
3. Write functions to reuse code; be aware of R's [global namespace pollution](https://stackoverflow.com/questions/13081696/how-to-prevent-functions-polluting-global-namespace).
