We took a look into the basics of writing a computer program and the importance of "logic" in computer programming. We take the same topic forward here to look into tools that facilitate the same and help device a clean, clear and efficient logic to write a program.
Ok, so now we have a task to write a program for and we have the logic in mind. Although you can simply scribble down the key to the task and start along with writing the program, it is advisable to follow some organized approach in formulating the same. This leads us to what we call an algorithm. Infact, if you see the previous article, the example that we used there actually implied the use of an "algorithm". The steps we listed out there can be collectively termed as an "algorithm" for the problem we had at hand, namely - finding the average of numbers, or, finding the smallest number.
So what is an algorithm?
An Algorithm is a sequential and logical list of instructions to solve a problem covering all possible alternatives. Points to note:
- It is a sequential list of instructions
- Is done informally using a pen and paper i.e. it is NOT a formal program that you feed into a computer
- Being written in simple English, it is easy to write and debug
Some standardization and uniformity can be brought into algorithms through the next concept we look at - a flowchart.
A Flowchart is a diagrammatic representation of an algorithm using standard symbols and checks the flow of logic running through it.
Other Steps in Problem Solving:
- Once we have an algorithm/flowchart ready, we move towards the next step in problem solving which we call coding. Coding is basically transcribing or translating the simple English instructions (algorithm) into High Level Code which can be fed into the computer.
- Once we write the program and feed it to the computer, we next have to perform a Dry Run on it, implying, we need to test it using raw data that exhausts all possibilities and tests all limits and conditions of the program
- Errors, if encountered as we test the program, need to be eradicated - which is called debugging the program.
We shall be making use of algorithms in understanding the logic behind solving the problems as we write programs. We have now the base and understanding of concepts to take our first steps towards writing programs.
Write A Program is a technology blog that includes news, views, articles and opinions on mobiles, gadgets, computers and latest technology trends/news. Visit us here [http://www.writeaprogram.net]
No comments:
Post a Comment