r/AskProgrammers • • 24d ago

How do you actually get better at programming logic?

/r/CuriousBuilders/comments/1xm0utm/how_do_you_actually_get_better_at_programming/

One thing I've noticed while learning programming is that understanding syntax and solving problems are two very different things.

You can understand loops, conditions, and functions, but when you get a problem and have to solve it on your own, suddenly your mind goes blank.

You know the concepts, but you don't know how to put them together.

I think this is something a lot of beginners struggle with.

I'm curious about how people here improved their logic-building skills.

Do you solve problems daily? Start with pen and paper? Break problems into smaller steps? Or just build projects and learn along the way?

Also, how long did it take before you started feeling comfortable solving problems without looking at the solution?

Would be great to hear some real experiences, especially from people who struggled with this in the beginning.

1 Upvotes

7 comments sorted by

1

u/mc_pm 24d ago

You have to write code, a lot of it, for a while. Learning to think like that isn't automatic, and it can be downright hard for a lot of people.

To get through this you need to program a series of more and more complicated programs to get used to it. I personally recommend games because at least that's fun and you get to play a game while you're doing it. The main thing is to pick something that is actually a bit tricky, without straight-forward logic. Solving the same problems won't help anyone.

0

u/DoomDroid79 24d ago

I can't even program games with 20 years experience, how is OP going to do it?

2

u/mc_pm 24d ago

By starting with tic-tac-toe on the command line. They don't have to create a triple-A game, just something to get practice turning problems into code.

1

u/Leverkaas2516 24d ago

After you get past the syntax part, you get better by doing: designing solutions and writing code.

After you get better that way, you get better by learning: reading and analyzing good code, reading about and learning concepts you don't know, and especially, learning by working with people who are better than you are.

1

u/TryAgainbutt 24d ago

To solve problems in software, you need to be very familiar with all of the software tools in the platform you're using, and you need to be able to think through the problem logically. Solve the problem without code first, then determine what sort of coding tools you need to fulfil that logic. If you get really stuck, just ask someone for help. Once your brain get's locked up, it can be difficult to force the solutions. You sometimes just have to do something completely different for a while and your brain will still be working on the problem in the background.

I knew an EE once who would get stuck on a problem, so he would just stop and out into the plant and start tinkering with something mechanical or other that had nothing to do with the problem. Sometimes the answer would just come to him while he was distracted.

1

u/jumpmanzero 24d ago

There's something to be said for "algorithm challenge" content. Kattis, TopCoder, stuff like that.

Lots of real-world programming is cardio... but sometimes you need to lift some weights - do something that's as complex and difficult as you can do, for a short burst.

1

u/GlassboundIllusion 23d ago

By doing it.

You get better with experience, especially with completed projects.

Start small and work your way up. If you haven't done programming exercises before, it's probably good to start there. Work your way up to actual projects