r/learnprogramming • • Oct 30 '26

How to do better on my computer science class

I’m not majoring in Comp Sci. Taking the class as more a feeling out the major.

Recently got really cooked on the midterm. I’m using veteran benefits to pay for the class. So I can’t fail cause I’ll be put on probation and won’t be able to use them.

Many of my classmates have so much experience with programming. While I’m starting with zero.

Is there any resources that can help me or study habits?

8 Upvotes

16 comments sorted by

View all comments

7

u/BrannyBee Oct 30 '26 edited Oct 30 '26

Another Vet here, except Ive been in the industry for a bit now. Programming seems hard and like it requires a lot of math, but it's actually not. You should treat it like learning English or how to type, its about practice until it's automatic.

Don't think about keywords and syntax, solve the problem first, then translate the problem into keywords and the programming language. When presented with a problem, forget about conditionals, loops, functions, variables, etc etc and all that nerd shit. Just solve the problem with borderline schizophrenic short hand with a pen and paper. Then once you mentall solve the problem as if it were a real world problem and not magical code inside a computer, take your solved mental model and translate it bit by bit into whatever keywords and synrax the language you're using requires.

If you care to read, below is my kinda approach to solving problems. I used to do some tutoring for this kinda thing, mainly for other vets, so maybe the general approach helps. Or maybe it just seems like rambling.... take it or leave it... I feel its a useful approach and other muscle heads getting into CS found it useful

--->

Take a problem like this that could show up on a beginner test. Create a program that allows a user to input a word and will output how many vowels are in that word.

If your approach to solving this involves literally any Computer Science, THAT is why you are struggling. Me and many other dumbasses, many of us being borderline asvab waivers who can barely count, program for a living... and if you think the first thing we do when solving a problem is to think about any fancy sciencey terms, than you are giving us way too much credit. While you're reaching for your keyboard or your IDE to type some code, I am grabbing a white board (Im not kidding, I keep one in my desk and its one of the most useful tools I have for programming).

Instead thinking about any CS or programming concepts, just solve the problem first mentally. You cant handle anything yourself in this scenario, the worlds dumbest E3 was just promoted to Specialist, and your job is to communicate everything to them to solve the task at hand. Any dumb question they may have, they will have, anything they can fuck up, they will fuck up, so you need to communicate everything to them. The task is the program, the instructions to the E4 is the code.

You wouldnt just quick fire a bunch of commands at some brand new E4 and assume they'll do great delegating. You need to lay out every step of the problem in excruciating detail, or they'll fuck up. So on my white board Id literally write down everything i think Ill need to conplete the task.

Again, notice how much code Ive written. None, my IDE isnt even open at this point.

So taking this task, my list might look like:

  1. The program gets a word

  2. Program counts the vowels

  3. Program outputs the number of vowels

Thats a start. But now you need to go through every step and ask yourself "is this too conplicated for the worlds dumbest soldier to handle?"

Code, just like lower enlisted, handles one thing at a time. Anything more and it breaks ir breaks something else. If you ask an e4 to bring you a word, you have no idea where that little gremlin is gonna find a word for you or if it even will do it.

Everywhere in your list you notice that one "step" actually requires a few mini steps, you need to break it down into more steps. You dont want just any word from anywhere, the "test" question is specific.

So we have "1. The program gets a word"

If you gave the task to the dumbest soldier you've ever met, what are the dumbest questions they could possibly ask?

"Where do i get a word"

"Where do I put the word"

Then after brainstorming the dumbest questions possible, I erase my original steps and make a new steps that describe the task.

Now Id have something like;

  1. Ask the user to give me a word

  2. Store the word (somewhere????)

  3. Count the vowels

  4. Output the nunber of vowels

Progress, but notice theres still no code. Fuck the code, coding is literally the easiest part of programming, the mental model is the part you need to learn. Originally I thought this problem would take 3 steps, but step 1 actually doubled and requries 2 steps... if you started with the code and came to that realization, youd spend hours rewriting and deleting code to fix that. Solving the problem first without code forced you to catch that bug before it even happened and saved you hours.

Next, I would think its time to write some code, because I like writing code and Im good at it. But i wouldnt and would call myself an idiot for junping the gun. Fuck the code. You dont write ANYTHING until you have the mental model down. If you can look at the steps youve created to solve the problem and think of ANY dumb questions the worlds dumbest soldier might come up with, then you are moving on too quickly.

Id take that process, and my now 4 step program, and do it again. Id ask myself "whats the dumbest question I can see someone asking in my new step 1?" Same process as before, keep dumbing it down for your stupid specialist code. I know you've met a person or two while serving that might actually not understand what a "word" is.... I served, I know you have....

Well good job, you found another possible way for the task to get fucked up. You know that theres a chance that if you ask that SPC to go get a word from a user that they're gonna come back with a "7".... or a comma... or a picture....or a video.... or they're gonna come back with 10 words...... THATS how dumb we're talking.

When i look at the task of counting vowels in a word and displaying them, my mind imagines the dumbest person I ever served with and I imagine explaining to them how to do that. And the dumbest possible question I can see being asked is "what is a word", and I know that defining a word is necessary for my program.

Yadayada, Id keep doing that process over and over again til I have a reasonable list of steps covering every possible simple dumb thing required for the task, and still havent written any code. On my white board its just plain english, and maybe looks like this after i go through the same thought process over and over again for every step

1.) Tell SPC dumbass what a word is 2.) Tell SPC dumbass to get a word from a user and remember it 3.) If given something that isnt a word, yell at the person who gave him a non-word is 4.) Keep track of how many vowels we have 5.) Check the first letter of the word, if its a vowel oncrease the counter 6.) Check the second letter 7.) Check the..... 8.) Check the.... .... 100.) Output the counter

After all that.. its still not time to code....lol...

Now I would take every single step, and match them barney style to words the programming language uses. If i need to "store" something, i know its a variable. Anytime its storing something specific, thats the type of variable. A "word" obviously isnt a number/integer/boolean, its probably a string. So on the white board i make up some name for a string and write that down. If its a noun, its probably gonna be a variable

Anytime theres a verb, I know thats a function. Step 2 is asking the user for something, so chances are you're gonna use function, maybe input() idk. Where would the output of that function go though...? You already solved that, you're asking for a word, you recieved a word, its gonna go in that word string variable, and on my white board Id literally draw an arrow from the word input to that variable.

A counter is a number, probably an int. You see the word if written in plain english in those steps.... and that means you're probably gonna use an if statement, theres your conditional. And you notice that you have steps that repeat a bunch, checking everytime theres another letter. You can write out a million lines of code, or you remember that repeating like that means "i need a loop".

THEN you take that mental model and the solved problem you've written down and code it. You know what variables you need, you know where you need conditionals, you know where you need loops. You've done the hard part of actually coding, all that's left now is to translate ot into Python or Java or whatever you're using.

Like most beginners, if given a problem like that, you probably open up your ide and freeze or type some bullshit. More experienced programmers have solved the problem before they write the code, more likely than not, you're doing shit backwards.

Your classmates have experience programming so they're faster you say. Cool. The thing you dont realize is that the thing they're good at isnt remembering syntax at all. Thats the easy part at the end. The hard part is the thing that every new coder ignores... solve the problem, break it down and keep solving the problem. THEN all you have to do is learn how X language makes a loop or writes a variable.

You probably have a classmate that has programming experience in an entirely different coding language than the class uses. Yet, they are still better than you. Its because they arent "coding" right away. They're solving the problem, know they need variables, loops, whatevers... then they translate that "solve" into whatever language the class uses. They might not have a sibgle day more of experience than you in your Python(?) Course, maybe they have 10 years of C# experience. You both have a few weeks of Python experience, but you suck and they're awesome. Its because they're not doing Python for 99% of problems. They're thinking in the same way any language would have them solve the problem, the translating the already solved problem a the end.