cp-algorithms
cp-algorithms copied to clipboard
Adopt a code standard for implementation codes (umbrella issue)
Basic level:
- enclose code in ``` tags instead of pre, code etc.
- code style: spacing, indentation etc.
Intermediate level:
- unify the way code reads parameters and reports output. A lot of code has comments instead of reading input - we could, for example, wrap such code in a function which accepts a certain list of parameters, so that we don't need a specific input-handling code, and still the code is complete and can be used as a library method.
- use the same language for all generic code (i.e. code which doesn't highlight some specific feature of a specific language). Some articles have the same code in C++ and Python, and the difference is purely syntax.
Advanced level:
- make sure all code compiles and is covered by unit tests :-) We could use Jupyter to embed executable code in our articles.
Great guidelines. What about how codes in both languages should be displayed? Should they be hidden in "spoilers" or such things? Should we place codes inside "spoilers" even when there is only one language available?
Nice guidelines. After agreeing on common terms, we should update the contrib.md file as well stating the new rules which are necessary before sending a pull request.