As per the previous post, my IPT students have been working along quite steadily, exploring the wonders of writing rich and fulfilling code. At one point, though, one of my students asked, “Sir, is there a way that I can avoid writing the same code over and over again?”.
The long answer began with, “Yes – as we’ve covered in class multiple times, like… enter string of classes” – but the answer is still, YES!
This is the part where ‘modules’ or ‘procedure calls’ come in.
So to demonstrate how to create your own procedures, I created a video… so that I don’t need to repeat myself again.
The premise of this, of course, is that repeated code is time consuming, increases the chance of errors and just isn’t good programming. In the example above, I load the list multiple times and I output the list to the data file at least twice. This is a perfect example of when to use procedure calls. Ideally, this would have been discovered in the planning stage, and it was, but as young explorers do, when they start exploring (after the planning), they just got in and had fun.
Associated code zip file: http://bit.ly/vbCreateProcedure
File hosted by Copy.com (a dropbox replacement – free, available for every device, and if you sign up after following this link, we both get an extra 5 Gb of space!): http://bit.ly/copydrop