"Code Encyclopedia" Reading Notes (Part 1)

  I am most impressed by the point mentioned in the book, which is also mentioned in "Myth of Man-Month", that is:

  The core of software design and development is to control complexity

  The core of this sentence actually includes several questions:

  The essential problem of software development is complexity?

  How to reduce the complexity of a certain program?

  Among them, the reason why the book must control the complexity of software design is:

  No one's brain can hold a modern computer program, which is to lose, and we shouldn't try to cram the entire program into our own brain at the same time, but try to organize the program in a way so that we can You can focus on one place at the same time. The idea is to minimize the amount of procedures to be considered at the same time. You can think of it as a kind of mental juggling or more than two objects held in the air at the same time) - the more (mental) balls the program asks you to hold in the air, the more likely you are to miss one of them, resulting in a design or coding error

  When I read this paragraph, I felt that the author of this book really expressed the pain points in the hearts of software developers. I also think that this paragraph can be said to be a core of the book. In fact, all parts of the code are in the Around "how to reduce the complexity in software development". The author uses this, juggling the way of tossing a ball very vividly, which is caused by the inherent limitations of our brain (biological structure). There was once a very famous American According to the survey, the short-term memory of the human brain can hold the largest number of discontinuous information is 5 to 9

  For details, please refer to one of the most cited papers in psychology: the magic number seven, plus two or minus two: the limitations of human processing power.

  In the real problem domain, we have to deal with more than 7 variables!

  So it is impossible for us to have so many variables appearing together in our brain at the same time.

  Entropy reduction

  In fact, the complexity of software is, in a sense, understood and enhanced by the second law of physics. The second law of physics is also known as the law of entropy:

  In a natural process, the total disorder (i.e. "entropy") of an isolated system does not decrease.

  The entropy of software always tends to be maximized, which programmers call "software rot".

  Only in the process of development, programmers can continuously do external work (thinking, active thinking and code changes), continue to refactor and organize code, and inject energy through external systems to reduce the entropy of the entire software system. to an orderly state.

  For this reason, the software development industry has put forward a series of principles and guiding methods, refactoring/unit testing/modular design/KISS principle/interface-oriented programming/pattern design/distributed system... etc. In fact, you will find that these methods and guiding principles, all tell programmers that in the process of software development, the overall complexity of the software system can be reduced by these methods, so that the later maintenance and development can be better. When the software complexity can be well controlled, instead of Let the entropy of the software grow infinitely, then the life of the software system will be very long and better maintainability.

  So, in the end, we know that the essential problem in software development is complexity, then we should always actively think and do work in subsequent development: how to reduce the overall complexity through continuous code refactoring. Keep our code entropy minimize

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325031873&siteId=291194637