Blog Post: Complexity #12

Merged
jeff merged 13 commits from BlogPost_Complexity into master 2020-04-19 22:57:46 +00:00
Showing only changes of commit a91c3c36b0 - Show all commits

View File

@ -19,11 +19,13 @@ Before being able to manage complexity, it must be identified. In addition to t
#### Examples
* Run on sentences: Sentences that have too many clauses become complex because they are trying to express too many independent, but possibly related, although sometimes unrelated thoughts, and they take more mental energy to comprehend, causing the now frustrated reader to reread it until they can ascertain the author's meaning.
* Chess: At a glance, chess is straightforward. There are only six types of pieces, and the board is 8x8. The complexity comes from the [permutation of games](https://www.youtube.com/watch?v=Km024eldY1A). It takes [a dedicated decade](https://www.quora.com/How-long-does-it-take-to-become-a-chess-grandmaster) to become a grand master.
* Chess: At a glance, chess is straightforward. There are only six types of pieces, and the board is 8x8. The complexity comes from the [permutation of games](https://www.youtube.com/watch?v=Km024eldY1A). It generally takes [a dedicated decade](https://www.quora.com/How-long-does-it-take-to-become-a-chess-grandmaster) to become a grand master.
* Humans: No two humans are the same. DNA on its own is complex; factoring in the expression of DNA is beyond the understanding of any single person.
## Complex Software is Undesirable
All software is complex. Small programs, written in a high-level language, may compile to thousands of lines of low-level language. Modern software may be tens of millions of lines of high level language. By size alone, these systems are complicated. Factoring in the global communication they have to do, the complexity goes up exponentially.
All software is complex; it is one of the most complex man-made things. Physical creations such as space ships, submarines, and skyscrapers may be complex, but they are limited by the laws of physics. Software has no such limit. Using [scc](https://github.com/boyter/scc), a tool to estimate the size of codebases, it is shown to take about 16 years with 500 people to recreate [FreeBSD](https://www.freebsd.org/).
Considering the global communication they have to do, the complexity goes up exponentially.
While some complexity is unavoidable, it is best minimized. Left unchecked, it will become unmanageable and will have to be scrapped to begin again. Complex software is difficult to reason about and therefore difficult to rule out problems. This is code that an adversary would enjoy combing through, trying to find an exploit.
@ -34,7 +36,7 @@ Software engineers must create programs that are simple enough to be understood
## Simple is difficult, but effective
[An antonym of complexity is simplicity.](https://www.thesaurus.com/browse/complexity) Although it is easy to express what a [simple system](https://simplesystems.tech/blog/post/simplicity) is, it is not easy to create one. Simplicity is so effective to software, there are many books, blogs, and principles written on the topic -- even if not explicitly. A few examples of principles:
* Encapsulation: This is a very powerful idea, especially when some complexity cannot be changed. It can still be encapsulated.
* Encapsulation: This is a very powerful idea, especially when some complexity cannot be mitigated. It can still be encapsulated.
* UNIX philosophy: "Make each program do one thing well." This can save software from becoming an indominable mess. Constantly adding features to the same program will eventually make it collapse in on itself.
* Composition: Software should be composed of interchangable modules. The boundaries between modules and modules responsibilities must be well defined.