Skip to main content

How To Improve Logic Building Skills In Programming?

how to Improve logic building skills in programing-img

I frequently see beginners asking questions in forums like 'how can I improve my logic building skills' or 'how to think logically or something like 'how to think like a programmer' and blah, blah. If you have similar questions in your mind then follow along.

We are going to talk about logic and thinking. So first, let’s see how Google defines logical thinking. I am copying the first line of a Google search for "logical thinking".
Logical thinking is a process of clearly moving from one related thought to another.
Clear enough. Push the definition to your stack, we will pop it back because this article is partially based on this definition. I am just trying to make it easy for myself to illustrate and easy for you to understand.
When I write code, I usually follow three ways.

  1. Use algorithm or someone else’s code [the easiest]
  2. Divide and conquer [the hardest]
  3. Try try again [depends on your luck and mental abilities]

The points above are self-explanatory and most of you might have got an idea about what am I going to talk about. To those who didn't get anything, I will say
'NO Worries'. Let's dive (not too deep) into all one by one.

1. Use Algorithms:


Do you know what an algorithm is? A very formal, non-comprehensive and static definition of algorithm is "it is a step by step process to solve a problem". Why did I mention it here? Because I want to tell you that the problem, you are struggling to find a solution for is already solved by someone if not many. The solution might be available in pseudo code or even in the language, you are using. Do not ever hesitate to steal the code or logic. Copy and paste. It will save you a lot of time. Super easy. Isn’t it?
Well, as far as I think this method has nothing to do with logical thinking or logic building skills and you might think the same. Then why we are discussing it here? Wait, we are missing something. Copying is just a piece of cake. The logical part is, where to paste the code into your code. Keep reading. The answer is coming ahead.

2. Divide and Conquer:


This is the hardest but the most effective method of building logic for a program. For your ease, I have divided it into further 5 steps. I myself use this method most of the time but I do not label the steps. I have just named these to make it easier for you to understand.

i. Understand the problem 

Understanding something quickly and thoroughly is an art. It depends upon your interest, your curiosity on knowing and learning, and the time since you have been in the field. None can come up with a solution without understanding the problem. This is the very first and essential step of problem-solving. Try to understand the problem as much as you can. The more you understand the problem, the deeper you will think about it and the less time it will take you to solve. How to better understand a problem? Read Herehttps://open.buffer.com/5-whys-process/

ii. Break it into parts

This part is likely to be hard for you if you didn’t do well in the previous phase (understanding the problem). It is necessary to look at the big picture before narrowing it down and down to very simple units. You need to use your deductive skills to figure out what you need to do. Remember, success in the first try is not guaranteed and if you succeeded, take it as a compliment. If you failed, don’t lose heart. Try again and again until you satisfy yourself enough. Once you know about the composition of joints, break them.

iii. Understand each part

The deeper you dig into a problem, the closer you will get to its solution. Understand each part individually and iterate step ii and iii until you are clear enough about the requirements.

iv. Solve each part

This is where you will need your determinism and logical thinking skills. But as compared to thinking about a really big problem, it is easier much easier to think on a little tiny part and you will feel it.
You should know where to write what. By writing, I meant writing code. I am thinking to make a cheat sheet for beginners which will help them in making if-then logic easily. Instead of scratching your head for hours and write your own logic there is another way available. That way is already discussed in 1st section. Borrow the code or algorithm.  Pop the definition of thinking logically. See the backward and forward movement.

v. Combine

Finally, If you are this stage, guess what? You are done. All you need is to glue the tiny solution together to get the final product. This step is the reverse of step 2.

3. Try Try Again:

This method is based on brainstorming. The process is very simple. Apply each and every solution which come to your mind and test if it works.
Note: Don't forget to make a backup before testing because during the test anything which you might not expect may happen. For example, the app/editor can crash and more likely you will lose your changes.
It is good to make test cases and try one by one. Keep those which work and discard the rest. Do not worry about the quality of the code. Just try to make it work.
I personally use this method when I need to write code for something less valuable like school assignments or for debugging, where the quality of the code does not matter. However, you are free to refine the code up to any level you want.

Alright, we are done for today. I was just an intro. I will write in detail for each of the above topics. Believe me, programming is easier than you think but if you understand the trick. Happy Coding.

Comments

Popular posts from this blog

How Big Data Analytics Can Help You Improve And Grow Your Business?

Big Data Analytics There are certain problems that can only solve through big data. Here we discuss the field big data as "Big Data Analytics". The big data came into the picture we never thought how commodity hardware is used to store and manage the data which is reliable and feasible as compared to the costly sources. Now let us discuss a few examples of how big data analytics is useful nowadays. When you go to websites like Amazon, Youtube, Netflix, and any other websites actually they will provide some field in which recommend some product, videos, movies, and some songs for you. What do you think about how they do it? Basically what kind of data they generated on these kind websites. They make sure to analyze properly. The data generated is not small it is actually big data. Now they analysis these big data they make sure whatever you like and whatever you are the preferences accordingly they generate recommendations for you. If you go to Youtube you have noticed it kn…

How Computers Understand Human Language?

How Computers Understand Human Language? Natural languages are the languages that we speak and understand, containing large diverse vocabulary. Various words have several different meanings, speakers with different accents and all sorts of interesting word play. But for the most part human can roll right through these challenges. The skillful use of language is a major part what makes us human and for this reason the desire for computers that understand or speak human language has been around since they were first conceived. This led to the creation of natural language processing or NLP.
Natural Language Processing is a disciplinary field combining computer science and linguistics. There is an infinite number of ways to arrange words in a sentence. We can't give computers a dictionary of all possible sentences to help them understand what humans are blabbing on about. So, an early and fundamental NLP problem was deconstructing sentences into small pieces which could be more easily…

The Limits of Artificial Intelligence

If you are here, it means that you are familiar with term artificial intelligence. Either you have read about it in school or have seen it in sci-fi movies or somewhere else. Talking about the limitations of AI, let me ask you one simple question first, do you know the definition of AI? You might be thinking to answer me with a yes, yes I know what is artificial intelligence. But what if I tell you that AI is a buzzword and it is almost impossible to properly define. It is this way because the definition of artificial intelligence is moving. People don’t call the things AI that they used to call. For example, a problem that seemed too complex to be solved by human and was solved by AI algorithm is no longer a problem of AI. Playing chess, is one of the examples. It was considered the peek level of artificial intelligence back in previous century. Now it hardly fits the criteria for AI. It is presented to the world as a super power that when given to a computer, it magically starts li…