Starting out programming can be daunting. Sometimes you will find yourself hitting a wall again and again and you might sit for hours looking at the same problem. You feel the frustration of having little progression in your work. I believe everyone who has a background as a developer know this feeling. Therefore I have put together a little list of advice to help you along your way.
Being a developer requires an immense amount of patience. You have to be able to stare at the same problem for hours. This does not mean that you should feel wrong for being a little impatient. But rather rejoice that it is completely natural to feel frustrated from time to time. Some developers who have been in the business for decades still get frustrated over hard to solve issues. That being said programming should not feel frustrating all the time, as you get better there will be farther between you being stuck on problems. Keep in mind that:
The hardest problems to solve are often the most rewarding.
Explain the problem
Often the reason you cannot find a solution, is because you do not understand the problem well enough. Have you ever had a problem, and while explaining it to someone else you came up with the solution yourself? This happens a lot in software development. You can use this technique even if you are alone. Either imagine that you are explaining the problem or say it out loud. This is referred to as "rubber duck debugging". The term comes from a great book named the Pragmatic Programmer, which I think all programmers should read:
Even though it is most satisfying solving a problem yourself, you will often learn more if you ask someone else. We all have a different point of view and we all tackle challenges from different angles. Asking for help is never a bad idea, let it be a friend or colleague, they might learn something in return while you are at it. You can also use forums/services like stack overflow for help. This I have done a lot over the years.
It is not only very rewarding to help others due to them getting help. Often you learn something by doing this as well. Perhaps you can find someone who have the same issue as you, which you now know the answer to. It is about giving something back.
Again stack overflow is a great platform for this. By answering the questions of others you will learn a lot, you will also get a portfolio of your great answers that you can share. I have used this a lot, even though my answer to a question was not the best one, I still read and learned from the best answer on the question. If you are a bit competitive you will always remember the answers that are better than yours.
Look at existing solutions
Take a look at some other code for inspiration and search for solutions to problems alike yours. You could also look for ways to solve common problems, like using design patterns. If you are looking for a great book on design patterns, I would suggest:
I got to know this book while I was studying for my Academic Degree in computer science and I think it was the best book we were presented with.
Go past the problem
You could skip the part of the code you are having trouble with. Then continue to develop the rest of the system. Sometimes when you develop other parts of the system you get a bright idea. It might also be easier to connect the ends if they are more complete. You should of course not continuously avoid challenges, but sometimes when you put things aside for a while you come up with a solution.
Refactor it later
Maybe you did actually solve the problem. But not in a way you like. You could leave it for now and return later. You should make the problem easy to refactor later, you will also need some way of reminding you to refactor it. Refactoring your code should be easy if it is well tested.
Get off the computer
I often get my best ideas while I'm off the computer. I once had a project leader who told his developers to leave early and show up tomorrow with a fresh mind, this often worked. We could be coming up with bad ideas for hours at work. But the next day someone always had gotten a great idea over night. I for some reason get a lot of good ideas right before I go to bed. This often ends up with me forgetting them again.
Wrapping it up
I hope you liked my list of ideas on how to improve your programming skills and avoid getting stuck with problems. I have used every single tip that I have given above. This has helped me overcome large and small issues throughout my career.
Do you think anything is missing on this list? Let me know in the comments!