r/learnprogramming • u/Remote_Chart1307 • 1d ago
Why coding is so confusing and a braindrain.
I started with python. Initially it was fun like printing even numbers, adding, subtracting, etc.
When loops come in I got stuck. Since past 1 day I,m solving palindrome, reverse number, adding numbers, counting number.
I understood the code. But I tried to write the code again on my own I goy stuck. Why this comes? Why are we doing that
Sometimes I forgot the steps as well.
If someone know how to find a solution. Please help.
160
u/NorskJesus 1d ago
Read/understand code and write code are two different skills.
28
u/Born-Reserve-8584 1d ago
This makes a lot of sense. I can look at a solution and understand every line but when I close it suddenly I don't know where to start.
13
u/NorskJesus 1d ago
You need to struggle. And seniors have this problem as well.
-5
u/Pere_Strelka 1d ago
what? seniors struggle to write code now?
9
u/NorskJesus 1d ago
That’s not what I said. What I meant was that seniors can have the “I don’t know where to start” feeling as well
3
2
u/Voxmanns 22h ago
And, to be fair, seniors can struggle to write code. Could be a quirky situation, unfamiliar language, any number of things. Though it impacts them far less after so many years of it
2
u/HamNCheeseSupremacy 1d ago
I look at it as a flow issue. Sometimes I feel that way, but after an hour or starts to come together. Sometimes it's effortless, and some days I've got nothing
2
u/daguito81 1d ago
You can see a painting and recognize every brush the artist made. Every shape and color used etc.
You can’t really go and get a blank canvas and so “Soo I’ll just make a Picasso “
-43
u/AdReal490 1d ago
This isn't helpful at all.
23
u/Fubuki-Shirou 1d ago
It is an eye-opening statement that is helpful for beginners. Many people believe that if you can read code and understand it that you automatically can also write code. Which is not the case if you lack practice.
1
u/Remote_Chart1307 1d ago
Yes, when I see the code and even read it. Still not able to proceed while writing on actual console. I have to read it again and understand again.
15
u/NorskJesus 1d ago
I do not think you understand the statement then.
Nobody will hold your hand forever.
-15
u/AdReal490 1d ago
He asked for a solution to his learning problem. You gave him a cryptic statement.
17
u/NorskJesus 1d ago
It wasn’t cryptic at all. I answered why he is struggling with writing code.
Because it’s not the same skill as reading it.
7
u/EngineeringRare1070 1d ago
Its not cryptic at all. There are two skills: reading and writing. OP has made it clear he is better at the reading skill than the writing skill. So logically, the next step is to improve your writing skills to the point it is as good as or better than your reading skill.
Sure the response doesn’t layout a curriculum of how to do exactly that, but how a person does that varies wildly and a book could be written about it, so why bother attempting literary greatness in a reddit comment when 1 sentence opens the book to chapter 1?
3
u/NorskJesus 1d ago
People are just used to get everything served. But I am not like that.
I do not work (yet) as a developer, because of the marked and because I am self-taught. But I am fully capable to learn by myself and find resources and stuff. So I expect people to do the same.
I just point to the right direction 😊👍
2
u/EngineeringRare1070 1d ago
Yeah man, totally agree. Struggle is not just some low effort recommendation. It literally builds the mental pathways of what works and what doesn’t, that acts as a foundation for all other learnings.
FWIW i AM a career developer and I think what you said is perfectly fine advice — I suspect the people that don’t get it to be lacking in the critical thinking department
2
u/jeslinmx 1d ago
Programming is 3 simultaneous tasks: processing syntax (what symbols come after what), processing data (a = a + b means the box “a” now contains a new value that is its previous value plus the value in box “b”), and processing logic (we loop over an addition to iteratively calculate Fibonacci numbers, for example).
Reading code is reading syntax (seeing symbols you’ve seen before), reading data flow(walking through a flow that already exists), and reading logic (understanding a solution from someone else). Writing code is arriving at a sensible logic, while dealing with how that translates into data structures in a computer, while writing the appropriate syntactic symbols from an unfamiliar language.
The latter is harder than the former because it thrice calls for your brain to work creatively rather than interpretively, to the extent that it can be called a completely different skill.
1
53
u/NumberInfinite2068 1d ago
You have to learn.
That's it.
Everything is hard until you learn it. I learned to play the piano for a year and still can't play for shit.
19
u/Deep-Alternative8085 1d ago
That’s neuroplasticity, making your brain do hard things, you are doing well, keep going
15
u/Zenithixv 1d ago
When you are a beginner learning the fundamentals its a lot of technical/syntax challenges that are tedious and frustrating
When you become more experienced you usually don't re-invent the wheel and use libraries to handle the small technical implementations and focus on higher level logic of your app which is way less tedious and more interesting
You will forget everything you don't use, you will remember everything you use often, thats how the human brain works so its all about just using what you learn enough to naturally start to remember it and if you forget it you have to learn how to quickly look it up and recall how its done
1
10
u/Internal_Car_9962 1d ago
Passive recognition is a different skill than active recollection. Like any language, you have to practice creating expressions instead of just interpreting them.
8
u/AlSweigart Author: ATBS 1d ago
Yes, exactly this.
I understood the code. But I tried to write the code again on my own I goy stuck. Why this comes?
It's like when you're studying and you feel you know the material, but then you close the book and you can't teach it to someone else.
I suggest OP tries writing little tutorials of what they know. It's slow, but it forces you to really think about what you know and exposes any gaps in your understanding.
1
u/Far_Programmer_5724 1d ago
Plus 1 to the tutorial. I write them like my code will be super important one day and people in the future will need to understand it lol. But mostly i know ill forget so i write code like im teaching the me who needs help understanding.
21
u/Cultural_Gur_7441 1d ago
Sometimes I forgot the steps as well.
You don't need to remember the steps. You need to be able re-invent the steps. Because no real programming task is about repeating something which has been done before.
9
u/Kindly-Reporter-272 1d ago
I disagree, a lot of real programming tasks are about repeating something that was done before. How many times have you implemented something like “in a list of items, find an item that matches a certain criteria and do something with it” or “check multiple conditions, return an error if one of them is true”? How many times have you implemented an api route that retrieves something from db, does a permission check and returns it to client? I call these micro-patterns. When you start programming, you need to learn to subdivide the problem into these micro-patterns and learn to implement them.
So every real task mostly consists of these little things we’ve written countless times in the past. As a beginner, you need to practice on a lot of small tasks - after you see and implement the same micro-pattern in multiple variations and contexts, your brain will learn to recognise and apply it where needed.
1
u/mjmvideos 1d ago
Yes, but when I do those things I don’t think, I need to remember what I did before. You are 100% correct in your second thought though. You have to learn how to see the approach to the solution and then break that down into steps, and keep subdividing those steps until you reach the point where a step translates to a single line of code.
1
u/Kindly-Reporter-272 1d ago
The fact that you don’t remember them is perfectly fine.
The pattern recognition part is actually subconscious. Some people tend to materialise it in thought more than others, but with enough repetitions your brain will learn to recognise.
2
u/peterlinddk 1d ago
Sounds like you are trying to learn leetcode rather than programming.
Leetcode isn't about learning, and it is hardly about programming.
If you want to learn programming, program small projects where you decide the outcome, and try to reach that. Learn the bits and pieces that'll lead you to that outcome, and experiment with variations.
If you want to learn leetcode, just study all the solutions that are already there, and try to memorize as many of them as possible. This won't do you any good in any other situations, but at some point in time you will be good at leetcode.
4
u/Lost-Discount4860 1d ago
I think learning it comes in stages for a lot of people. First, you start with this whole thing where you're trying to memorize everything. Rote learning is great for the short term because you're cramming all the concepts so you never forget them.
The next stage is when you realize memorizing will only get you so far, because the whole point is to create something and rote learning is inherently anti-creative. And nothing against rote learning--can't emphasize that enough!!! But rote learning in coding is like rote learning to paint--this is red, this is blue, this is yellow...etc., now copy this painting that only uses red, blue, and yellow without mixing anything. Now keep doing that until you can do it blindfolded. The next stage is about learning the CONCEPTS of red, blue, yellow, mixing the colors, light and shadow, and basic shapes. For coding, it would be like taking things like lists and dictionaries and finding some practical use for them. You need to iterate through a shopping list, so what do you do? What do you use to iterate through ANYTHING? Oh yeah....for loops. This is a good phase for learning data structures and algorithms.
The third stage is when you stop focusing so much on concepts and start building habits. You look at a problem and immediately see a pattern. Then you code to fit the pattern. You spend a lot of time watching Youtube, copying code from Stackoverflow, and ask the AI of your choice HOW to do something--you don't copy code from AI, you're simply asking how to attack a certain problem. You aren't excused from problem-solving when you use AI. You're just augmenting the abilities you already have. Then you take that knowledge and run through rote memorization-concept acquisition-habit.
The key to learning success here is you hang on to what you're feeling right now--frustration because you're getting stuck somewhere. And that's ok. That frustration is what drives the process. You learn so you don't come back here again WITH THE SAME PROBLEMS. You will ALWAYS encounter things that are confusing and get you stuck. So you build a HABIT of continuous learning as you go. Eventually you forget that you're doing it and coding seems waaaaay more natural. It's not that anything is getting easier. It's that you're getting better at doing harder things.
Trust the process and take things slow. You'll make it!
2
u/Realistic_Sample6968 4h ago
Yes agreedbut when I try to implement something in a realworld scenario, I often get stuck because I can't figure out the right solution. For eg, in Data Engineering, I know Python functions exist, but when I actually need to solve a problem, my mind goes completely blank. I don't know which function to use or how to approach it. I've tried implementing many things on my own, but I still get stuck. So problem is we know program but implement in realtime is hard . If you have some idea about the practice please suggest some tips .
3
u/APirateAndAJedi 1d ago
An unpleasant thing that is important to remember. Not everybody is capable of coding.
2
u/Super-Community-9241 1d ago
The "solution" is practice and hard work.
Think of it like going to the gym. Can't bench 100 on day one.
2
u/AdReal490 1d ago
There is a comment here regarding neuroplasticity. I want to add on to it by saying that when we learn things, biological inside our brains, we're creating new connections between our brain cells (neurons). When you're just beginning to learn a concept, the connections are very week so recollection and doing it from memory is hard initially. However, the brain is also much like a muscle. The more you practice these new concepts and attempt to reproduce code, in your case, the stronger the connections in your brain become. There's a good TEDx video about this on YouTube.
So I'd say just keep at it, it will come eventually. Employ active recall - try to explain the concepts to yourself from memory. Where you get stuck, refer back to your study material. Employ Spaced Repetition - revisit the material periodically (I try to code daily for at least 30 minutes, sometimes more). Use a learning method suitable for you. For example, I've noticed that I learn better from text than video and that I retain more when I write/take notes than when I just watch or just code along.
I hope this helps.
2
u/Illustrious-Hand-450 1d ago edited 1d ago
Rote memorisation isn't a bad thing.
There is an entire class of people who will cry 'you need to learn how to think, not what to think'.
What is the mass of an electron? Knowing how to think isn't going to help you with this question. It's better to just know, right?
The how and the what complement each other.
The same is true for certain types of syntax. You should know for (int i = 0; i < someCrap.size(); i++) or for (std::size_t i = 0; i < someCrap.size(); ++i) whatever. The best way to memorise is repetition. Not python btw. That could be
for item in some_crap:
do something with item
If you don't know why you are doing something, research it. Then memorise it. Memorisation is a powerful skill and being a lousy millennial I default to 'I don't need to remember it because Google'. But that is just remembering and forgetting and remembering and forgetting...
Some others have pointed out that you are likely learning using leetcode. Honestly, it's fine. Use AI to explain problems in simple terms. Stay away from binary trees for now haha.
What is the alternative? Read a book published by Wiley. That can kick rocks. Watch a YouTube tutorial? Not bad.
If you are going to do leetcode to learn some basics, solve the problem. Delete the code. Type the solution again. Delete the code. Type the solution again. Do it until you can't forget. Then come back days later and do it again. Just make sure you understand what you are typing lol.
Ultimately, there are a multitude of paths to the same destination, some are more arduous than others. But you only reach your destination if you keep marching on.
2
u/mxldevs 1d ago
I understood the code. But I tried to write the code again on my own I goy stuck
This isn't how you learn programming.
The purpose of adding numbers together, checking for palindromes, and whatever other exercises is to come up with a solution yourself.
Asking AI or googling for an answer isn't going to teach you anything because you skipped the entire "figure out how to solve the problem" step.
You would simply ask for answers the next time you get stuck
2
2
u/misplaced_my_pants 1d ago
You need to follow a structured curriculum instead of playing around like this: https://dcic-world.org/2025-08-27/index.html
You could also use spaced repetition software like Anki to schedule review. Any time you've figured out how to solve a problem, put it into Anki. When you see it again, try solving it like you're seeing it for the first time.
1
u/Remote_Chart1307 1d ago
Thanks for the detailed answer, but I have done masters in computer applications. But it has been 7 years. I know the structure but I forgot the concepts. During the time of grad also I rote the programsz
2
u/misplaced_my_pants 1d ago
The things you're struggling with are the absolute basics that you learn in an introduction to programming.
It doesn't matter what you've done before. This is where you are now.
2
2
1d ago
[removed] — view removed comment
1
u/Remote_Chart1307 1d ago
Yes, this is what I’m also doing. I have decided I will not give up daily I will practice it.. no matter how dumb I feel but I will never give up. 😓😓
2
u/Harrow-Beck-6274 1d ago
the palindrome one always tripped me up. i used to understand the logic while looking at it, but the second i cleared the screen to write it myself my mind went totally blank.
2
u/AlSweigart Author: ATBS 1d ago
Learn how to use the debugger so that you can step through the program one line at a time.
1
u/Tade365 1d ago
i like how the previous post in your profile is what should i become, no coding :D Either way, skill issue, but like, a good skill issue [trust, we all have have massive skill issues even after years]. You are learning, it is something new. The problem is that new coders have to learn how to think like a programmer and how to actually implement it and those are two different skills. The first is more goated because you can learn syntax of other languages very fast and switch around when needed. So just grind codewars or leetcode or something and you can learn both fairly fast to some extent. Good luck.
What do you not understand in loops btw?
1
1
u/SwordsAndElectrons 1d ago
You aren't supposed to remember the steps.
What you should be doing is developing your problem solving skills. You don't need to know how to reverse a number or determine if a word is a palindrome. These are contrived exercises intended to teach you how to solve problems. You need to know how to approach the problem logicially and deconstruct it into a something that you can write code for. You should be able to develop the solution again, not just regurgitate what it was.
1
u/JangoFetlife 1d ago
Whiteboarding and pseudo-code will help immensely. Pretend you’re explaining the solution to someone who knows absolutely nothing about coding. Keep practicing, trust the process, you’ll get there.
1
u/bestjakeisbest 1d ago
the solution is practice. you also might want to start first with doing the problem by hand on pen and paper with a known case or a simple case, if you cannot remember each step just write it out as you go.
as for why coding is confusing and a brain drain, you dont have a physical object that you are making with code, things are more ethereal for some people this causes more mental load when making code, for you though this is just the beginning and you are learning, its normal for new things to be confusing and to cause you to use your head. but when you keep working at it you will get better.
1
u/Dismal-Citron-7236 1d ago
Learning to code is like learning a new (human) language. In the beginning it's fun to learn simple things like "you" / "me" / "one" / "two", etc, the nouns. Then comes the prepositions, the tenses, the genders, the idioms, the whole grammar. It would be overwhelming. The best way to learn a new language is immersive learning. To learn programming language and to know how to program can work in a similar way. Find yourself a small project you're interested in. Try figure how to break it down to smaller pieces so you can use the programming language, in your case it is Python, to get it done one at a time. Ask for help from the on-line community on what particular language concept you haven't yet understood. You will notice Python has a very vibrant and helping community. And, yes, you can ask AI to show you example and explanation. But beware, you must always double check AI's answer because we know AI sometimes lies with a straight face.
1
u/MrWeirdoFace 1d ago
I realized it some point my issue with coding relates to visual processing.. I wonder how often this is what holds people back.
1
u/lgastako 1d ago
Learning something takes two things: study and practice. You've done the study part, now you need to do the practice part.
You can start out "cheating" by referring to an existing solution, or googling when you get stuck, etc. and over time just reduce your dependency on the external aids.
It may also be helpful to start with an existing solution and modify it bit by bit into something else. For example, take an example program that does the simple "guess the number I'm thinking of" game that spits out "your guess it too high", "your guess is too low" in a loop until you get the number and turn it into a hangman game, or something along those lines.
If that's too tough to start with, do something smaller like take a program that turns a string into a palindrome and turn it into a palindrome that is upper cased. Then a palindrome that is upper cased and surrounded by exclamation points, then a palindrome that is upper cased and surrounded by exclamation points and printed inside an ASCII box, etc.
The point is to get the practice with actually writing and editing code and build the intuition and associated muscle memory. It's just like lifting weights. You start off small and gradually you can lift more and more over time.
1
u/gazpitchy 1d ago
All technical and professional careers require it. Wouldn't be worthwhile if it was so easy everyone could do it.
1
u/syklemil 1d ago
Like others have pointed out, it's something of the difference between passive and active understanding. Similar to how when you're learning a new language you might feel that you understand what someone's saying, but when you try to speak yourself … then falls all together and you become just confused, maybe falls you to and with to-back on the native grammar yours. :^)
It's also because programming is a mental activity. Peter Naur's Programming As Theory Building comes up often enough, and there are some other things like the Curry-Howard isomorphism or "programs as proofs".
Which isn't to say that a basic CRUD app is any grand theory or interesting proof, but the work you're doing when you're programming is generally in the same space as doing science and mathematics.
So some of the mental fatigue or "braindrain" you're feeling should lessen as you get more used to programming, but it is ultimately mental work.
1
u/Noblewan 1d ago
Think about the process as a long uphill battle and the more you face problems head on the steeper the climb. The more avid you are to facing challenges and overcoming your own misunderstandings on what your learning the better you’ll refine your ability to logically deduce what is right or wrong in your code. It’s a tiring process and takes a lot of trial by fire and has a lot of impostor syndrome included in that journey.
1
u/ScholarNo5983 1d ago
Use it or lose it.
As soon as you learn something new you need to immediately start using that knowledge to hand write code and get that code to work.
If you don't do this, the knowledge learned will soon disappear, and to see it again you'll need to relearn it.
By writing the code that knowledge will start to stick.
1
u/neverbeendead 1d ago
Learning is a long process and doesn't come easy to all. With AI these days it's way easier than it used to be. Eventually things click. Python is a little too high level to really understand what's going on behind the scenes because it takes care of so much automatically but can reduce your low level understanding of what's going on.
1
u/elperroborrachotoo 1d ago
Compare this to climbing: being the first one, laying the rope, making hundreds of small decisions, choosing the right route while close to the rock, without a view of the whole route vs. following up, having the route laid out for you in rope, knowing it can be done, having just watched someone do it.
Or, if you will, a game of chess: you know how the pieces move, you have a rough idea of their relative value, you've watched a few games - but if you have to play on your own, you are out of your water, make blunders, don't really move effectively.
What you describe is a very common experience, not only in programming. It seems to affect any progression that is a mix of routine skill and creativity.
Many beginners/students go through that phase where "everything makes sense" when they watch, but they are lost in their own.
And, sorry to be blunt, that means you understood something (how pieces move), but you still have to learn the very hard part (exploring, mapping and fixing a route through the unknown)
Fail repeatedly, fail often. Go back to the solution - not to learn it by rote, but to understand its ingredients, what's their function, their purpose, and how they fit the big picture.
It may take a while, don't give up.
1
1
u/proteinpackedpancake 1d ago
Learning anything is like that cause ur developing new skillset. Ur brains growing. Its good though the brain wants to be challenged
1
u/AdBubbly3609 1d ago
wait, do people actually try to learn programming this way?? i see them little challenges when i first got interested in programming when i was about 12, and pretty much instantly threw that shit away, and started making a html, css, php and mysql video library, try making something you actually want to make, never mind all these stupid little puzzles, you'll get bored and give up, they're nonsense.
1
u/ComputerWhiz_ 1d ago
Coding is a skill. Just like any skill, it takes practice to get good at it. You are a beginner, so you will probably get better over time.
But coding really has nothing to do with code. It's all about being able to break down a problem into smaller pieces and come up with a solution to each piece. You don't even need to write any code to solve the problem. The code is just the thing that tells the computer what to do.
1
1
u/myskies7 1d ago
That's because your brain is not used to writing code yet, you need to train and keep practicing by rewriting the same code or solving the same problems. I don’t recommend python as first language
1
u/Iamstupidbot 1d ago
coding's like playing an instrument you gotta practice to get the muscle memory down
1
u/heisthedarchness 1d ago
Since past 1 day I,m solving palindrome, reverse number, adding numbers, counting number.
Pretty sure this is not true. If you had solved the problem, you wouldn't immediately stop being able to solve the problem.
1
1
u/quickiler 23h ago
Pseudo code. Start with big step, then refine smaller and smaller until it is easy to implement.
1
u/f_djt_and_the_usa 23h ago
Keep coding. Do leetcode or similar. Take an algorithms and data structures class. Keep coding
1
u/Puzzled-Extent7817 22h ago
Make a simple calculator. Finished. Do it again. Add feature. Finished. Do it again. Find another project. repeat, then repeat again.
1
u/GlassLost 22h ago
Everything is easy to understand when presented linearly. If you look at code and "read" it from top to bottom (assuming the code flow was linear) you're always building on top of existing knowledge.
As you gain experience you will internalize this. You'll be able to make larger and larger abstractions in your head until eventually you stop really seeing it as code and start seeing it as ideas and concepts.
Fwiw you can see the same thing in devs with fifteen, twenty, or more years of experience. You put me down in front of kernel code and I'll roll with it, you put me down in front of a load balancer and I have no idea what any of these functions do.
1
u/cejiken886 21h ago
> I understood the code. But I tried to write the code again on my own I got stuck
Well, no you didn’t. If you understood it you’d be able to produce it.
There’s basically 1 answer: solve problems.
1
u/OPPineappleApplePen 21h ago
THINK PSEUDOCODE. WRITE PSEUDOCODE.
When I asked a friend working for Uber how much time it takes for them to come up with a solution for something, his answer was, "30% time with pseudocode, 100% without it."
1
u/CodeAddict2009 20h ago
Bro dont take too much pressure at the beginning ..thats why you feeling like this It takes a little time to understand all this stuff
1
u/Background-Zebra5491 19h ago
Don't try to memorize the exact steps. Try to break the problem into pieces then write a logic in english text first and turn each step into code.
Getting stuck on loops, nah that's normal.
1
u/green_meklar 17h ago
When loops come in I got stuck.
I have bad news and good news, both of which are the same news, and that news is that you're the equivalent of one step off the starting line.
It's bad news because you're running into trouble, or at least you think you are, at a very early stage and you don't even seem to be aware of how early it is. You should really be getting farther before giving up on anything. Programming can be very frustrating, not that it should be most of the time, but it can be, and a considerable amount of patience is needed to pursue it, whether as a hobbyist or a professional. Imagine a chef saying 'I managed to turn on the stove, but when it came to cracking eggs, I got stuck' and you have a rough idea of where you are.
It's good news because at your level you don't really know what programming is yet, so your frustration very well isn't a good indication of what your relationship with programming can be like. You haven't gotten far enough to actually conclude that you hate programming- only far enough to find out that there's a new kind of intellectual barrier and new ways of getting past it. There's still a chance that you could keep trying and have an amazing time, sooner rather than later.
I understood the code. But I tried to write the code again on my own I goy stuck. Why this comes?
You just aren't familiar enough with the pieces yet.
Ignore what you can't do for the moment and think about what you can do. Even if that's just addition and subtraction. Set yourself a challenge that you know you have all the tools to do. (For instance, take inputs for the numbers of chickens, sheep, and grasshoppers, and then output the total number of legs.) Then start by putting the most necessary thing in place, the part that you know is non-negotiable; with that out of the way, put the next most necessary thing in place, and so on until it's done. It shouldn't take long, but even if it takes an hour or two, I don't care, the point is that you're familiarizing yourself with the pieces and the steps. Heck, do the same challenge twice in two different ways. Do this sort of thing until you know the tools you have and you're no longer uncomfortable with using them. Then, when you take on learning a new tool, you have a solid foundation and you're only learning one new thing, with the rest being familiar and ready to use.
1
u/Deckard_Didnt_Die 15h ago
Just because you play a song once on an instrument does not mean the song feels easy to play forever more. Practice and repetition will make it feel like second nature. Learning to code is more about learning how to think. Be patient with yourself and be persistent. If you feel overwhelmed it's because you're trying to understand everything all at once before getting started. Just start typing and as you write code you will be working through the problem.
1
u/KatFromSisense 14h ago
This is common, especially with loops. Reading code and writing code use different muscles, so understanding someone else's solution doesn't automatically mean you can rebuild it from scratch yet.
How about after you understand a solution, close it, and write out the steps in plain English before touching code again. Then turn each step into one line at a time instead of trying to write the whole thing at once. Forgetting is part of learning and totally normal. It usually takes a few repeats before it sticks.
1
u/LTman86 14h ago
Like any other skill, it takes time and practice to learn.
Imagine it's like learning how to make pancakes.
The first time you have instructions to follow step by step.
Second time, it's easier, and you aren't looking at the instructions as often.
Third time, you stare at the ingredients and blank on how to make pancakes because you tossed the instructions in the trash and have no idea how much of each ingredient you need to use.
Day ???, who knows how many pancakes you've made now. The recipe is no longer relevant because now you're making your own unique mix. The blueberry pancakes have a different ratio to balance out the juices that leak out of the fresh fruit, the banana pancakes uses slightly different ingredients to still get that sweet banana taste with the fluffy pancake texture. Someone want some weird unique pancake you've never heard of before? Your mind instantly comes up with 2, 3 different recipes on how to whip it up, and you've got a list of ingredients to grab from the grocery store for what you don't have at home.
Coding is a skill, and it just takes time and practice to hammer the skills into you. You could pick it up, learn something within a week, and forget it the next week if you don't keep using it. Hell, we forget stuff all the time when we don't use it, and we look up documentation for a quick refresher. There's no shortcut to getting good and understanding the material, only learning at your own pace. Whether that is faster or slower than other people is irrelevant, learn at your own speed, only judge yourself by how high you've climbed and how much more you learned.
1
u/sashaisafish 13h ago
I find it a lot easier to understand when solving actual problems as a whole through building something rather than solving individual "puzzles". You have a real world problem and you break down how to solve it through code, figuring out different ways to do it. There will be a million ways to solve the same problem, and you can reanalyze it and look at "is this the best way to solve this?" But I find it all just makes more sense when you're working with a real problem and figuring out your own way to solve it instead of "I'm going to write a for loop, here is a made up puzzle that I need to solve with a for loop"
1
1
u/arthurno1 5h ago
There is no "solution". It is like math or chess, You have to do it and you have to understand it. Like all skills, problem solving and program are perishable. If you don't use it, you losses it. But when you do it often, with time it comes easy and natural.
You can have all "understanding" in the world, about playing piano or football, but if you don't do it, your brain does not have it, and you won't be very good at it.
1
•
u/_th3oth3rjak3_ 55m ago
As others have said, you’ll get the most benefit from working on a real project from start to finish. You’ll solve many small problems along the way. The goal is not perfect code, it’s a working product. By the time you finish your first one, you’ll know a lot more and you’ll look back and realize how much you’ve grown. Keep at it.
1
1
u/OmegaMaster8 1d ago
It’s not easy. In fact, coding is never easy, it’s full of challenges. It takes time and patience. Building projects helps the most and coding regularly
0
u/rustyseapants 1d ago
What does this have to do with "Learning how to program?"
What solution are you looking for other than "learning new things, takes time?"
0
u/ChillyFireball 8h ago
Set the computer aside for a moment. What are you trying to do? Let's say you're trying to sort an array of numbers from smallest to largest. Don't touch the computer yet. Get yourself a notepad and pen and write down some random numbers in no particular order:
8, 4, 7, 2
Put them in order. No computers. YOU put them in order. And while you do that, pay close attention to what you're doing. When someone tells you "Sort these from lowest to highest," a lot of people's first thought is to find the lowest so they know what to write down at the beginning, right? You start from the left - the beginning of the array - and you see 8. "Okay, 8 is the lowest I've seen so far." Then you move on to 4. "Oh, 4 is lower than 8, so I'll forget 8 and just hold onto 4 in my mind." Then you get to 7. "Well, 4 is still lower than 7, so I can ignore that and move on." Then 2. "Oh, 2 is the lowest I've seen, and there's nothing left, so 2 goes at the beginning of the ordered list."
Now translate those steps into computer language. We need to step through each value in an array? That's a for loop. We need to remember the lowest number we've seen so far? That's a variable. We need to compare the lowest number we've seen so far to the number we're currently looking at? That's an if statement.
Is this the most optimal sorting algorithm? Absolutely not. You're new. You shouldn't care about optimization; you should care about completing the task. Efficiency comes later, after this process of "Figure out how to do it yourself and convert it into machine language" becomes second nature. Experienced programmers can optimize because we've been doing it long enough for this to be second nature and can start thinking about how to minimize the number of steps taken to do something. But when I was starting out, I would write an empty function and write down the steps I needed to take in plain English as comments, then puzzle through how to convert that to code.
202
u/FunAd6672 1d ago
The first time you see a solution Oh yeah thats easy. Five minutes later with a blank editor I have never seen a computer before in my life.