Resulting from a preparation for an interview, I realized that I had never thought about the way I solve problems. I just did it. It’s like if someone ask you `describe how you breath’. This blog post results from my efforts to describe a methodology that paradoxically enough, I never had to formalize before.
I tackle complex problems with a `divide and conquer’ approach, subdividing my initial objective into smaller, simpler problems for which I have possible solutions or I can further subdivide.
Obviously, it may be the case that I don’t know how to subdivide or solve a problem. In those cases I do several passes of brainstorming and research to both gain understanding and propose solutions.
When doing research, I try to focus on the sub-problem at hand. Mind maps helps you a lot to visualize where you are and what exact information you need. Learning is iterative, as I go deeper only in the areas I need, minimizing effort, time and budget assigned to the problem.
This mental process is aimed at receiving as input a more ore less well defined problem and produce as output a list of task that I know how to solve.
Case Study: The Families in the Sea of Nodes
When trying to modify the C2 compiler to include Approximate Loop Unrolling, I was faced with the problem of understanding the ‘Sea of Nodes’: the internal representation of the C2. Specifically I needed to know what nodes were needed to implement the optimization. As you can quickly realize, this is a sub-problem of the “Implement Approximate Loop Unrolling in the C2 compiler” super-problem. The challenge here is that the C2 meta-model is composed by more than 380 classes of nodes. Understanding all of them was wasteful in both effort and time. The solution to this is was to divide the nodes into families, allowing me to quickly discard larges amounts of node types at once. As result of this understanding, I managed to reduce the interesting types from 380 classes to 5 classes.
The following two images illustrate this process. The first one shows the whole meta-model printed in my whiteboard:
The second image is zoom into the previous one, allowing to clearly see the families. I divided the nodes by their function and in the picture we can can see nodes belonging to the ‘Load’, ‘IF’ or ‘Add/Muliplication’ families. This mental map helped me realize that many nodes classes are but an specification of their super-class to a certain kind of data, allowing the ‘Sea of Nodes’ to be a type safe representation.
I have found this method to be quite effective during my whole career. Also, I use this is `divide and conquer’ approach not only for problems at work, but to situations in my daily live. This allows me to tackle complexity and have an clear way of building a concrete work plan toward results.