Home -> Programming -> Planning -> Planning Process

The Program Planning Process

While writing a program requires us to know a computer language, planning for our program is a general process which we do on paper each time we start a new project. It does not require any knowledge of a programming language. It does require us to know what we want our program to do, and how we want the program to perform. The implementation of a new program is dependent on the language in which we intend to write the program, but the planning itself is, and should be, mostly independent of the programming language we will use. The only real link between planning and the language used, relates to the program interface. We will need to use standard VB Controls to create the form layout, so it helps to be familiar with the controls commonly used to create a program interface. First we will discuss program planning and then we will introduce the most common control objects available in Visual BASIC.

Planning is best done backwards. We start planning at where we want to end up, and then plan how to get from there back to where we are currently. We need to determine what output our program must create, what we want our program to do to create it, and how we want our program to look and behave. Before we sit down and start coding, we need to follow a process to create a plan for our program. Everyone seems to have their own model for how to do this. May I recommend the following process. It is simple and straightforward.

Program Planning Process
  1. What is the desired output or what output should the program produce?
    For this we need to determine exactly what information we will need to convey. Then based on the type of information, we decide which controls we will use. Finally we sketch on paper what our form should look like.
  2. What information (input) do we need to have in order to produce that output?
    For most program output there are certain pieces of information which need to be supplied by the user to the program before the output can be created. We must figure out what all of these pieces of information are. Then we need to plan which controls the user will need to enter this information, and finally how to organize them and present them on the form. In addition to the foregoing which is traditionally recognized as input, the user also interacts with the program, issuing commands. While not considered to be traditional input, these commands nevertheless direct the function of the program. They are a second form of input.
  3. What processing will I have to do? (How do I change the input to create the desired output?)
    Changing our Inputs into Outputs is what we call processing. Sometimes it is very simple, and sometimes it becomes very complex. To help accomplish this we need to break down the processing into manageable chunks . In Visual Basic this is done by creating controls with which the user interacts to trigger events. We then place our code in these events to convert our Input into our desired Output. The processing is thus divided into fairly small chunks. This helps to make the program simpler to create and makes the events easier to program. In particular, the planning which we need to do at this point, is to decide what events we need to make our program work. To do a thorough job of selecting appropriate events to accomplish our task, we first need to learn what options exist from which we can choose. Almost every control which exists in VB has at least one associated event. To simplify things, we will start by using the Button control to trigger our events. This is the most common use of this control. We will add more controls to our repertoire as we go.
  4. For each Event, list the actions that need to take place in that event, and in the order in which they need to occur.
    The easiest way to accomplish this is to list the last action in the event, and the first action in the event. Now starting at the last action, ask this question: What must be done immediately before this action to make the next action possible? We then proceed backwards from the last action, until we arrive at the first action. In doing our planning, these actions should be written out as a numbered list because they must be accomplished in the order we have worked out. For some actions the order is not important, but for others it is critical! The steps are written in Pseudocode - that is in English but using the algorithmic structures which will be introduced shortly hereafter.

We need to answer each of these questions, and write down the answers! Do not try to do this just in your mind. You might be able to do so after you have had much practice, but to try to do so when you are learning is to make the process of programming much harder, and the speed of learning much slower. Steps one, two and three will give you the information you need to design your form. Step four provides the algorithms for each event you will need to write the code. With the action list for each event you will know what you have to do. Then the only thing you need to learn, is how to write that action in VB code. If you do not create this plan, you not only do not know how do to a particular thing, but you do not know what you should be trying to do in the first place. Many who get themselves in this situation give up entirely. Don't try to take shortcuts, first learn how to do it correctly, then do it. First create the plan and write things down.

Once our program planning is completed, we can proceed to create the program. This too is best done by following a set of steps to ensure that nothing is inadvertently missed. This is the topic of the next section.