Teach students that if they need to explain their code for someone else to understand it, they should think about how to change the code to make it readable.

  • Well written code should be understandable without verbal explanations or a lot of comments.
    • Point out that if someone doesn’t understand your code it’s your problem, not the problem of the person reading it!
    • Generally speaking, if you have to explain your code, it’s not readable. If you have to write comments, it’s probably not readable.
  • Emphasize that easy to read, easy to learn, elegant code is extremely valuable in a software engineering environment.
  • When teaching material that could be utilized in professional environments, it’s extremely important that students walk away understanding what to look for and what to write such that their code is easy to read, easy to learn, and elegant.

More about this tip

External Source

Interview with Gregory Nelson.