The Right Mindset To Solve Complex Problems
Tags: career, discuss, programming, productivity
Published: 2021-08-07 09:20:55

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ja49uc0ecyg32oolcusx.jpg)
Hi all, I know that all of my articles are very technical. This time I will talk about something a little bit different, more abstract - the mindset of a developer when assigned to a new task.
## Why do we need to notice our mindset when assigned a new task?
Lately, I have tried to be more self-aware of myself and my surrounding. I notice something significant when I'm dealing with a complex coding problem **it always starts with "oh shit, it's too hard," and if this feeling stays with me, it impacts the quality and the amount of time that I spend on this task.** So, I believe to be a better developer We need to notice our attitude to the task we are currently working on. **I think the right mindset is to be fully confident that you can succeed in finishing the task.** (Many people will say you can't always succeed in developing exactly what you wanted in the beginning, they are mostly correct, but you can always try to :)... I will talk about it in the "Importance of critical thinking with the right mindset" section).
## The steps to change your mindset
### Step 1: be aware of your attitude when working on something new
Try to follow your mood when you are working on something new. In my opinion, it doesn't matter how you follow it (write your thoughts in a diary or try to remember when you think about it), the important thing is to develop an awareness of this subject.
### Step 2: Find your weaknesses and your strengths. 
For example, I know that one of my weaknesses is trying many things myself without asking for help. This mindset can cause a waste of time (even though I know I can finish it by myself) - **I can waste a few hours instead of someone helps me**, and it can be done in a half-hour. If you think about it, in this situation I  can save the company I work for, a lot of money (my half-hour + my co-worker half-hour < few hours of my time). But on the other side of this example, it's one of my strengths - **I will never quit on something I need to do.**
### Step 3: Choose one weakness you found from the last step and work on it.
If we take my previous example for the explanation - my plan is not always to ask for help (because it can cause the opposite of what I try to achieve). I need to see when I spend too much time on something and need to think about the cost of someone else who will help me. If I know the cost is worth it, I need to ask for help. **But, more importantly, remember your strengths and make them your primary mindset.**
## Be confident you can do the task you got
In my opinion, this is one of the most important mindsets when you solve a challenging task. Why? **without it, you are mentally weak**, when you don't believe in yourself, the task you received seems too hard. **But, if you do believe in yourself, you will do anything to complete the task.** 
### Example of the right mindset
Let me give you an example from one of my last private projects - a game called "Gold Rush." The main goal of this game is to collect more coins than your opponent. There are two options - single-player and multiplayer. I will talk only about the single-player option. The user plays vs. the computer in the single-player option. The computer will collect the coins and pass obstacles, **so I needed to implement a path-finding algorithm.** At that time, it didn't sound to me that hard, so I decided to write the code myself. My design was very simple - matrix with two-player (0,0 and n-1,n-1) and random obstacles (there are obstacles in the game that the players need to pass). The main goal was - when the computer player moves, he will search for the coin, obstacle, or player 1. **This design failed completely** for a lot of reasons, but the main was - when he detected an obstacle or player 1 - he tried to do random index generation from the indexes in the matrix near to him (search up, down, right, or left - only four random options in this case). What happened was he repeated the same moves again and again, and the game seems stuck. **I must admit, at that point, I felt like a loser, But I told myself I am not giving up yet...** I searched for a solution on the internet, and I found this article: [A* Search Algorithm in JavaScript (briangrinstead.com/blog)](https://briangrinstead.com/blog/astar-search-algorithm-in-javascript/). **Even though it was written very clearly, I didn't succeed to implement it in my code.** Honestly, I felt like shit, it's been a week, and I didn't do anything. **But, I knew I am getting very close**. Eventually, I found this npm package - [pathfinding](https://www.npmjs.com/package/pathfinding) and succeeded in ending this task (after a week and a half). If you want to play the game here is the link : [Gold Rush Game](https://gold-rush.netlify.app/) and here is the code I talk about (the backend): [Gold Rush - backend](https://github.com/tomeraitz/gold-rush-server).
### Importance of critical thinking with the right mindset
I believe that you understand the importance of the right mindset after this example. But, **I think the important in all attitudes is to remember that your approach will impact other things.** for example, if you take the mindset I talked about, you can mistakenly think you can finish the task in no time, **and this why is important to have critical thinking with the right mindset**. Let's take, for example, the following scenario: you received a task to build a new service that no one in your company ever developed before. **The mindset in this scenario should be "I can do it, and I will do anything to complete the task," but don't be arrogant, don't say you will complete the task in a few hours or a short time.** Be honest with yourself and think how long it would take to do it.

Thank you for reading. I really would appreciate it if you comment your opinion about this subject because this is a new subject I explore and will be happy to learn more from others.