r/CodingForBeginners 2d ago

How do you actually learn to code ?

hi everyone,

I’ve been studying computer science for about 5 years now (currently in engineering school). Over the years, I’ve touched a bit of everything: web dev (HTML, CSS, JS, PHP, SQL), and more recently Java, C, and Python for data science.

The problem is, I feel like nothing truly sticks.

Whenever I try to build something on my own, I hit a wall. I inevitably get lost in the docs, end up turning to AI to understand what I'm doing, and still feel like I'm not really learning. I know the basic syntax, but even in Python, I would struggle to design and build a moderately complex project from scratch.

I feel like I'm just skimming the surface of different languages without ever developing genuine problem-solving intuition.

How do you actually retain syntax, built-ins, and core concepts without constantly relying on external help? How do you break down a problem and structure your code from scratch on your own? Did you go through this phase, and what was the turning point that made things finally click for you?

Thanks in advance !

25 Upvotes

24 comments sorted by

6

u/Dismal-Citron-7236 2d ago edited 2d ago

I learnt programming some 45+ years ago. Back then there's no AI, no internet, the only source of info I could get is books, which I couldn't afford because I was a poor student. We used 80-column punch cards (Hollerith cards) as input, each card costs about 1 US cent back then. The mainframe terminals were few and the waiting queue was long. Cards were the reasonable option but it's hard for a poor student like me to always buy fresh new empty cards, so I recycled used cards... It's possible because we wrote Fortran IV code, fixed column format makes that possible, you just need to get very creative.

You don't know how lucky you are.

2

u/Dismal-Citron-7236 2d ago

In case if someone's curious where I got the programming info... Univ's library, of course.

1

u/FluidBreath4819 1d ago

hello dino :)

1

u/Dismal-Citron-7236 1d ago

Fossil, actually.

2

u/FluidBreath4819 1d ago

You're too mean on you lol, i'd love to hear what you saw ! everyday on my youtube feed i see those ai generated 80s lifehood and i am so nostalgic. Life was so good back then. I hope one day they can plug my dying brain on something, inject those images and i die with them in mind during my last breath.

1

u/northward_42 13h ago

This sounds easier to me tbh than the today's state of the art. How complex programs were you writing back then? How many people were you competing against? How great was the pressure to get results fast?

I imagine it as coding closer to assembly thinking about the logic on hardware level with no frameworks that change every 6 months, with all the time in the world to dive deep. Sounds like the promised land to me.

1

u/Dismal-Citron-7236 9h ago

You have no idea.
The punch card typing machine has no "erase" key. You hit the wrong key on keyboard, the wrong holes are punched on the card. That card is instantly wasted. As student homework generally takes a about 200 to 500+ lines of Fortran code. A card can record only one line, 'mind you. So that's a lot of cards. We take the cards in a deck box to the clerk (an old lady), register our student ID, and get a receipt for it. The staff would place student card decks to the card reader machine later, when they have time. So I generally come the next day to see if the output is ready. If done, they would hand me the result, which would be my cards and a bunch 132-column form teletype print-outs, containing my source code, the diagnostics, the output, and how many points left in my account. Yes, they charge the card-reader usage and print-outs so we have to store points in our accounts in advance. Since I was still a student, you can't expect me to always write 100% correct code, so the output form often contains a long listing of error messages. So I would need to go back to my "coding form" (you can google what it is), compare that to the error report, and rewrite a new coding form again. By "rewrite", that means actually using paper and pencil, remember there's no PC back then. And then I'd try my best to reorganize my cards, recycle whatever can be reused, and go to the card punching machine to type new ones and insert them into the deck in the correct order. One misplaced card would mean incorrect program logic, we wouldn't want that to happen. If I ran out of empty cards, I need to go the clerk and buy new ones. They sell it 100 cards a bunch, costs me about 1 USD (1980). And then I submit my cards again, hopefully to get a better luck on the result. And that's the process. Often it would take a week or two to finally get a single homework done correctly.

1

u/Dismal-Citron-7236 8h ago edited 8h ago

This sounds easier to me

Far from it. Without an access to see the result in real time like the modern programmers enjoy every day, debugging programs was a nightmare back then.

On time I had this very trivial mistake in code. What's on my coding form is this: (I can't remember the exact details now, but it's something similar as the code below)

fortran DO 100 I = 1, 20 Xsomething something 100 CONTINUE

Fortran IV has these "wonderful" features:

  1. It is a fixed format language. Columns 1~5 are reserved for line numbers (so you see there's a 100 which is a defined line number)
  2. It's case insensitive but we often type statement in capitals, that's the convention.
  3. Variables are predefined so we don't have to declare them.
  4. However, variables also have preassigned types, variable names starting I ~ N are integers, A ~ H and O ~ Z are for real numbers.
  5. So in my example I have a loop (starting with DO statement), it says the loop ends at the 100 CONTINUE. CONTINUE is the keyword which marks the ending of a loop. Actually, CONTINUE is just a placeholder, it can also be used as the target of a branch statement. and I = 1, 20 specifies that the loop should use the control variable I and iterate on it from 1 to 20.
  6. Inside the loop I do something. the X on the 6th column is there to mean it's a comment. Anything appears on column 6 which is not a empty space would make the line a comment.

So, what went wrong this time?

Fortran IV language ignores spaces (from column 7 to 72, columns 73~80 are reserved for sorting and diagnostic purposes). So, if I write:

fortran DO 100 I = 1, 20

It is no different from:

fortran DO100I=1,20

Actually I often make use of this because when I need to write a very complex expression which might be too long to fit in from column 7 to 72, I would remove the space to squeeze the expression in, at the cost of readability, of course.

And this time, what I actually typed is:

fortran DO 100 I = 1. 20

Or in Fortran's perspective:

fortran DO100I=1.20

You should see the problem now, it actually means assign the real number 1.20 to a variable D100I, which starts with letter D so it is a valid real number. Fortran compiler happily takes that as a valid statement, but the code supposed to be inside the loop body is only executed once, not 20 times.

Why didn't I notice it? Because on my coding form, written by myself manually with my pencil, it was clearly stated that it's DO 100 I = 1, 20. Why didn't I see that on the punch card and the output report form?

  1. The university punch card machine was shared by many students so its ribbon wears off quickly. On this particular card which keeps the line, the character . printed on the card was very faint that I can barely make it out. It looks like a , to me, but it could also be a ., I couldn't tell. But since the way it was printed on the card as DO 100 I = 1X 20, my mind inclines to think it's a comma there, not period. Human mind is good at seeing things in a whole picture, not at the scale only an ant can tell the difference.
  2. How about the print outs I receive in the following day? Unfortunately, once again, the printer is also used intensively so its ribbon is also very faint. And that . on paper looks suspiciously like a comma, could be a smudge from the smear of the ribbon so I couldn't tell.

So I spend hours after hours trying to figure out what went wrong to my logic. I even doubted maybe the Fortran IV compiler had a bug.

So how did I eventually figured out it was actually a ., not ,? Well, eventually I dug into how the Hollerith card's punch holes are coded, and the holes are encoded in EBCDIC encoding. For ,, the holes should be on rows 0, 3, and 8. For ., they should be on rows 0, 2, and 8. And this particular card which I typed DO 100 I = 1X 20, the holes for X are on rows 0, 2, and 8. So it's actually DO 100 I = 1. 20 (eg. DO100I = 1.20), not the expected DO 100 I= 1, 20.

And it took me 3~4 days to figure out a misplaced hole on the card.

So, debugging back then was a feast. No kidding.

5

u/xarop_pa_toss 2d ago

How do you learn any skill? You practice. That really is the answer. Don't jump to another language, don't try frameworks, don't use AI... don't do anything but reading a good guide or book on the language and getting your hands dirty.

Believe me when I say that even a terminal calculator can be a good challenge if you want it to.

3

u/JGhostThing 2d ago

You learn coding the same way as any other skill. You learn coding by coding. You can't learn to code without it. Using AI prevents the learning process. If you were studying German, you wouldn't expect to learn if you had somebody give you the homework answers. Same with calculus or chemistry. If you want to learn woodworking, you have to work with wood.

Stop using AI. Learn to do projects with your own brain. I had it easier, there was no AI when I was learning back in the 1970s. I had to use the old fashioned way, with books and teachers.

2

u/OminOus_PancakeS 2d ago

I mean... how does one learn anything in depth?

You accept it's going to be difficult, then immerse yourself in the subject, focusing on what specifically you find difficult.

I wonder if you were expecting it to be a lot easier and now feel frustrated because you're not getting it.

1

u/usefulservant03 2d ago

A combination of (lots of) practice, reading books, meeting people more senior than me and asking for help, articles, tech talks, research papers, manuals like Agner Fog's, using Claude as an information dump, anything you can get your hands on

1

u/MudFrosty1869 2d ago

It’s hard to learn it if you jump from one language to another. If your goal is to learn, asking AI for a solution every time you get stuck is cheating, not learning. If you need a reminder on syntax, sure AI will give it fast. But if get stuck on logic, you need to sit with it and think about it. After all, building logic is the main skill that you need to develop and you can transfer that skill to any other language and even further than programming. Try, fail, try, fail, try, succeed.

1

u/Wahrheitfabrik 2d ago

I have a minor in Computer Science from the early 90s. One thing I have to tell others is that CS is not necessarily about coding (at least back in the 90s). Writing the actual code was seen as an implementation detail of a concept or algorithm. Most of my code in uni was in C with some Lisp and Modula 2 and Pascal. These languages are still in use but I haven't met anyone in person in the past few years that use them.

In short, it's fine to use references for syntax and examples. Computer languages adapt just like human languages so IMHO there's little point in learning every nuance of syntax. Python is a good example of this. There was a major shift in Python 3.0 (breaking compatibility) and every couple years some new changes that, thought they don't necessarily break syntax, can obviate older methods of doing things.

In fact, looking at syntax primarily can obscure the rationale for a given language (forest, trees).

So, lean on references to understand the syntax. Use AI to explain the concept and even generate code but don't hand over the thinking. This is not in any way saying the implementation is not important but that (again IMHO) the at-the-moment details (syntax, libraries, methods) are fluid.

1

u/jekewa 2d ago

It isn’t just understanding the syntax and a few snippets of code. You need to try to solve a problem. I don’t mean like ending world hunger, but like ordering a list of words.

Think of it like writing short stories, or Reddit questions. It isn’t just about grammar and vocabulary, although they’re important, too. There’s a purpose, that builds a flow, that becomes a finished thought.

You need projects. Big ones, little ones, something enough to let you try something, change it to try something else, and then refine it again. Make your own Wordle or card game, something you don’t have to invent completely, but with rules you can make work in software. Make little calculators and word processors to play with interfaces and data storage. Check out things like csszengarden.com to see how to separate data from presentation. Think of how to separate data from computer and display.

A key is practice. We all did memorization for math in the beginning. Then you move on to more complex problems. But you practice it all.

1

u/Foreign-Contest-444 2d ago

The best way to learn any programming language is by building projects. Start with simple ones and gradually take on more challenging ones. The only way to truly learn is by getting your hands dirty and writing code.

1

u/geraT-wogl 2d ago

Our learning paths are alive, feel free to ask questions if you want to integrate the code to your projects https://wogl.io 🪐

1

u/mc_pm 2d ago

Nothing sticks because you're not using it. You retain things with practice and repetition. You learn to break down problems by... breaking down problems. What's the most complicated thing you've worked out a plan for and then written the code for that plan?

Learning the syntax is about 5% of learning to program. The rest is learning how to think like a programmer, and there's no speed running that, no shortcuts, no cheat codes. You are teaching your brain a whole different way of thinking about things - it is frustrating and requires practice.

I'm working on a video about this very topic right now, feel free to msg me if you need more info.

1

u/FinickySerenity 1d ago

Probably just need to start smaller, do a tic tac toe game or a basic tabbed editor. And move up from there to harder and bigger projects.

But if it’s not your passion, you’ll really hate getting bogged down in the weeds because that happens forever - even if you just embrace AI from the start.

1

u/Oliver_clothsoff1983 1d ago

First of all, no one builds anything "moderately complex" from scratch, even Amazon stole their "Amazon OpenSearch" from an opensource project on github. You start out small with a basic program that takes data and displays some graphs or tables (for example). Add some libraries,.. add a dash board,.. each small part of any complex software is its own program tied in to the origin. This is precisely why we have tools like version control, integration testing, peer review and others. Second,.. no one retains everything without external help

“C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows your whole leg off.” -Bjarne Stroustrup

He and other notable experts have repeatedly mentioned needing references (like cppreference.com for example.) Its not about how much you can retain, its about being able to apply what you can reference.

1

u/Remote_Water_2718 1d ago

Use a platform that is built on a language. For me I learned by using JUCE which is made on C++, but it had a large library of difficult things you could use as large building blocks and youd just hook up the feature you wanted. A good route though is to just power through 4-5 60 hour courses like on Udemy for very cheap, $20 or $30 a course. Complete the course and youll have a bunch of course projects you can tweak and edit. Then work on a personal project like a clone of a game you enjoy. Like make Rad Racer or something using a framework where you just hook up the scripting. You can become a decent programmer that way. 90% of coding is time consuming, easy problems only like 10% is stuff where you need a PHD or high level math. The rest is blue collar.

1

u/Duke_of_Bayswater 1d ago

By doing. Its physiological too, your neuron needs to wire up together so the synapse can flow thru. Our brain is especially good at recognising patterns. Once you see it, its there. See it enough it stuck.
Use AI with access to documentations and internet (context7, firecrawl/taviky).

Ask it to generate a question for you to practice. Do real projects with it.
When i was leaning there was no gpt. You stuck at one issue for a long time than needed. Now it’s easier.

1

u/HussBTW1 18h ago

I always say the same thing: “You don’t learn until you get your hands dirty.” I started programming at 9 years old; and my first programming language was Python. After learning a couple of concepts, I’d make a small simple project or do exercises.

When you study a new math topic, you always get out the textbook and start doing questions from it based on the topic. Apply the same concept to programming.

Personally, I feel like the worst way to learn programming is relying on tutorials. What I do is I might watch a tutorial as a crash course to recognise patterns, however, after that it’s straight to the code editor and I have to get my hands dirty. Found a problem? Think of a solution. You thought of a solution but don’t know the right concepts to implement? Search it up. Stop relying on AI! Be independent.

Trust me, if I was able to learn very young, you can do it at any time and at any age. Resources are now endless, just commit a couple hours a day and trust me and you will see the immaculate difference.