7. ParsingThe process of transferring data from one computer program to another program that requires the data in a specific format that is different to the original format, is referred to as parsing data. The program that converts the original data to an acceptable format for the main software program to process is referred to as a parser. Parsing in Processing should return a set of data that your main program can read directly in a text file, a spreadsheet or other such data format that does not require any further levels of un-abstraction. Sometimes, the decision to write a parser might not be an easy choice to make. Weigh up the amount of time you think it will take to manually convert the data (as illustrated in the above diagram) compared to the amount of time it will take you to develop a parser, along with it's overall usefulness (as a parser can sometimes end up being specific to one application) and try to make an informed decision based on these factors before jumping head first into the task at hand.
8. Determining Flow of Control through Stepwise Refinement
A program's flow of control refers to the order in which statements are run within in a program. The results of these statements can ultimately determine how a user interacts with the program by means of various branches of code structures within your program that the program determines whether to execute or not based on the choices the user has made through interactions with the program. Branching is an important part of a programs flow of control as it allows your program to determine, through a logical decision, what path to take within your program's code based on various circumstances you have defined for the user. Planning the program's flow of control allows us to address what we would ultimately want our users experience of the program to be, and the best place to start with this process would be to write out a list. This list should contain a set of instructions that determine how you would like the program to work and ultimately describe a user's experience of interacting with the program. Once you have this information remove unnecessary clutter from the list and identify the key points, keep it concise and short. Once you have this list keep refining it until you have something resembling a step by step process of the tasks the program will eventually perform. An example of such a list for a guess my number game follows:
- 1. Start the game and generate a random number.
- 2. Render the space scene interface including a slider, spaceship and a panel to show user's guesses which are either too high or too low.
- 3. Click and drag the slider and a number is displayed indicating the users current guess.
- 4. When the slider is released the user's guess is made
- 5. If the guess is the same as the random generated number, show the “win screen”.
- 6. If the guess is too high, tell the user the guess is too high and increment the number of user's guesses.
- 7. If the guess is too low, tell the user the guess is too low and increment the number of user's guesses.
- 8. If the user has not guessed the number within five tries, show the “lose screen”.
Your list at this stage should start to read more like a program rather than a paragraph written in a natural language. This resemblance is no coincidence and forms the basis for the process programmers use for developing what is known as pseudo code. Pseudo Code is somewhere between a programming language and a natural language and forms the basis for stepwise refinement. During stepwise refinement rewrite your list so that it resembles something closer to the code of your program each time the pseudo code is refined. A Pseudo code example for a guess my number game might look something like this:
choose a random number between 1 and 100 set the number of user guesses to 1 get the user's guess while the user's guess is not equal to the random number and less than 5 guesses if the guess is too high tell user “guess too high” increment user guesses else if the guess is too low tell the user “guess too low” increment user guesses if the number of guesses is 5 or greater user has lost else if the guess is equal to the random number user has won
9. Implement, Test and Document. Repeat.
Implementation is the phase of software development where the actual source code is created, by means of programming.
As the code is created it should be constantly tested. This helps to identify bugs in the program during current implementation or that could occur in the future development of the software.
While implementing and testing a program it is important to document the steps taken to achieve the goals of the project. This could either be done in a comprehensive form of external documentation but should always include documentation within the code itself in the form of comments and multi-line comments.
This phase is repeatable and should be constantly updated by the recursive nature of it's design which should eventually lead to a erroneous free implementation of the software.
Comments in Processing start with the // characters and multi-line comments in Processing start with the /* characters and end with the characters */
Once the software has been thoroughly tested it should be delivered. Delivery could involve something as simple as uploading the software to a website, or as complex a task as marketing and selling the software. However you deliver your software, you should always accommodate for the delivery phase of the project uncovering unforeseen bugs and errors in the software as users test it on systems that differentiate substantially from that of the systems it was tested and developed on. As a result maintenance is a crucial part of delivery and an appropriate time-frame should always be allocated for it within software development. In some dire situations an entire redesign of the software might be deemed necessary during the delivery phase, in this case allocating a specific time-frame for software maintenance might not be adequate to accommodate the requirements of the development of the software.