-
Notifications
You must be signed in to change notification settings - Fork 8
Home
The idea of this wiki is to document whatever Software Development practices should we consider as standards. To contribute, please attain to the follow guidelines:
-
Keep it simple: The home page (this page) is for general guidelines. More elaborated recommendations or examples should be provided in each topic's specific page.
-
Unless previously agreed, don't overwrite content.
And that's it! Currently, the wiki is divided in the following sections:
-
Coding Standards: Anything that has to do with coding itself so that it's more readable, this includes naming variables, functions, and classes, code indenting, etc.
-
Software Thinking: Before starting to write a piece of software...
-
Development Workflow: For now, mostly focused on R, general guide lines for developing Statistical Software.
- The 80 characters rule.
- When possible, structure your code as sections/files, with files holding similar functions and sections to give internal structure to your file.
- Use white space for indenting, 4 characters.
- Explain yourself: Add comments.
-
Single line
if# If it's only a single like if (...) ...then...
-
Multiple lines
ifelse# Several blocks if (...) { ...then... } else { ... }
- Never use dots to name objects, e.g.
my.object. Both R and C++ use the dot symbol to access (or call) methods. Instead use either underscore or capital letters, e.g.my_objectormyObject. - Whenever possible, use informative names, e.g.
loglikeinstead ofvar1
Unfolding the "Software Thinking", once you have set up the project (whereas an R package, C/C++ library, etc.), the development workflow is an iterative process. For each fun in functions do:
- Write down the function
- Document the function: Input/output, examples, and references.
- Write down the tests
- Build (compile) the package
- Run the tests and make sure
fundidn't break anything. - Update the
news.mdandChangeLogfiles (that sounds like a good idea)
For R package development
-
devtools: An R package for package developers. -
roxygen: For documenting functions. -
testthat: For making testing fun. -
codecov: To track the code coverage.
For reproducible research
-
ProjectTemplateA complete workflow for reproducible research. -
represtoolsAn alternative to ProjectTemplate. -
CodeDependsAnalyzes your code to see dependencies. -
reproducibleAn alternative to ProjectTemplate.
- The Art of R programming
- R packages
- Advanced R