Starting out programming can be daunting. Sometimes you will find yourself hitting a wall again and again. 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. 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 should feel wrong for being a little impatient. But rather rejoice that it is completely natural to feel frustrated. Some developers who have been in the business for decades still get frustrated over hard to solve issues.
The hardest problems to solve are often the most rewarding.
Explain the problem
Sometimes 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 often. 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 believe all programmers should read:
Even though it is most satisfying solving a problem yourself. You will probably 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. Perhaps you can find someone who have the same issue as you, which you now may 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 you of 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 (better than mine). 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. You should 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.
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. Of course 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.
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!