Solving problems

In high school I always wondered how some kids memorized all the math formulas. Especially the long ones. I am not particularly good in math but since I am terrified with the idea of giving up I kept at it until I found ways to deal with it. I couldn't memorize the formulas but knowing the first few digits of a sine and cosine of special angles (30,45,60 and so on) proved to be very useful. I loved computers since I was a kid and I was labeled the computer guy in the family. Everyone came to me (and still do) to get help with the Microsoft Word issues, Excel, modem setup, unresponsive mouse, broken screen (not that I could do much with a broken CRT monitor), driver update, unplugged cable, and so on. I may be very disorganized but one thing I can say for sure is I almost aways find a solution to the problems presented to me.

Let me be clear, my problem solving skills do not include any of those famous unsolved math problems. I have no intention in venturing these waters and even if I did nothing good will come out of it. I don't want my very few readers to challenge me on this.

My everyday problems may be different than yours, but at the end of the day we use almost the same approach to deal with them. Currently, I work as a full stack web developer. Being in the same company for a few years now, I run less and less into to big issues. The pattern for solving these problems I run into is always the same: Divide and Conquer.

Elephant herd

How do you eat a elephant? One bite at a time.

Here is one of my favorite and most annoying problem I ran into recently in JavaScript:

<script>
... lots of code ...
(function (){
    // load script asynchronously here
})()
... lots of code ...
</script>

Over time, the requirements changed and more code was added right in between:

<script>
... lots of code ...
(function (){
    // load script asynchronously here
})()
(function(){
    // Perform new task here
})();
... lots of code ...
</script>

This looks simple right? That's because with this example I removed all the code inside the function, which is exactly what I did when I was trying to debug it. The interesting part is when you run this code on Chrome debugger, the line number where the error occurs seems to be irrelevant, just the error message:

TypeError: undefined is not a function

At this point even though I could still not figure out the problem, with smaller code it was much easier for me to take little bites at it. Turns out it was just a missing semicolon which can be hard to spot since JavaScript tolerates missing semicolons sometimes. But if I was looking at the full code it would be nearly impossible to find it. Divide and conquer!

<script>
... lots of code ...
(function (){
    // load script asynchronously here
})(); // <-- this was missing
(function(){
    // Perform new task here
})();
... lots of code ...
</script>
Keep calm and bang head here

Accumulation of small annoyances will stress you and make you react poorly when facing a challenge.

I use the same method to deal other kinds of problems too. I get to give my younger sister advice for her work. Even though it is not a technical job, in some respect the customer is not that different then the compiler. If you can restructure the problem into a series of simple yes or no questions it is much easier to deal with it. Accumulation of small annoyances will stress you and make you react poorly when facing a challenge.

[...] The more you feel that you can control your environment, and that the things you do are actually working, the happier you are. When you find yourself frustrated, angry, and upset, it's probably because of something that happened that you could not control: even something small. The space bar on your keyboard is not working well. When you type, some of the words are stuck together. This gets frustrating, because you are pressing the space bar and nothing is happening. The key to your front door doesn't work very well. When you try to turn it, it sticks. Another tiny frustration. These things add up; these are the things that make us unhappy on a day-to-day basis. Even though they seem too petty to dwell on (I mean, there are people starving in Africa, for heaven's sake, I can't get upset about space bars), nonetheless they change our moods.

So you are frustrated now and have to deal with a passenger. You try to scan her ticket and it doesn't seem to register on the computer. Normally you would know the procedure to resolve this but you are too frustrated to think about it, so instead you panic. It becomes a bigger problem and you call your manager and you can't put the words together to explain what is happening while the passenger is also giving her two cents on the quality of your services. Later, when your mood has settled you think about it and restructure the problem into simple things you can do even when all hell is loose.

Maybe this is not the optimal solution but It is much better than having no plan.

Any issue I deal with, I try to use the same approach. It can be with computers or with people or emotional. Restructuring your problem in to a collection of smaller ones can help you get through it even if you are not in familiar grounds. As a result you will be seen as the smart one in the room.


Comments

Let's hear your thoughts

For my eyes only

There are no comments added yet.