I. Basics

  1. Discuss the topic with me.
  2. 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).
  3. 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

  1. The code must be submitted via a pull request in a git repository.
    1. Create an empty repository in Bitbucket, GitHub, or MFF's GitLab
    2. Create a new branch (this is the so-called feature branch; give it any name you want)
    3. Commit all your code to that branch (not to the main/master branch)
    4. Create a Pull Request
    5. Add me as a reviewer (jhana for bitbucket, jirka-x1 for GitHub; you need to add me as a collaborator first)
    6. Send me a non-automated email about this with the subject "NPFL128 Project<your-first-name><your-last-name><assignment-number>"
  2. You have to react to all my comments:
    1. reply "fixed" if you agree and fixed it; 
    2. ask for more detail, or
    3. disagree.
      ​But don't just fix or ignore it silently.
  3. 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

  1. There is a readme file in the root (use markdown or plain text). It must specify 
    1. What the project is solving (add a reference to the relevant paper)
    2. Scope - what you implemented and what is left for future
    3. How to run the project 
    4. Add a file with sample output if appropriate
  2. 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)
  3. Split your code into functions. Write functions that
    1. each solve a single well-defined task 
    2. are documented 
    3. are testable; bonus points for unit tests
    4. ideally, the output is via the return value only. If any parameters have to be modified, document it
  4. Use self-explanatory variable and function names
  5. Document all functions (what they do, what is input, what is output); add other comments as appropriate 
  6. You must use appropriate libraries to handle JSON, XML, csv, etc. Do not write the code yourself.
  7. All files end with a newline (see: this)

IV. Python

  1. Strictly follow the PEP8 code style; a reasonable IDE (e.g., IntelliJ IDEA, PyCharm, MS VS Code) checks this for you.
  2. 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 (strintListSetIterableTupleOptionalMappingDict, ...). You do not need to use them for complex types of third-party libraries where it is not clear what the type is. 
  3. Include a requirements.txt or setup.py file so I can easily install third-party libraries
  4. Use the main function pattern 
  5. Use argparse to parse arguments. 
  6. Use with to manipulate files.
  7. Consider using: pathlib's Path for all files and directories, Counter to count objects.