Good programming is based on three simple statements:
- Programmers must write code that a computer can understand.
- Programmers should write documentation that people can understand.
- If these are separate documents, it is inevitable that they will not be synchronized.
In fact, in my experience, No. 2 is usually short. I lost track of how many times QA told me: “Doc says this, but code does it: incorrect code or outdated document”? In this regard, I do not expect my workplace to be unusual. In addition, in one of my early projects, I tried to keep the documents up to date, as back and forth with interested parties led to a change in requirements. It was quite laborious, and I was told that management should stop messing with documents and just make the project work. Since then, we have moved on to less labor-intensive documentation processes (thank God!).
We have tools for checking the code, where when we make changes to the code, several people can see the changes, clearly outlined and comments that can be asked, ask questions, explain things, suggesting improvements. If the code was written using proper programming techniques, most of this question / answer would be super-continuous because an explanation would be included.
Most of the thinking of modern programming is that your code must be its own documentation. Many experts argue that if you need to explain your code in the comments, you should probably reformat the code (changing the names of variables / functions, etc.) so that the comments are not used. I think this is great in theory, less practical in reality. I mean that when I use libraries created / supported by someone else, their choice of method / function names is not always intuitive for me. For instance:
Set<String> statesWeCareABout = new HashSet<String>(Arrays.asList(new String[] { "one", "two", "three" })); Set<String> statesWeFound = <some function>; statesWeFound.retainAll(statesWeCareAbout);
If you are not familiar with Set <> or HashSet <>, you may not know that .retainAll () means giving me the intersection of the two, with the result in a modified Set <>.
Finally, good programming usually allows you to break things down so you can explain this part of the code in isolation, and then paste it into this other piece of code. This is more in line with how human understanding works. Explain to me how this works, and then relying on this understanding to explain the big picture. Computers really don't care; you can write one function with 1000 lines of code, and it has no problem comprehending all this. God will help you if you, as a developer, must support this.
And this, indeed, is an argument in favor of Competent programming. The code must be saved, be it bug fixes or features added. And if it cannot be understood by someone else, later, in an effective way, it will be replaced. In this world, there is a way to write a lot of code. Good programming makes reading and understanding easier, making it more durable and durable.
And do we really have time to keep reinventing the wheel?