Rubber Duck Debugging
- Try talking through the problem as if you're explaining it to someone else.
Pseudocode
- Write out the steps in comments.
Make the Invisible Visible
- Print to verify what each step did
puts "My var here: #{my_var}"
- Make instance variables and embed them in the view.
<%= @my_variable.inspect %>
Use the interactive console to display the contents of params, variables, and experiment to find solutions for the error.
Read the server log. (Clear with
ā+k
)
Try debugger
Add debugger
to stop execution and inspect variables
c
continue
n
execute next line
Restart / Refresh
- Restart server
- Hard refresh the page
How to Solve It
- Understand the problem
- Make a plan
- Carry out the plan
- Reflect how could it be better
Understand the problem
- What am I trying to accomplish?
- Restate the problem.
- Use a picture or a diagram.
- Gather information to find a solution.
- Understand all the words used in stating the problem.
- Ask questions.
Top comments (0)