What if I am stuck at some point during coding?

Here I am sharing my tips to solve a problem during coding

During the day, we as developers have often been stuck at some point and don't know what to do. It might be a bug, a problem during the development of a new feature, or an error that you don't know how to solve. We often experience that and it might be frustrating sometimes. Today, I will share some tips that will help you solve your problem because it helps me to solve mine. Not every tip may be applicable to your case, but I hope you can find what suits you the best. Let's dive in!

Writing

Untitled_Artwork 2 1.png An illustration by me 馃槉

The thoughts in our heads become clear when we write them down. Personally, when I am doing some calculation or figuring out a problem in an algorithm, I like using pen and paper while focusing on the problem, and writing everything down one by one. Also, a good alternative is to use a digital tablet for the same purpose - I like using Apple Notes or GoodNotes on the iPad. Another option might be using a whiteboard. It is also a convenient way to write and draw something since it has a larger area.

thisisengineering-raeng-4dR9LmMzhT0-unsplash 1.png Photo by ThisisEngineering RAEng on Unsplash

StackOverflow

Stack Overflow is a question-and-answer website. If you're a developer, most probably you know that but I didn't want to take it for granted. StackOverflow is full of people that are having problems and giving solutions. If we search our problem/error clearly, we are more likely to find our answer.

For writing a better search query in StackOverflow, you may check here

It's okay if we couldn't find the similar or the same problem as ours on StackOverflow, we are able to ask about our own problems in public. You may check a resource to how to write well our questions in here

Friends

mimi-thian-slWBjTGhREQ-unsplash-2.jpg Photo by Mimi Thian on Unsplash

Another way to find a solution is basically to get help from our friends/coworkers. We can ask them to spare some time with us to debug our code or ask if they have ever experienced the same problem. It is a nice way to speak about the problem and solve it, also it bonds us and supports our communication. If we are in the same place with that person, I like to do pair programming. If we are in different places, having a call and screen sharing is also a good option. Also, we may consider asking our mentors/supervisors in the company as well.

Rubber duck debugging

DALL路E 2022-08-20 21.32 1.png

Generally, developers solve problems more easily when they speak about the problem out loud. It is a good method to talk about the problem and solve it. It is common and it's actually called Rubber duck debugging in The Pragmatic Programmer book. It is about talking to a rubber duck to solve the encountered problem while skimming through the code line-by-line. Talking through the process helps us to slow down and see our code's wider picture, which makes it simpler to identify issues because we speak more slowly than we think.

Discord servers

Untitled_Artwork 5 1.png An illustration by me 馃槉

Discord is a platform for voice, text, and video chatting which is also suitable for communities. There are many discord servers for developers. I believe you may find some servers related to your domain. Me, as a mobile developer and more specifically an iOS developer, I am a member of various mobile development Discord servers both in Turkish and English. There are some channels for people to ask questions there. I sometimes ask questions on these active discord channels.

For example; one day, I had a problem with SpriteKit (SpriteKit is a 2D game development framework by Apple and there is not a big community for it). I wrote my question on one of the iOS development servers and I hoped someone would give me an answer. Luckily, I found someone that is interested in SpriteKit as well, he helped me to solve my problem. Also, I try to help people as well when I have free time. This is actually how the community grows.

I would love to share the iOS development discord server's link here but it was a server from students of a Udemy Course and the discord invitation is disabled. However, I may share another Discord server for iOS developers: discord.gg/69xeSDCf9y

For your particular domain, you can google relevant discord servers.

Twitter Communities

After the release of the Twitter Communities feature, people started to have their own communities. I am a member of some mobile developer communities both in Turkish or English like Discord. Similarly, I am able to ask any question, answer someone's question or read someone's problem and answer. I am an active user of Twitter and I always check it during the day. I rarely ask questions but when I do, I get answers immediately. It is such a relief that there is someone on this planet, who knows the answer to my problem and chooses to help me with it.

Unfortunately, because it's on Twitter, it doesn't allow a good service for sharing videos, having calls with people, or sharing the screen. I like using Twitter Communities because it's the platform that I use every day and I think people are more active on Twitter. It is important to choose the platform according to your needs. For example, if you would like to share a screen recording, Twitter may not be the best place for that. Because of the fact that Twitter compresses the videos you upload to reduce their bandwidth. Hence, making the uploaded video of your screen record really low-resolution one. That was one of the mistakes that I made back in the time. However, I still like to use Twitter Communities.

My favorite iOS developer community on Twitter is this

My favorite React Native developer community on Twitter is this

Telegram Groups

Telegram is again a chat application and another option for the communities. I am a member of some of them. Similarly, people ask their question and get answers from the members of the group. My favorite one is for iOS development and it's in Turkish. If you are interested you may join here

Similar projects on GitHub

GitHub is an online software development platform used for storing, tracking, and collaborating on software projects. If you are building something new, you can find similar projects to be inspired and learn from them. You can find answers to questions like: How do they make the structure? Which version of any third-party library do they use? Again, you need to search clearly to find these projects. To be honest, it is not an option that I choose every single day but I sometimes use this tip.

Take a break and go for a walk

Untitled_Artwork 7 1.png An illustration by me 馃槉

Up until here, we generally considered getting help from other people. This one doesn't require any people. It is a good practice to take a break when we are stuck on solving a problem. Go for a walk, go grab some coffee, or talk with your loved ones. That's what I try to do. Sometimes, I got stuck at some points and time passes without noticing it. It is nice to have a break and move my body. I recommend it to you as well. Just spend some time without looking at your screen, come back to the screen with a fresh mind, and try to solve your problem again. It is scientifically proven that walking improves creativity. For reference, I am attaching an article here

tai-bui-GrcMd1FvucY-unsplash.jpg Photo by Tai Bui on Unsplash

To conclude, there are various ways to solve our problems when we are stuck at some point. Today, we have covered rubber duck debugging, walking, writing, StackOverflow, Discord, Github, Twitter, and Telegram. Choosing the best one depends on the situation. Each one of them has pros and cons. We don't have to choose only one of the options beforementioned. We can keep trying new ones till we succeed. I hope these tips are helpful for you and you solve your problems easier than before. If you have another tip, please share it with me and other readers in the comments section below. Happy coding! 馃悵