I. Basics
- Discuss the topic with me.
- The preferable programming languages are Kotlin or Python. Talk to me if you want to use any other language (Java, C++, C#, are generally ok).
- Tip: Use ChatGPT to help you with bits of code, e.g., with processing Pandas data frames. Make sure you verify the answers.
II. Git and Pull Request
-
The code must be submitted via a pull request in a git repository.
- Create an empty repository in Bitbucket, GitHub, or MFF's GitLab
- Create a new branch (this is the so-called feature branch; give it any name you want)
- Commit all your code to that branch (not to the main/master branch)
- Create a Pull Request
- Add me as a reviewer (jhana for bitbucket, jirka-x1 for GitHub; you need to add me as a collaborator first)
- Send me a non-automated email about this with the subject "NPFL128 Project<your-first-name><your-last-name><assignment-number>"
-
You have to react to all my comments:
- reply "fixed" if you agree and fixed it;
- ask for more detail, or
-
disagree.
But don't just fix or ignore it silently.
- Do not mark my comments as resolved. The reviewer decides whether they are resolved or not. It is really hard to see how they were addressed when they are marked as resolved.
III. General
-
There is a readme file in the root (use markdown or plain text). It must specify
- What the project is solving (add a reference to the relevant paper)
- Scope - what you implemented and what is left for future
- How to run the project
- Add a file with sample output if appropriate
- Do not use jupyter notebooks, write regular production-like code that can be executed from a command line with appropriate parameters (the notebook can be added to provide an example of use, but it must call the regular functions you define)
-
Split your code into functions. Write functions that
- each solve a single well-defined task
- are documented
- are testable; bonus points for unit tests
- ideally, the output is via the return value only. If any parameters have to be modified, document it
- Use self-explanatory variable and function names
- Document all functions (what they do, what is input, what is output); add other comments as appropriate
- You must use appropriate libraries to handle JSON, XML, csv, etc. Do not write the code yourself.
- All files end with a newline (see: this)
IV. Python
- Strictly follow the PEP8 code style; a reasonable IDE (e.g., IntelliJ IDEA, PyCharm, MS VS Code) checks this for you.
- Use type hints for function parameters and return values. First, type hints make it easier to understand your code. Second, they help you do avoid many errors (a reasonable IDE or a type checker, e.g., http://www.mypy-lang.org/ will do the code analysis). Use them at least for basic types (str, int, List, Set, Iterable, Tuple, Optional, Mapping, Dict, ...). You do not need to use them for complex types of third-party libraries where it is not clear what the type is.
- Include a requirements.txt or setup.py file so I can easily install third-party libraries
- Use the main function pattern
- Use argparse to parse arguments.
- Use with to manipulate files.
- Consider using: pathlib's Path for all files and directories, Counter to count objects.