I want you to cast your mind back to December, the terrible rain, the lack of snow. Can you picture it? At that time I created a series of posts, which took you through the process of completing a coursework. When I set today’s task, a lot of you looked the same way you did in August, when I told you about impossible tasks. While I am on the subject of time travel, you might want to look at a post from the 2nd of October. (Help with the task after the break)
You need to go back to those posts and read over them. The whole point of step wise refinement is to break a complex and “impossible” task in to manageable steps. In no particular order, our program has to do the following.
- Display 20 results from an array in a table (there could be a blog post about that)
- Find the largest and smallest set of results from an array (you created programs to do that in section 7)
- Count the number of times an item is found in an array and store it. (sounds like section 7 again)
- Handle Arrays (topic 4)
Let me tell you a true story. Last night I returned home from parent’s night to find my youngest son had “started” a lego set, that I had promise we would do when I got in. He had very helpfully opened all the numbered bags and placed the contents of the numbered bags into a big tub (can you see where this is going?). When I asked “Why?” he said “it was to let me find the pieces easier”. It will take ages to complete the set with all the pieces in together. Programming is like that, you need to do one part of the Lego set at a time and then assemble it at the end. Yeah it looks like nothing is right till the last minute but it’s the fastest way to get the results.
Try the following
Write down the inputs to the program, write down what the program does then write down what the program displays to the user. This will help with your understanding of the task.
Think about how the program might work, if you can’t be so abstract then imagine you were trying to get a bunch of kids to do the task for you.
- How would you organise them?
- Would you group them?
- Would you have some do one part, while others did the other?
- Does one part have to be done first?
This will give you, the programs sequence and what data is required by what part of the program.
Finally you have made it to the implementation, as long as you have planned it all out this should be straight forward.
- Create the controls and any objects you need on the form.
- Enter the main part of the program. This might not do a lot but it does set down the order of the program execution. you should enter the procedure calls here
- Create the empty procedure declarations.
- Check it compiles, it will no doubt crash or “freeze” after the compilation but don’t worry it doesn’t do anything at this point.
- Enter the code for the 1st procedure and run it. You might have to use break points to check that it is doing anything.
- Do the same for each of the others, following the order you set down in the main program.
- Sit back and marvel at how well your program works.
Programming and software development, like most things, get easier the more you do them. Dig out your notes and try the end of topic assessments again. Set aside a few hours to do it, at the beginning the tasks will appear hard but by the end, programming code will be flowing easily from your fingers.
Remember if you need help or just want to practice, drop by at lunch time, post a comment, email a question or just ask me in class.
just wanted to know when it is that we are going to be starting the coursework task. Also, if you would be helping out with going over some mock coursework’s at all?
I plan to start it next week, which gives us enough time to complete it. Yes David we will be going over that task this week as well as completing the dice roll task and NABs. It’s going to be a busy week.