04 Name and Comments

What is the purpose of comments in code?

Vocabulary

Single Line Comment, Multi-line Comment, camelCase, Debugging, bug, Logic error, Runtime error, Syntax error

Study Questions

  1. Why should we comment our code when we already know what it means?
  2. What is the purpose of code formatting or prettifying code?
  3. What is camelCase?
  4. What happens with the commented lines when the program is run?
  5. How can commenting help debug our code?
  6. What is the use of Lorem Ipsum generator in creating websites?
  7. Why do companies need or may keep a style guide for their programmers?

Activity

  • Watch Video #1 (below)
  • Create the following layout in HTML. Use CSS to make all sections visible with borders. Use semantic html for sections highlighted below.
  • Re-visit your ROBOT from Lesson 03. Copy the robot sketch into your new sketch.js file. Copy your robot description into appropriate section in the HTML layout.
  • Comment your code in sketch.js file.
    • Use a multi-line comment starting at line #1 to write a brief description of what your program does.
    • Make concise and useful comments that highlight the important parts of your code. For a robot, you might want to highlight the big parts of your design: Head, Body, Arms, Feet, and other features that were created with blocks of code.
  • Be careful about too many comments or unnecessary comments.
  • Give your site a short descriptive title that reflects the program.
  • Finish your webpage layout using Lorem Ipsum text, and pictures as necessary for the layout.
  • Spend time on refining the look and feel of the site using custom CSS. Use your robot design on the canvas to flesh out a theme for the webpage. Pay attention to consistent margins and padding between html elements.
  • Answer the vocabulary and study questions from this lesson. All descriptions must be in your own words and relevant in regards to our class.

Resources

  1. Video: 04 Name and Comments
  2. Link: Comment Style Guide node.js style guide , Airbnb Javascript Style Guide, Google Style Guides
  3. Link: What is in a name? Shakespeare
  4. Link: Debugging from P5js.org
  5. Link: Lorem Ipsum Generator
  6. Link: Lorem Photos
  7. Link: Alternate Lorem Generator