Saturday 4 April 2009

Chunk 46 - Optional Modifications

This section is optional and we must decide if it is worth attempting to decipher another persons code our weite our own. The scenario is one which often crops up when writing a program. We have some code that someone else wrote, or code we ourselves wrote, that would add some desired quality to our application. It seems to fit the bill but when we copy and paste it into our own code we find that it isnt a perfect fit. We may decide it would be easier to just write our own code or we may feel that the code would save us a lot of time.




The code in this case, is contained in a for loop, in another program we wrote some time ago. It contains many new patterns and the images above only use a few of them. Study these images and decide whether you want to use them and modify THE CODE .
The finished code will not be available here and so you will have to buy the book or modify this code if you want to add the new patterns.
Tip: If your code slows down after making the changes, trace the code through the for loops and make sure you are clear about how many times a function is executing!

No comments:

Post a Comment