r/AskProgrammers • • 5d ago

How can I become good at problem solving?

After getting a task Some programmers just starting writing the code while writing the code they understands all the logic behind that...how can i achieve that level of skill?

0 Upvotes

8 comments sorted by

4

u/JoeStrout 5d ago

Write lots of code. It's a skill, like playing the violin. You get better at it through practice. There is no shortcut, except to try to frequently work on things just a little bit beyond your skill level.

1

u/StephenHawkinguss 5d ago

First resolve your own problems

1

u/etherealflaim 5d ago

Problem solving and coding off the cuff are different skills. You'll have to practice both. The former is all about figuring out how your particular brain can decompose a problem into manageable steps and finding a value system for selecting an approach or finding resources that can help you solve each one. The latter is about finding ways to start with code you are very sure you will need while at the same time letting your brain do the problem solving on the fly. They are related, but different, and can be used together.

1

u/pixel293 5d ago

I feel you can only get so good at a skill by reading or watching other people do it. At some point YOU have to do it, over and over. You have to fail then figure out how to do it correctly. Eventually you get good at that skill. Programming is no different. You will find after doing it for years and years, that you run into the same kinds of problems you have already solved before, so "finding" the solution becomes easier and easier...or more boring and you start looking for harder problems to solve.

1

u/Life-Aid-4626 4d ago

Do it. Then do it again, using what you did before. What problems does your prior code not handle clearly and easily? How could it have been better?

Don't just do the same thing multiple times from a clean sheet. No code exists in a vacuum

1

u/AntLost4161 4d ago

Imagine you're learning an instrument. The guy next to you can just sight read the piece you're learning like it's nothing, even though you spent days, weeks, or more just getting it playable. They can do that because they have a ton of experience. Nothing feels as bad after you've worked on something harder than the current task. To improve, you need to teach your brain how to work with these problems, so sit there and work through the problems carefully

1

u/ialiimran 4d ago

Start by understand the problem, break it into smaller tasks, and think through the logic before jumping into the actual implementation. Over time, you will recognizing the patterns and will start translating requirements into the code almost naturally.

1

u/Impossible_Ad_3146 1d ago

you’re born with it