Coda: Learning From Structures Around Us – Hacker Noon

An Observation on Software Engineering From Our Environment

A tree in the neighborhood.

Trees in my neighborhood seem to grow unnaturally. They appear as sick twisted living creatures. The reason for their ugliness is related to their proximity to electric utility lines. This is common in northeast of the United States, a place where trees exist in the right-of-way and extreme weather patterns are present.

Utility lines are at risk of falling tree limbs because they are vulnerable strung pole to pole. The result is the energy company must prune trees to certain distance specifications. This reduces the risk of branches touching these wires. Pruning allows for repair access. When the weather is uncooperative, pruning keeps the lines protected. However, the result is ugly looking unbalanced trees.

The Science of Trees

In computer science, we use metaphors. This is because our science is highly abstract and construction is virtual. Most construction, if we even call it this, cannot be seen or touched. Regardless, we need to communicate what we see based on our world. We have to communicate what is efficient. We have to communicate maxima and minima, time and space.

A binary search tree.

Searching for data is fundamental to our science. To do so, we organize the data with structure. A tree is this, an abstract data type. It looks like a living tree, but upside down. The root is at top. We use trees to structure data so that it can be sorted and searched efficiently. Trees take on types and flavors, just like real trees do.

An unbalanced tree is a metaphor that is used to describe an unwanted structure. This is because it is not optimal to search the data it contains. Unbalanced trees are naively grown and trimmed. They begin to slow us down due to their unchecked height. They grow too high on one side.

How To Balance an Unbalanced Tree

In the process of saving customers from blackout or service interruption, power utility authorities trim left or right. They trim where the risk is great. The result are unhealthy trees that are unsightly to look at. They think that the tree is performing its function, but instead it is sick trying to survive.

Courtesy: Google

There are ways to save the sick tree programmatically as it grows. Depending on the tree, we can transverse, rotate left, rotate right, or double rotate. We attempt to balance the tree so that its healthy. Its structure becomes more compact, more beautiful and elegant than its current shape

However, if the unbalanced tree is given enough space in front of it, either physically or virtually, there is a way to solve their blight at the root. We cut down and start over. We grow the new tree intelligently on the next pass.

Learning Cues are Around Us Waiting to be Leveraged

The mutilation of trees to make way for utility lines invokes conflict. An abstraction of this observation would suggest that community and technology are in contention. If either are grown improperly, there is difficulty in remedying because both are supportive of one another.

Courtesy: Google

The beauty of computer science is we can invent and grow structures based on our physical observations. Perhaps ancient tree pruning technique such as Topping or more modern technique such as Drop-Crotching may apply to computer science. Utility lines that are strung or laid may also have their analogue. How they work together may be of interest of further research.

The message is to look around outside to learn and apply what we observe, virtually. Question if it could be a chance to translate a structure or system into something that can be leveraged for beauty and efficiency. This is because in conflict, if we embrace the problem, there is a chance for opportunity of structural invention.

read original article here