Why is it difficult to learn programming?

A few months back I followed an on-line programming course on the platform coursera. To gain more credits on the course students were encouraged to write essays. One of the essays asked why learning to program is difficult. Below is my answer.

Learning to program is difficult because it is similar to learning a new language. In learning a new language one encounters new grammar, syntax and semantics. The more the new language differs from one mother language the more difficult it will be to learn the new language. In spite of the fact that the structure, syntax and grammar of programming languages is less complex than in spoken languages, programming languages have abstract characteristics which make them difficult for human minds to understand them.

Humans expect the code to be similar to spoken languages. However, concepts as variables, function, iteration, control statement, flow, or recursion have no counterpart or even use in spoken languages. Moreover the interpretation of spoken and programming languages is different. A computer interprets only statements with correct grammar, syntax and structure. A human being will try to interpret someone’s meaning even if grammar, syntax or structure are incorrect. For example, when conversing with a child or a foreigner, we will eventually figure out what they mean regardless of errors. A computer will rudely reply with an error. That is frustrating. The interaction between a human and a computer is also very different, a computer will only answer yes or no, or will offer to do something ten thousand times for you. Also, the context of the conversation is absent in communicating with computers, since a computer reads a line at the time. How could we understand someone’s message processing forgetting the previous sentences and not predicting the future ones?

To learn programming languages one needs logical thinking, understanding flow and how to control it, understanding that data must be stored into a variable of the proper data type. This requires the human mind to reset to a down-to-hearth-thinking. When this is mastered, error interpretation is the next obstacle. Learning what error an interpreter is returning is simple. Difficult errors are the one returned by code that runs, but returns wrong results. It is as writing a perfect sentence with one meaning for the person writing it and another for the people reading it. How does one write a statement that is unequivocal?

Human predisposition to interpret language is also problematic for programming. When I started programming I accused the computer of doing things wrongly. Now I know that it was I who was interpreting programming instructions as language expressions, therefore giving wrong/less instructions. I thought the computer would understand what I wanted it to do. Computers do what one tells it to do, they don’t interpret instructions. Whereas a human being can finish a sentence for you because it has semantic information, the computer cannot. Similarly if there are not all the programming statements to perform an operation the computer will just do what it is told to do and stop at that. This took me long to understand.

Mastery of computer programming requires time and repetition, as with a spoken language. But there is an advantage in practicing communicating with a computer than with a human being. A human being will get tired, bored or will have to do other things. A computer will continue forever, or at least until we haven’t fried the CPU or consumed all available electricity. A computer is there for us to do something with it. And this is very precious if you aim to be an awesome programmer.

Last but not the least, as with spoken language programming languages allow creativity. There exists beautifully written chunks of code, simple, clear, compact and to the point. This is also true in the poetic sense as hermetic poetry.

Why is it difficult to learn programming?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s