Solving problems – the problem resolution process

Before I start with the more technical stuff about programming I’d like to write about how to solve problems with a predefined algorithm (an algorithm is a set of instructions that are executed the same way as they are written to solve a problem). The step of solving a problem, the problem solving algorithm is:

1 – Determine the Purpose
2 – What are the Required Data
3 – Determine the Logic
4 – Create the Computer Program
5 – Test and Re-test

1) Determining the process: before you start you have to know exactly what the problem is and what is required. So read carefully the problem given, so that you are sure you’re solving the problem being asked. A serious problem is to spend a lot of time writing a program to solve a problem that no one wanted solved. Keep an eye on that, because a lot of students in college make those kind of errors and fail exams just because they didn’t read the problem at hand carefully or as much as needed to understand what is asked.

2) What are the required data: now that you’re sure you know what the problem is exactly you have to have all the data that is given to you by the problem, and ask for all the other data that you need in order to solve the given problem.
In example: you need to calculate the area of a circle, the formula for doing that is C = (pi)*r^2. You already know the value of pi (3.14) but you don’t know the value of the radius r, so you have to ask the user for it in order to calculate the area.

3) Determine the logic of a program, also knows as the algorithm of a program is the sequence of instructions required to create the solution, answer to your problem. Although it may seem difficult to determine the logic or the sequence to solving a problem, it’s often simplified by starting the thinking process instead of worrying about whether it can be done or not. You can always erase the bad algorithm from a piece of paper where you have written it down.
The algorithm for solving the previously mentioned problem would look something like this in pseudo code:
define known values ( (pi) in this example)
get the required unknown values (radius)
calculate the area (C = (pi)*r^2 )
output the data for the user (print C)

An alternative to pseudo code would be flow charts. Use whatever you think it would help you more.

4) Create the computer program: this is the part where you have to write the computer program that solves the given problem.

5) Test and re-test: many programmers become confident of their skills to the point they neglect to adequately test their programs. The worst thing for a user is to trust a program will work and have it fail because the programmer couldn’t be bothered to spend enough time working through the program to minimise potential problems.

This is, arguably, the best way of solving a problem for software engineers. You can skip some of the steps but only do that when the problem is very simple, if the problem is complicated than it’s better you do it this way. No matter how skilled you are, this way you will minimise the chance of error by a big degree.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: