Skip to content

Code Clarity Showcase Assignments

Twice this semester, I am going to ask you to submit a sample of your work that you feel showcases your ability to code clearly. What I will be specifically looking for:

  • Appropriate names for variables, functions, and (if applicable), classes. Specific guidelines to follow:

    • Make names descriptive
    • Capitalize the first letter of class names, but NOT variable and function names
    • In Python, use underscores to separate multiple words within names; in JavaScript (and similar) use camelCase.
    • To earn the highest marks, follow the grammatical guidelines in the box below
  • Indentation and Vertical Spacing

    • Python enforces indentation. For languages that do not, ensure each code block is appropriately indented as Python would have you do.
    • Add appropriate vertical space between chunks of code to maximize readability
  • Comments

    • Add appropriate comments prior to each chunk of code to help a reader follow it.
    • Line by line comments are typically not needed (for example, increase x by 1). If you've followed the other clarity guidelines, most individual lines should be pretty self explanatory. However, there may be the odd complex line where a comment would be appropriate.

Grammatical Guidelines for Naming

These guidelines are generally recommended, however use your common sense to decide when you might deviate from these.

  • Numerical and string variables should be nouns (length, x, size, bank_balance)

  • Lists/Arrays should be plural nouns (cities, ages)

  • In situations where we need to assign a name to each value in the list, use the singular noun

    # Example 
    for name in names:
        print("Hello", name)
    

  • Boolean variables and functions names normally start with is, has, or something similar that indicates and yes/no (is_player_jumping, has_secret_weapon)

  • Function names normally contain a verb, since the do something (draw_scene(), get_hypotenuse(a, b), set_position(x, y))

Submission Deadlines

  • Submission 1 - Thursday, April 2 or earlier
  • Submission 2 - Friday, May 22 or earlier, but not prior to receiving feedback from Submission 1

Marking Rubric

Each submission will be marked out of 10 as follows:

  • 10 - All above guidelines taken into consideration; good judgement calls made
  • 9 - With minor exceptions, all above guidelines taken into consideration; good judgement calls made
  • 7, 8 - Most above guideliens taken into consideration; good judgement calls usually made
  • 5, 6 - Some of the above guidelines effectively applied
  • 0 - 4 - Few of the above guidelines effectively applied