Unofficial guide to Programming

Many of the people around me have asked: “How to learn programming?”. But the second wrong question which most of them ask next is - “How to write this or that in C?”. I think the second question is wrong because programming is not a language constraint. It never is. Programming is all about developing solution no matter whichever language you choose. Its all about learning the use of the language's keywords. C has 32, Java has 50 and so and so for other languages.

Getting Started

Variables or data types are you bullets and statements are your weapons. Basics of programming concepts must be clear to you before you actually do any programming. Assume the compiler as the one who does the job for you, but he only understands an alien language. So, you too have to speak that language – ie learning which keyword means what. Fundamentals of programming language can be found in any decent book, so I am cutting that crap out of here (I believe you already know that). I am not going to argue between compiler vs interpreter or procedural vs object oriented programming. That's your decision to make as per your requirement. But the common things in these all is – the approach to solve a problem.

The Problem

What is a “Problem”? In computer science we define problem to be a task to be performed or solved. Adding two number is a problem in programming. Ohh you didn't get it. I didn't mean: "Write a program to add two numbers". What I meant is - "In whatever way you like, how would you add two number?" Anything (small or big) is a problem in programming.
(Note: A problem is not a question to be answered, its something to be solved)

Why is it a Problem? Answer to this simple - “If there is no problem, there is no solution”. In computer science everything is a problem for us or else we don't move our ass to solve those :P Maybe that helps psychologically 'coz we need solutions to our problems.

Decoding a Problem

Unless and until you understand the problem, there is no point trying to solve it. First understand the problem definition. Try to relate that to real life scenario. Eg: how would you calculate 8+4 in real life? - Many of you might have already started counting in your finger tips. See that's a solution, but not the only one. Thus there are many ways to solve a problem. This is a simple solution but not the best. I am simple trying to explain how to think for solutions. For bigger problem breaking into small parts will make life easy.

Now to be a programmer, you are supposed to speak that alien language. Relate the real life solution and think as the alien's mind – considering the finger tips solution, you may consider incrementing an integer variable 8, four times to get the result. I like to think beyond one solution. Finding alternate solution is a fun learning process. Question every step and try to find a better one.

"Doubt yourself and you doubt everything you see" - Socrates

Coding the solution

Once you have a clear picture of the problem and have decided the solution path, you are ready to code the solution to your problem (speaking alien language). Do keep in mind that computer understands only 0's and 1's ie either TRUE or FALSE. You have to forget about human emotions while speaking that alien language (unless or until you are dealing with AI or some advance topics). Your variables cannot be "To be or not to be" like human minds. Always think discrete.

Many times people are unable to figure out which data structure to use. Sometimes its hard to relate the real world elements to programming constrains, because some programming concepts are abstract (does not exists physically). Your mind is your best friend here - make up any logical/non-logical imagination to understand those concepts. Another simple way is trial and error method :P


Tips: Do not freak when you see compilation error. Stay clam and cool.

Read the error message line by line. Most of the time it will show which line numbers are causing the errors. Investigate those lines. If you don't find anything wrong with that line check the preceding line or the line below it. A single semicolon can also cause you trouble. Solve the errors one by one. If you are following top to down approach and is stuck in a line, consider skipping that line for sometime.

Another problem is wrong/undesired output. This is mainly due to logical error and sometimes garbage value. To solve this problem use Dry run table. Through this you can analyse the values of each variable in every steps. Hope you spot the error.


Some errors are run time. They may be due to program argument(s), input(s) or logical (index out of bound etc.). Make sure you are providing the right inputs and arguments. Printing the values of variables in different section of the program will help you to figure out at which section of the program it went wrong.

Even if you are still unable to solve the problem, following those steps will help you understand where you are stuck. Google about the thing where you are stuck (I am not suggesting to search solution of the whole problem) or get help from your friend :P

I would love to hear your feedbacks and suggestions. Leave a comment or tweet me @srajbr

Samiran Raj Boro

Software Engineer, Freelancer, At most like to be student.

  • Guwahati, Assam, India

comments powered by Disqus