When Things Go WrongOn Thursday, students had a studio day and were finishing off their final labs and reviewing for the
Then we ran the code and received a ConcurrentModificationException. I was stumped. This was a single threaded program, multithreaded programming was not something we would be covering, so the error made no sense. We looked at the Javadoc for the error and saw that this exception could also occur if an item in a List is changed while iterating through the List. OK, that explained the error but not how to fix it.
We LearnAfter struggling with the error for some time, I finally went back to my desk and looked at the
This proved to be a great learning experience for all of use.
- We learned about the list iteration and changing list items.
- We learned about the ConcurrentModificationException
- My students learned that even when you have been coding for a long time, you can still run into things that stump you.
- And I learned that although I like not looking at the solutions to the labs provided with my AP CSA curriculum, I had best do this from now on!
There is an important lesson for me -- wanting to always have the answer is not always the best way for students to learn. A struggle is good!