Welcome to this first lesson, in which we will talk about how to deal with a computational problem, and the necessary steps that you should follow to solve it.
The three steps
When faced with a challenging computational problem, it’s sometimes tempting to start programming right away.
While many students might feel like they’re not making progress if they’re not writing lines and lines of code, this just isn’t true.
If you wanted to build a house, would you start stacking bricks right away? I don’t think so.
So, each time you’re faced with a computational problem, there are three consecutive steps which should be followed:
- Formalize.
- Specify.
- Code.
To formalize means “to express a problem using adapted terminology and concepts”.
In this course, we're going to program an AI to play a game in a maze.
So the first step will be to understand how to represent and manipulate mazes.
To do so, we will refer to graph theory, which is a common mathematical framework that helps us to formalize numerous problems.
Programmers that overlook this formalization step are likely to encounter unexpected issues.
In simple cases, this could simply delay their work.
But in more severe cases it could mean that all the work produced so far is useless, and that they need to start again from scratch.
Specify
Once a problem has been correctly formalized, it’s time to specify a solution.
To specify means "to identify algorithms or methods that are well suited to solve the formalized problem".
For example, in this course, the AI that you will implement will have to move around in the maze.
Therefore, we will discuss methods to find a shortest path in a graph.
Methods such as this can be used to identify a solution.
Specifying is of paramount importance, and allows us to make the right choices with consideration to the problem at hand.
Specifying also reveals the global structure of the solution, which facilitates team working situations, in that all individuals are aware of exactly what they are expected to do.
Code
Finally, once the problem is specified, it’s time to start coding.
Coding should always be the last step in solving a computational problem.
Coding should be quite straight-forward if the formalization and specification steps have been correctly completed, and should follow on smoothly from the specify step.
Concluding words
This concludes today’s lesson. You’ve learnt today that, when developing, it is best not to start coding right away, but to first think a bit about how the problem is formalized, and how a solution is specified.
In the next video, you’ll learn about graph theory.
See you soon!