Simple Debugging


Premium Content - Free Preview

In the previous node, you changed the Circle Class so Circles could be created with all of their instance variables set at a specific position. You can now improve your Picture Class to create a Picture in fewer lines of code.


Task
Update your Picture code to create the same face as before but in fewer lines of code. Each Circle can now be created and set to the correct position and appearance in one line of code.


Debugging
Previously, when you moved the Circles around to create a face, they didn't tell you what position they ended up in. This means you might not know what X and Y positions to use for them in the above task.
Often you will want to examine the variable values of a running program to see what's going on and what's broken. There are a few basic ways to do this:

  • Debugger - A debugger is included with IDEs (including BlueJ) to let you step through code and examine the variable values. We won't cover using an IDE debugger right now, but you can use the visual debugger on Learneroo to debug your challenges. See the video below for more information.
Debugger Video



End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Comments

  • Won't spoil it, but if you are stuck it is really, really simple... as in 1 character somewhere.

Contact Us
Sign in or email us at [email protected]