Whenever I try to write a code, my mind is completely blank.
Posted by Spiritual-Diamond367@reddit | learnprogramming | View on Reddit | 26 comments
I've read the FAG question "How to improve" twice, and it didn't answer my question.
I'm learning Python on my own, and so far, I have no trouble understanding what a specific function does. My issue is writing the code. I know what I need to do—not 100%, but I've read that's normal, so I'm not stressing over it—but when I try to start writing, my mind goes completely blank, and I forget what to do. I try working through my thoughts, reading my notes, and nothing helps.
Did someone else have this problem? Is this normal?
No_Zookeepergame2532@reddit
The WHAT question?
shooshrooms@reddit
I cackled
Did you read the F*G? Yes I read it, the FACK? What do you mean the fuck?? The EFF A QUE?
Spiritual-Diamond367@reddit (OP)
It was supposed to be FAQ lol
shooshrooms@reddit
I know, these are the jokes
Spiritual-Diamond367@reddit (OP)
lmao I didn't realize what I wrote. My bad
SAS_OP@reddit
Based
aqua_regis@reddit
You know what a word means, but could you instantly use it in any sentence? Could you write a book?
Programming is far more than knowing what a certain function does. It is knowing how to assemble the plenty LEGO pieces you have at your disposal into something functional.
You can memorize each and every single function of any programming language (provided that you have the mental capacity - which barely anybody has as the amount of functions is way too big), but this will not make you a programmer.
Programming is the process of analyzing, dissecting, breaking down problems and creating algorithmic step by step solutions that then can be implemented in any programming language.
You have to learn the latter part - the problem analysis and solving - and this is what takes time, effort, hard work, patience, and plenty practice.
Spiritual-Diamond367@reddit (OP)
I'll keep that in mind. In my current course, the instructor has not yet taught how to analyze, dissect, and break down problems. So I thought, by now, I'd have been able to write anything from what I know. I have a question about the site you sent. Is it 100% free? No extra fees? I don't live in the USA so the dollar is pretty heavy for me. And thank you for your input!
aqua_regis@reddit
The site is 100% free - no extra fees. Had you opened it and read through the intro there, you'd already know this.
Spiritual-Diamond367@reddit (OP)
I've seen a lot of sites that say "it's free," and then when I looked, there were some extra fees. So I was scared that it would be another one. However, I'm now definitely going to use it while studying Python. Thank you so much!
i-Blondie@reddit
Write a script for something organization related. If you have a purpose it’s easier to shape the code.
Immereally@reddit
Great tip is for the last 10min of a session plan out what you want to do next.
Having 5-6 points on where you want to go next is a great way to kick off when you get back to it. And you can start working straight away.
You’ll have a list of Completed so quick glance at that and then you have the details of what you were thinking when you stopped.
When your doing it at the end of the session your mind is still active and in the coding zone, so your still thinking logically and you don’t need to warm up or find your place👍
shooshrooms@reddit
Seconding pseudocode. You don't need to write the actual code first. I had a project today where I first sat that and typed up what I want to do:
//If there is a admission count entered, then get a count of actual admission entries //if the counts do not equal, flag this boolean saying there's a discrepancy //if the counts equal do nothing and return
That would translate into
If (!admissionCount) { return; } else { getAdmissionCount; }
I refer to my comments and business logic notes all the time
Melstrick@reddit
Did you try writing a plan?
Programming is a technical endeavour first, a creative one second.
A blank mind shouldnt matter if you have a design on paper, a list of functions/classes to write and documentation/examples open.
Spiritual-Diamond367@reddit (OP)
I haven't tried, but now I will!
l00pee@reddit
The amazing thing about software is that when it isn't in production, you can't break anything. So just start writing. Doesn't matter if it's nonsense, or works, just start writing. Often, you'll find a couple of things that work, and the broken stuff you can fix.
My approach is to just use psuedo code at first. Write down in natural language what you need to do, like an outline in a paper. Then replace each natural language step with appropriate code, or better yet - write the unit test first, then code until it's green (that's tdd and perhaps beyond where you are, but you get the gist).
Spiritual-Diamond367@reddit (OP)
I'm going to try it. Thank you for your suggestion
Babyskoll@reddit
When my mind goes blank staring at an empty page, I start with building the bones of the thing in comments. Make the framework so I have some idea of what I’m trying to do as I do it. I’m making smaller, more manageable, chunks rather than tackling the whole thing. It helps me get started and once the ball is rolling it feels easier.
Spiritual-Diamond367@reddit (OP)
Noted
peterlinddk@reddit
That is good! And you hardly ever know 100% what you need to do, so that is also okay.
What you are probably doing is you are imagining the finished program in your mind, you are focusing on the goal, and see it clearly! But that isn't what you are supposed to write in the editor, you are supposed to write all the small steps that lead up to this goal.
Try starting away from the computer - if you know what you need to do, write it down on paper! Don't write the actual code, just a quick sketch of what you think you need to do. Look over it, and check if you actually know how to do each part in detail, and decide the order in which you need to do everything. Kind of like you are writing a recipe for someone to follow to cook something: first all the ingredients, then the order of doing stuff.
When you feel satisfied with the plan on paper, go ahead and write the actual code on the computer - take as small steps as possible, just get something running, without actually producing the correct results, and then adjust, tweak and fill in the details as you go along.
Spiritual-Diamond367@reddit (OP)
That's exactly what I'm doing lol. I'm going to try what you suggested. Thank you!
Beregolas@reddit
so, if FAG doesn't mean something else (or is a typo), it is extremely weird to read here \^\^
To aanswer your actual question:
Yes, it is normal. You are overwhelmed, because you are trying something beyond your capabilities. Writing code from scratch is harder (for a beginner) than adding to already existing code. Because there is no structure for you to fill in. It's like the difference of a colouring book vs an oil painting you start on a blank canvas.
This is why we learn architecture as a separate skill from coding itself. The overaching structure of the code should be designed before you write your first line.
Start small: Do a calculator for example, that reads data from the command line, interactively, and prints out the answer. Before you code, think about what you need. How will you split up your code. Classes, functions, the main function and control flow inside it? Any dependencies, like other packages you need to import.
And then work your way up, to more complex projects. This is a skill you will need to learn, just like coding itself.
Spiritual-Diamond367@reddit (OP)
Thank you! I'll try that, and that example made so much sense.
EntrepreneurHuge5008@reddit
Yup, also normal.
You're in the "Conscious Competence" stage.
Take a second to read this article.
In a nutshell, you just gotta practice, practice, and practice. Be patient, this part takes a lot of time.
Spiritual-Diamond367@reddit (OP)
Just read the article, and I'm glad to see where I am in the process. Thank you so much for that!
OP1KenOP@reddit
Interesting approach to meditation, but whatever works for you.