Updates from 04-10.
This commit is contained in:
parent
e212e6fed5
commit
2b391b1c7c
46
content/blog/complexity.md
Normal file
46
content/blog/complexity.md
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
img: /img/complexity.jpg
|
||||
title: Complexity
|
||||
author: Jeff Russo
|
||||
pdate: March 28,2020
|
||||
desc: What is complexity as it relates to software?
|
||||
---
|
||||
The most [relevant definition of complexity](https://www.lexico.com/en/definition/complex) for this blog post is: (adj) "Not easy to analyze or understand; complicated or intricate." Intuition of complexity is important if you are designing, writing, or reading software. If you are purchasing software, it is important to prioritize simpler options; it will be cheaper in the long run. In this blog post, I will discuss identifying complexity, why it's bad, why simple is good, and how software engineers manage complexity.
|
||||
|
||||
## Identifying Complexity
|
||||
Before being able to manage complexity, it must be identified. In addition to the definition it is helpful to know indicators and examples. Seasoned engineers sometimes call these smells; complexity is not black and white, but more of an intuition. Some things that are simple now will be come complex in the future.
|
||||
|
||||
#### Indicators
|
||||
|
||||
* Incomprehensible: Something complex is difficult to comprehend or articulate. It may have too many parts, or the interaction between the parts is complicated.
|
||||
* Fragile to change: Complex things are not easily modified. An internal combustion engine is complex. If one was to modify the bore of the cylinders, special machining and new parts are required.
|
||||
* Multi-purpose: A tool that can, "do it all," usually does nothing well due to its complexity.
|
||||
|
||||
#### 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.
|
||||
* 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.
|
||||
|
||||
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.
|
||||
|
||||
## Software engineers program, but programmers do not engineer
|
||||
A programmer understands software languages and can program a computer to accomplish tasks. A software engineer will do the same, with the addition of minimizing the program's complexity. In fact the act of minimizing the complexity may take up almost all the time of a software engineer. Many other tasks such as designing, testing, documenting, refactoring, and code reviews are much more time intensive -- and important -- than the actual programming.
|
||||
Software engineers must create programs that are simple enough to be understood by other engineers. This enables others to work on the project and create something greater than the sum of the engineers' abilities.
|
||||
|
||||
## 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.
|
||||
* 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.
|
||||
|
||||
None of these principles are easy to carry out. There is both a science and art aspect of designing and building something in a simple manner. Once a system becomes simple, the benefits are exponential. One important benefit for teams to think about is number of engineers who can work on a project. If a system becomes an interconnected mess, usually only 1 or 2 people can work on it simultaneously. If a system is well designed, especially using modularity, the number of engineers who can work on it simultaneously is practically unlimited, because each module is independent.
|
||||
|
||||
##### ? Monero provides a simple interface, but it was not easy to create. There is a lot going on behind the scenes.
|
||||
##### Reference Rob Pike's comments on GC (The simplest interface is none at all) https://www.youtube.com/watch?v=rFejpH_tAHM
|
||||
##### MVCC ? Maybe a complex topic for a post on reducing complexity
|
||||
##### ? design patterns
|
BIN
static/img/complexity.jpg
Normal file
BIN
static/img/complexity.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
Loading…
Reference in New Issue
Block a user