Skip to content
Snippets Groups Projects
Commit b6bed06b authored by Theresa Mieslinger's avatar Theresa Mieslinger
Browse files

First draft for Good Scientific and Coding Practice

parent 1c307016
No related branches found
No related tags found
1 merge request!57First draft for Good Scientific and Coding Practice
...@@ -34,7 +34,7 @@ website: ...@@ -34,7 +34,7 @@ website:
- "lectures/data-structures/slides.qmd" - "lectures/data-structures/slides.qmd"
- "lectures/complexity/slides.qmd" - "lectures/complexity/slides.qmd"
- "lectures/debugging-strategies/slides.qmd" - "lectures/debugging-strategies/slides.qmd"
# - "lectures/good-scientific-practice/slides.qmd" - "lectures/good-practice/slides.qmd"
- "lectures/user-experience/slides.qmd" - "lectures/user-experience/slides.qmd"
- "lectures/testing/slides.qmd" - "lectures/testing/slides.qmd"
- "lectures/git2/slides.qmd" - "lectures/git2/slides.qmd"
...@@ -50,7 +50,6 @@ website: ...@@ -50,7 +50,6 @@ website:
- "exercises/data_structures.qmd" - "exercises/data_structures.qmd"
- "exercises/complexity.qmd" - "exercises/complexity.qmd"
- "exercises/debugging-strategies.qmd" - "exercises/debugging-strategies.qmd"
# - "exercises/good_scientific_practice.qmd"
- "exercises/user-experience.qmd" - "exercises/user-experience.qmd"
- "exercises/testing.qmd" - "exercises/testing.qmd"
- "exercises/git2/exercise.qmd" - "exercises/git2/exercise.qmd"
......
---
title: "Good scientific and coding practice"
author: "Bjorn Stevens and Theresa Mieslinger"
---
# Good coding practice
***consistency is the key***
* clean code
* efficient code
* understandable code
* tracable code changes
## Style Guides
***code is read much more often than it is written***
Each programing language has it's own guidlines:
* [PEP8 for Python](https://peps.python.org/pep-0008/)
* C++ does not have an official guidline, but [Stroustrup and Sutter](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) is a good starting point
## Clean Code
* delete unused code blocks and only keep as few code as necessary
* fewer lines of code -> fewer bugs (add source to this statement)
* BUT: optimization should be in balance with code readability. Convoluted statements are ok if they improve the code efficiency, but might need to be accompanied by some sort of documentation.
## Efficient Code
::: {.smaller}
A collection and repetition of statements from previous lectures
:::
* use math if you can, else, keep the order of complexity of your code in mind and check whether it behaves as you'd expect (complexity lecture)
* reduce loops by vectorizing operations, e.g. in Python by using list comprehensions(?)
* efficient memory usage (memory?)
* use parallel processing if you can pinpoint the performance bottleneck to a task that can be split between multiple processors. (parallel programing?)
* ...
## Understandable Code / Documentation
code should be clear in itself, but also accompanied by a statement of its purpose and proper usage. Additional information could include input/output, author, or date information.
* in-line documentation: docstrings are string literals written into your code (add example?)
* comments
* separate documentation: common format is a text file, e.g. README.txt, or a chapter in a linked documentation file or handbook
## Version control for code changes
A version control software ensures a tracable record of code changes, it serves as a backup and is indispensible in any collaborative code development.
## Testing and Code Review
## Staying up to date
* stay up to date with coding trends and libraries
* be open and continue learning: new technologies typically improve your productivity
# Good scientific practice
* Use trustworthy sources
* understand your code
* communicate the license
* give credit to contributors
* respect intellectual property (IP)
## Licenses
CC0 versus CC-BY
## credit
## IP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment