A lot of e-mail people ask me how to start a program or another. Perhaps the best advice is to just start writing a presentation for the program: once you start writing the ideas or codes that begin to get an idea of ??your project. There are two standard methods of program design: the top-down approach and bottom-up approach. top-down programming involves writing code that calls functions that have not been defined and working through the general algorithm before writing the functions they perform processing. top-down programming is largely a very abstract way of writing code, and that starts with the use of functions that have been and who may not know how to design. The bottom-up approach to programming is the opposite: the programmer writes the basic functions that realizes it will be necessary at some point in the program and then work up to the most complex parts of the program.
Interestingly, both approaches focus on the actions of the program rather than the objects it manipulates the program – variables. Often the best way to write a program to determine the variables that have to work to progress and then a top-down approach for the program to manipulate the variables. By defining the variables and then work with the functions that work in them, will always remain a cornerstone of what the program should be doing. Once you have an idea of ??what variables to use, then you can write functions to perform the operations to be performed on the variables while keeping sight of the goal. Finally, you can write code for each individual function.
Another value to the definition of the variables before writing the code is that many times you can make an entire program without many features, this is especially true when you are a beginner doing simple programs. The variables are the raw materials it needs to start working with the tools: loops, if statements, the library functions and user defined functions maybe.
Let’s look at an example of how to think in a program. If I had to write a program to simulate a system of video rental store that calculates the gross income from rentals, you may be asked to write a program that accepts a code that tells whether a video was rented at $ 2.00 (input and 2) one (entry 3) days or $ 3. 00 a day and asks for how many days it is rented for, finally, if the code for the cost of rent is 0, the program must end. You should also count the number of days rented videos at $ 3.00 per day and $ 2.00 per day. The best way to think about the design of a program like this is to imagine what information you need to store in order to calculate the income:
* You need a variable to store the total dollar amount at the end of the program;
* You need a temporary variable to store the code for the cost of a transaction;
* You need a temporary variable to store the number of days it was rented for a specific video;
* You need a variable to store the number of days it was rented each video;
* You need a variable to count the total number of days rented videos are $ 3.00;
* Finally, you need a variable to count the total number of days rented videos are $ 2.00.