How to think logically?
This is the question in every beginners mind because Logical thinking is essential for every programmer. The students, who are into programming and learning it, should be capable to think logically but basically most of the beginners suffer a lot to think logical and improve logical thinking skills. In this post I will explain you about how to think logically while programming in order to develop logic for certain program.
What is logic?
Logic is a small code snippet or the part of a program which consists of set of instructions to solve the given problem. Logic of the program consists of the actual statements which are to be executed by the computer in order to solve the problem. The logic for solving a problem is developed using set of instructions and embedded them in a program by following the rules of writing a program.
How to think logically in Programming?
Every programmer should think logically in order to develop logic for a program but the problem arises here is how to think logically? So in order to think logically we should learn how logic will work and how to develop logic for a program.
How to develop logic?
To develop logic for a program we should be capable of thinking logically. Only a logical thinker can be capable of developing logic for a program but most of the programmers and beginners struggle a lot in order to improve their logical thinking skills.
Points to remember while thinking logically
- Feel you are talented than computer (Which is the truth)
- Recall all programming concepts that you have learnt.
- Imagine yourself that you are the machine.
Feel you are talented than computer (Which is the truth)
Always feel that you are talented than computer. This will increase your confidence level because computer cannot understand anything unless we write a code for it. We will write logic for a program to solve a particular problem using computer so without our logic a computer cannot solve any problem. A computer is in need of our logic to solve a particular problem. The computer works only on the basis of the code we write to it. This code is nothing but the logic for a program so what you say now? We (the code developers) are talented? Or The Computer?
Recall all programming concepts that you have learnt.
Developing logic is nothing but using the available resources in a particular way to find the solution for the problem. So it is necessary for a programmer to learn all the programming concepts and recall them while developing logic for a particular problem. Developing logic for the code becomes easy only if we have a good command over all the programming concepts because concept is the king in logic development without knowing the concepts, you cannot develop logic for any code. So first learn the concepts in programming and recall all those concepts while developing the code then you would become the king of the programming world.
Imagine yourself that you are the machine.
For a while, forget that you are a human being and imagine that you are a machine so as a feature of a machine that it can’t understand anything on its own. If a machine can’t understand anything, then we will give some instructions for the machine in the form of program to follow them in order to solve a problem.
So by thinking in a machine oriented way, you can be capable to write logic for a program which is used by the computer to solve the problem. Machine oriented thinking is nothing but just forget everything and imagine that you cannot able to think anything. Just imagine that you are just like a MP3 player which plays/resumes upon the instructions given to them. So if you think that you are a MP3 player then you will move forward if you receive an instruction to move forward. You pause for while if you receive an instruction to turn pause. So by thinking in this way you can have grasp over how a machine will work and how to give instructions to a computer or a machine so that they are made to understand the work to be done.