When we get stuck

Have you ever been in that position where your code does not progress? Being such a common problem in our daily work, I have been able to collect some helpful tips that help to overcome this state, which prevents us from keeping our usual flow.

When we get stuck

Have you ever been in that position where your code does not progress?

Don't worry! That's one of hardest things to overcome while writing code. Being such a common problem in our daily work, I have been able to collect some helpful tips that help to overcome this state, which prevents us from keeping our usual flow.

Now that you know that these drawbacks are a common thing, follow me as we discuss these tips that will help you in those difficult times.

If your idea is not working, discard it

This is the best piece of advice I have received since I have entered 10Pines, and it wasn't until the end of the apprenticeship program that I realized how important it was. Why? Well... I think that's part of what we have earned in this learning process. But let me tell you something: Complicated and tedious ideas tend to lead into more complicated and hard to maintain code.

The first month of the apprenticeship program we worked on simple katas, aiming to improve the design of our program. Later on, we took one of those small challenges and gave it a 'frontend domain' with one restriction: we can't fix anything previously made. The consequences of our bad (and also good) decisions always come back for us.

At the end, the path where we see firsthand how to tackle a real project, EVERYTHING EXPLODED! ( Just kidding! :D ) Upon reaching the 'final lap', I was able to discard code that, simply, did not work. Moving forward helped my solution and myself, fading frustration away while working.

Dealing with something complicated? Take a rest!

Everyone feels tired, frustrated or exhausted sometimes and it’s perfectly normal needing a break to clear out our minds regardless of what we're doing.

Even Sir Arthur Conan Doyle offered to his most recognizable character the need to play the violin to cope with his thoughts and, consequently, make his ideas flow easier. In some cases, he clear his mind by going to a concert.

“- Well, leave it there, Watson. Let us escape this weary workaday world by the side door of music. Carina sings to-night at the Albert Hall, and we still have time to dress, dine, and enjoy.”

-- Sherlock Holmes in “The Adventure of the Retired Colourman” (1926)

So don't be afraid of rest or do an activity you like, if it helps you think. A personal advice: Don't go to social media, that won't help you at all! On the contrary, it will distract you more than benefit you because of the amount of information received through those pages. The only thing that Facebook, Twitter or any other of these web sites will produce to your brain is to get more exhausted than before.

Find someone to talk about it

Have you ever heard about rubber ducking? Well, this is what this section is about.

The concept of rubber duck debugging applies when **we have to explain our situation, issue or problem to a coworker, asking for help. **

Without wanting to get punctilious about what time is right to ask for help (a topic that is covered in Angeles’ post titled: From a Newbie to a Newbie) I think it is appropriate to emphasize in the nature of teamwork that a developer should have.

Asking for help is something totally normal, no one is going to judge you for being stuck in your program and knowing how to ask for help is a skill that not everyone has. That's why I want to embolden those who are reading this post to choose a coworker you feel comfortable speaking with. The reason of this it’s because, many times, transforming our problems into words and saying these out loud, helps us to get back on the right path to follow or detect the mistake we are making.

Is no one available? Have a doll to talk to! It may sound silly or foolish but, as I said before, verbalizing our problems may be the solution.

Ask yourself some questions

Maybe you are stuck because, after several hours of working without success, you have lost focus on what you are doing.

• What am I doing?

If you feel like the focus is gone, one of the best solutions is to slow down, put our engine in neutral and take some time to do a retrospective about your work. First, focus on remembering what you originally wanted to accomplish.

With that in mind, what am I really doing? is an interesting question to think of. It's important that you do it honestly so you can make a comparison between your starting point and now. Finding where we did more than we should is a good place to start analyzing why we are stuck.

• What are my options now?

Once you asked yourself the previous question and, consequently, have a picture of where you are, it's time to start looking for alternatives to be able to carry on with your project.

You have various options now, but the first rule that you must always keep in mind is: "Make it simple, make it work!". This helps us internalize the concept of making the design of our program as simple as possible. Don't forget that writing complicated code makes our solutions grow exponentially in complexity.

Having understood that 'rule', we can move forward. One option may be to return to the tests, following the execution's flow and keeping track of the small functionalities that are going to make your code work. Also, the top-down approach is a great option, because in that way we think about "what I'm trying to solve?" instead of "how I'm trying to solve this?"


What I would like you to get from these paragraphs is to accept the fact that you can get stuck in your code. Embrace the situation and learn from it as much as you be able to. Encourage yourself to ask for help or to look for an activity that relaxes you.

And remember: If itis simple and works perfect for you, keep it. You will always have time to improve your solution, looking for more and better ways to do it.