2023_09_28 - Dutton-Christian-Robotics/Learning-to-Code GitHub Wiki

Review

  • Kahoot!

Tour

  • Variables (REMEMBER)
    • hold pieces of information
    • types: string, double, boolean, array, object instances
    • naming: camel case, snake case, kebab case, Pascal case
    • declaration, assignment, initialization
  • Function/Method calls (ORGANIZE / DO)
    • make things happen
    • arguments (what we give it) and parameters (what it wants)
      • example of power for motors
    • return value
  • Explain OOP
    • class / object / instance: like a cookie cutter and cookies
    • inheritance
    • methods / properties
    • @Override
  • Basic parts of an OpMode / Java class—a program within a program
    • lines end with a semicolon
    • runOpMode
    • things we "inherit": HardwareMap
  • Things to note
    • motor direction
    • motor power
    • waitForStart() / stages of an OpMode
    • sleep()

Activities

  • Run the code as it is
  • Make it drive backwards
  • Make it turn

Concepts

  • DRY: Don't Repeat Yourself
    • more repetitive code = more opportunities for small mistakes
    • more repetitive code = harder to made broad changes
  • Writing reusable methods
  • scope