In a previous blog post, I expounded upon the notion that a blockchain can be likened to a special kind of a linked list. Unbeknownst to me, the binary tree too possessed the remarkable ability to ignite a circular economy consciousness within me.
In my computer science class, we recently developed a program to store the states of the United States in a binary tree. In the initial stages, we were tasked with the responsibility of conceptualizing a framework (specifically, for the well-informed individuals in the field of computer science, it was a Java-based course). In the aforementioned framework, our primary objective was to furnish a set of methods or functions that would facilitate the execution of various use cases. These use cases encompass tasks such as the loading of data from a file, the insertion or removal of a state, the search for a specific state, the printing of states in a desired sequence, the traversal of a tree, the search for a specific state, or the act of clearing the structure and commencing with a fresh list, such as loading data from a new file. The aforementioned use cases were presented as a series of prompts to the the user interacting with the state tree system.
By outlining the methods that would be required to be reused throughout various prompt - data loading, insert operations into the tree, printing the tree, returning the size of the number of states in the three, and cleaning the tree - the assignment made our tasks easier.
As a consequence, we were able to apply our operations across multiple use cases. As an illustration, in order to display the states, one could employ methods such as loading followed by traversing. In order to initiate the loading of a new file, one would choose to use a series of methods, such as clear, load, and traverse.
However, what if our program was developed without a meticulously crafted guideline for formulating methods pertaining to reusability of our code? So now all the “code” we wrote to print the state would be in one large function. And we would write identical code over and over again (i.e., discard our previous code) to accommodate a different use case (i.e., load a new file with new states).
A software program that does not include any application programming interfaces (APIs) or methods is analogous to a production model that is based on a linear economy. In this approach, there is no consideration given to how the various components can be reused beyond the lifecycle of the use case.
A software program that incorporates application programming interfaces (APIs) can be likened to a circular economy framework, wherein every constituent of your product is meticulously engineered to facilitate its reusability. Similar to the program incorporating APIs, a circular product has been meticulously crafted with a focus on circularity, mirroring the principles of modularity, reusability, and the division of components into smaller, reusable units.
I encourage everyone to consider and compare circular and linear approaches in various fields such as programming, chemistry, architecture, gardening, literature, and fashion.
Comentarios