Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.85 KB

notes.md

File metadata and controls

42 lines (32 loc) · 1.85 KB

Getting started

Practice some good programming style. Here are some of the tips for writing clean and readable MATLAB code for your group assignment:

  1. Use descriptive names:

    • Assign meaningful names to variables and functions, e.g., Height instead of h.
    • For multi-word names, use capitalization or underscores for readability, e.g., CarSpeed or car_speed.
  2. Break long code into smaller pieces:

    • Divide long code into smaller, single-function pieces using user-defined functions and code cells (%%).
    • User-defined functions are created with the function keyword. Each code cell can be run individually.
  3. Comment your code:

    • Use the single percentage sign % to add comments explaining the purpose of commands, variables, and functions.
    • Comments aid both your future self and others in understanding your code.
  4. Don’t write dense code. Allow empty lines between the commands to enhance code readability.

  5. Use consistent indentation. For example, proper indentation improves the readability of code with multiple cycles of for ... end loops.

  6. Don’t make your lines too long. Split long commands and computations using triple dots ...

Remember, readability is crucial, as it makes understanding, maintaining, and debugging the code easier for everyone.

Marks scheme

  1. Code correctness (20 pts) w: 40%
    • Code solutions must run smoothly without errors
    • Tasks completed correctly
  2. Output visuals (10 pts) w: 20%
    • Interesting plots or animations
    • Use of README to describe solutions to all tasks
  3. Creativity and innovation (10 pts) w: 20%
    • Substantial coding effort
    • Evidence of innovative techniques
  4. Code organization (5 pts) w: 10%
    • Readability of code
    • Organisation of code
  5. Use of GitHub (5 pts) w: 10%
    • Commit often
    • Commit messages
    • Usage of PR feedback/issues