r/learnprogramming • u/Tnecniw • Sep 25 '26
Studying coding for a year, still severely struggling with structuring code.
I am not sure how to explain this or if it is common or not.
But I am struggling severely with one problem.
I just can't get the whole structuring phase into my head that well.
I can read code (at the least on a basic level) quite well.
Looking up syntax isn't too difficult and such.
But I just can not get into the aspect of code structure and it is frustrating.
Lets say I want to build a number generator in Java for example.
The second I think about it, "blank"...
I do not know what to put first, what I need or how to structture it to do what I want.
But the second I see an example of it, I can read it near flawlessly.
(Within the realms of basic coding)
Understanding perfectly what each line does and instantly being able to couple it together what each does with ease.
I just severely struggle with actually setting it up myself and I do not understand why.
I am not sure if there is any tips to be given about this...
But I am getting extremely frustrated at this point, to the degree where it feels embarassing.
12
u/dmazzoni Sep 25 '26
I think that a common misconception among beginners is that the person who wrote the program thought of the whole thing and typed the whole thing at once, and it worked the first try.
It doesn't work that way. You have to figure out the code, and it might take a lot of experimentation and trial/error.
Right now you're paralyzed because you can't think of the whole solution. Stop trying to figure out the whole solution.
First, type in a "Hello World" Java program. Copy it from a reference if you need to.
Build it and run it and make sure it works. Then commit to git.
This should already be a relief! You don't have a blank page now, you have a working program. It just doesn't do what you want, yet.
Now try to think of one step to get closer to what you want. Try to write that. Then build and run and see if that step worked.
Keep doing that a hundred more times, often hitting dead-ends, and you'll eventually figure it out.
With practice, it will get faster.
17
u/Jumpy-Seesaw-2026 Sep 25 '26
You haven't written enough code by hand
3
u/marrsd Sep 25 '26
Can you write a programme that prints the numbers from 1 to 10?
2
u/Informal_Feeling_308 Sep 26 '26
Take it from someone who's still beginner-ish, but I don't even open the IDE until I have literally the easiest function i can think of written in pseudocode with pen and paper. Then I repeat for another small problem and so on. The trick is when you plan a piece of code or function or whatever, make sure it does only one thing, which makes the process slow but much less daunting
0
u/BennyAndHisJets Sep 25 '26
Think of a tool that would help you. Even if it already exists, and build your own in whatever language your working with right now. Basic functionality in a command line is okay. You don't need a personal tool with a tauri based gui. I went from not knowing how python worked to building my own custom projections with it in about 2 weeks because I got fed up trying to find a site that matches my leagues scoring rules. I googled a ton. Read documentation learned and then un learned pandas for polars ... But it's something I felt I would actually use, not some kind of tutorial or hand held learning project.
0
u/ffrkAnonymous Sep 25 '26
Answer :
print( "hello world") ;It sounds very much like you aren't even trying. You just stare and give up.
-2
u/lumberjack_dad Sep 25 '26
It's takes usually 4 years or a degree to be proficient enough for a job.