Industry news

Why is programming so difficult?

2021-12-09

Why is programming so difficult?

Programming description and specification differences

Programming is very difficult. In fact, it has nothing to do with the programming language. First, you must master all the practical details; Secondly, you must understand what the program should do in each case; Moreover, you must convey all the information in a way that your friends can understand. This means that you must organize the information in an organized way to ensure that it is easy to understand.
Description and specifications
It's easy to confuse the difference between description and specification, which is a thinking trap we often step into. If you have only one description ("red car"), you can test whether the actual situation meets the description ("red, but not car"), but this description is not enough to convey how to build a car. And this is the purpose of the specification.
Creating things requires a lot of decisions. If you record the results of each decision, you get a specification. When writing a program, you need to make such a decision, so just description is not enough. You need a specification. When we see a description ("list files"), it is easy to think that this is a specification, so we think we should be able to tell the computer to perform the action. But in fact, there are a lot of decisions to consider ("in what order should the documents be listed? One line for each document?")
When writing a program, the specification you get is often just a description. The computer cannot "draw a rectangle". It must know the display position, size and color of the rectangle. When writing this code, you will find many decisions that have not been made. Making these decisions requires a lot of effort. We often mistake the reason for this work and blame it on the programming language, but it's just that it's difficult to create a specification based on a description.