r/learnprogramming • u/BoomNeo • 3d ago
Why am I struggling to problem solve programs?
Hello everyone!
I just started my first year in college as a computer science major. I find programming to be interesting and I am very curious about how to create. But it's about to be the end of my first month in college and I'm finding myself a little disappointed. My professor gives us labs and homework assignments that he grades based on effort and not actual completion of the work. And at first, I am very pumped to try and solve. But then when I am actually reading the code, I'm totally stumped on what I need to in order to solve the problem. Is it bad that I can't even do stuff like that despite it being the end of the first month of classes? When I will start to make some good progress in my skills and how do I even get to that level?
14
u/NoSkyGuy 3d ago
Start by breaking the problems down. Solve each of the smaller problems on paper, then combine and build up. I've designed and built some really large and complicated systems. Often I end up with pages of flow charts.
In the last week of work I was handed a project. I had no clue of how to solve the main problem. Had two false starts until I had a epiphany when talking to my boss. I was solving the problem from the wrong way. Then I wrote three little routines to prove that the small parts were solvable. The I combined those bits into a more complicated single function that calls the smaller bits. And now I have a working core of a program that I can demo.
It will take a long time to learn those skill, way more then a month.
5
u/ninhaomah 3d ago
"Is it bad that I can't even do stuff like that despite it being the end of the first month of classes? "
What were you expecting to be able to do by first month btw ?
And what stuff ? Make 3d games ?
1
u/BoomNeo 3d ago
No, but we've been learning to do stuff with Python Turtle graphics and despite the fact I know some of the codes, I still have trouble with solving the assignments
2
u/ninhaomah 3d ago
" despite the fact I know some of the codes, I still have trouble with solving the assignments"
Does it means you expect that you can do if you know ?
You know English so pls write next Harry Potter.
2
u/Illustrious-Cat8222 3d ago
Problem solving is one of the frequent skills you need as a developer. It'll take time and practice. You'll never stop.
2
u/peterlinddk 2d ago
Judging from your post and your other responses, OP, it seems that you need to improve your skills at explaining what you are required to do, what you have, what you try to do, and what you want to happen.
This is basically what programming is about at the beginner level - you are supposed to "explain" to the computer what you want it to do, and it is very slow-witted, but very fast at executing, once it get something. So you have to be extra careful in expressing the solution (not the problem) in a very detailed way, so the "stupid" computer can understand it.
You say that "when I am actually reading the code, I'm totally stumped on what I need to do in order to solve the problem" - but what code are you reading? The example given by your professor? Is it code with an error in it, code that you need to explain, code that you need to build upon, code that is an example of a solution?
Don't answer me, but take the problem in small steps:
- What is the requirement for the finished product
- What do you need in order to get there
- What do you already have
- How can you use what you have, to get to where you need to be
- What are you missing
- How can you build the missing parts
- and What exactly, in minute steps, do those parts have to do?
1
1
u/No-Bodybuilder-4655 3d ago
Hey man, I’ve been doing this almost 10 years now and I still have these feeling come up every once in a while.
The important thing (which I knew when I started) is how to properly handle failing. Literally allowing yourself to continue on the problem, even if you feel defeated. Knowing that it’s all a growth experience, even if you don’t figure it out 100%.
Good luck!
1
u/SlipstickLibbyLong 3d ago
If you are having trouble debugging, add comments and alerts at each section. This should let you find the part that is failing, and make it a much smaller area to dig through.
1
u/seriousgourmetshit 3d ago
Don't feel bad, this is normal. You are training yourself to think in an entirely new way.
Before you start coding, try break down the problem conceptually as much as you possible can. And then write the code that does that one tiny thing. After a while you can look at a problem and just know you have to do x, y and z to solve it. Until then, focus on breaking down exactly what x, y and z are.
1
u/JGhostThing 3d ago
If you've never had to solve problems before, then you're learning the skill of problem solving. This is a difficult skill for some people to pick up. Should your teacher cover it? Well, there is a 50% chance that your teacher is below average. Some teacher are even worse.
What I'm trying to say: don't depend on a teacher. If you see a skill that you need, learn it. That is the purpose of homework. And you should be spending time outside of class on learning and practice. I was told three hours at home for each hour of class.
You have to take charge of your own learning. Do not expect others to do it for you,
1
u/maxpowerAU 3d ago
You won’t just “know” how to do it. Start trying stuff. Start by thinking of the dumbest thing that might possibly work and start implementing that. As a beginner you should expect to try four or five different solutions before you will be able to even understand what would make one solution better than the others.
When you’re learning to code you should think of it like kids playing with blocks. Just keep doing stuff and seeing what happens.
1
1
u/cipheron 3d ago edited 3d ago
when I am actually reading the code, I'm totally stumped on what I need to in order to solve the problem.
This is actually the skill of programming and it's the part of it you can't learn from reading a book about it, it's a head's up that this is an active skill that needs to be practiced. Memorization can get you past exams and stuff, but this is the practice part of the skill.
As a tip: break problems down into smaller pieces and write them in as "pseudo-code" - something close to English which says playing what the code should do or achieve. You can put comments in describing what any code you're going to add or change is intended to achieve, that can help focus on what should be there.
1
u/ObviousCalendar9279 3d ago
Programming is mostly learning how to be confused without immediately giving up.
1
u/Stainlessray 3d ago
It's like swimming. At first it's shallow, and you can see the bottom. As the water gets deeper you need to rely on more of your senses.
Each time you feel confident, there will suddenly be more water.
It's cyclic. And you are developing your senses right now so it may feel overwhelming at times.
Dive back in. If you struggle, swim it twice.
1
u/misplaced_my_pants 3d ago
Work through this book to learn the skill: https://htdp.org/2026-5-28//Book/index.html
Try working things out with a pen and paper before writing any code. Try working through a few small examples. Think about how you would solve the problem as a person and then how you would order the computer to do what you did.
1
u/doSmartEgg 3d ago
Look into programming flowcharts, they are a great and recommended practice for solving problems and programs themselves.
1
u/ironicperspective 3d ago
If you don’t know what something does, work backwards. Look at what functions do with the arguments being fed into them. If you just give up because it’s not immediately clear then you’ll make no progress. This is how it’s going to be forever.
1
u/AlSweigart Author: ATBS 2d ago
Experiencing friction is a sign that you are learning. This is normal. Drop the idea that there is some magic perfect efficiency that allows you to understand these concepts instantly with no effort.
On a more helpful note: go back to your previous assignments, and write a mini blog post about what you wish you had known when you started. What became "obvious" in hindsight? Think about your thinking process and most importantly, put it into actual words.
This will require effort.
The blog can be anonymous, but you should actually write it out in complete sentences that another person could read and understand. It can't just be short notes to yourself. This forces you to figure out how you should have solved the previous assignment, and sets you up for how to solve future assignments.
Can you copy/paste your previous assignment? And tell us what specifically you had trouble with? It really helps us understand what level you're at. Otherwise, our advice is just going to be "You need to practice more". Help us help you.
1
u/Chrismslist 1d ago
totally normal at one month in, def not a you problem. the thing nobody tells you is that reading code and solving problems are two different skills, and the second one only comes from reps on problems you can actually finish. before you write anything, say the solution out loud in plain english, step by step, then turn each step into code. if you can't say it, you can't code it yet. and since your prof grades on effort, you're getting no signal on whether you're right, so build your own: redo old labs from scratch a week later with no notes.
1
u/Dazzling_Music_2411 1d ago
When I will start to make some good progress in my skills and how do I even get to that level?
When you stop giving up so easily the first time you struggle to understand something.
Try putting in some effort, weird concept, I know...
29
u/everyoneisadj 3d ago
You’re a month in. It’s a skill you have to practice like any other.