The skiing game we created has been a huge hit. It’s a great advanced project which brings together all the topics in the Principles of Programming book. It’s a fun way to create something visual that is fun to interact with, and all in under 200 lines of code!
One of the key learning concepts is to use Subroutines whenever possible. We do this in the skiing app. One of the reasons Subroutines are powerful is that you can reuse code in multiple places over an over again without having to re-write it. This makes it easier and faster to create complex programs.
Another big reason to use Subroutines is that you can replace the Subroutine to make it do something entirely different and it can have a major impact on the program, without having to re-write the whole thing. Here’s a great example:
In the skiing program, our skier is pretty plain. We just draw two parallel lines to represent the skier. See the image on the left. One young programmer decided to make it a bit more interesting. They wanted a better looking skier in the app. So, to do this all they had to do was replace one Subroutine, namely the one that draws the skier, with a new version. See the picture on the right and how much better their skier looks and what a difference it makes in the program. Changing out the Subroutine didn’t have any impact on how the game is played or the trees, jumps, or anything like that. But, by replacing one piece of isolated code sure made the app much different.
This same concept could be used to replace the trees with something more visual, or the jumps, or any part of the program. Subroutines are a great way to break up a program into its logical parts and ensure it can be easily improved.
BTW, the reader is a 10 year old! Kids really can learn to code!
Fildena extra power 150 mg reviews The original code:
why not look here The replacement code: