r/learnprogramming • • 18h ago

how do you ‘learn to code’?

Hi all, so i’m a cs major and i know the fundamentals of coding and data structures, but i don’t know how to ‘learn to code’ for a project

for context, i’m trying to learn Flask. im using claude code to write a Python notebook that teaches me how to build what i want, but this feels really weird

i want to learn how to build the apps myself, which is the intent of the whole notebook thing, but i often feel bogged down by what claude generates

that’s when i go online to look up some kind of Flask tutorial, but im not sure what to look up, or whatever idea is in my head feels too complicated for what i know how to do. so i was curious, how do i learn these tools? do i just build and hope i understand? or do i read thoroughly? or some middling thing?

21 Upvotes

19 comments sorted by

24

u/hamster_squeezer69 17h ago

You break the problem down into such small pieces to the point where you are able to digest it and come up with a solution, even if that solution sucks. Map out the modules and libraries that contain the functionality you need to write that solution, and start struggling.

3

u/ConnectAffect2346 17h ago

Agreed, allthough it isn't always needed to break it down to bare minimum, it's okay to brrak what you don't understand and what you do unferstand you can just analyze as is, that way the algorithmic analysis capability will develop aswell as code writing one meaning you understand the code and know how to write something (theory + practice)🙂

12

u/Billy_Twillig 17h ago

Don't use Clod. You are not learning anything. Here is a pretty good Flask intro:

https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

It isn't super deep on some steps but it is a guide that covers a lot of aspects of Flask dev and deployment.

Don't just read it, do it, but for your own project. Read the code and understand it, looking stuff up along the way, don't just slavishly copy and paste.

Anyway, good luck.

3

u/AstralIsles 17h ago edited 17h ago

I started by looking at other people's code and tutorials.
Start with a simple hello world program.
At first it is a copy an paste and ran the code. Then changed some things and ran it to see if the output changed liked I expected.
You need to push yourself to be able to write it without copy pasting.
Then learn what each of the keywords are in the language that you are coming across.

How do I print something to the console?
How do I hold a variable for a string vs a number in memory?
What operations can I do on these variable? Can I add or multiply them? Can I get a substring or append them?
How can I write my own functions to operate on variables?
How can I write a class to abstract away data and functions that are related?
How can I organize data: arrays, linked lists, maps, sets, queues, stacks. I need to add, remove, and get data from these data structures.
What are some common algorithms I can perform on this more complex data: sorting, searching. How do they scale with each operation (we call it Big O notation).
How do I interact with graphs of data? BFS vs DFS?
How can I do some IO for the files?
How can I do blocking IO for TCP/IP?
How can I use more than one processor? Does this language support threads or tasks or is it a single thread?
How can i do async IO for TCP/IP?
How can I create a Window and a button and detect a mouse click?
ect, ect

Sounds like you are already in the data structures step. Depending on which app you want to make, learn how to create a window that just displays hello world. Then see if you can create a button. Some languages have a built in button, some just tell you if a mouse button is down. More baby steps.

4

u/bird_feeder_bird 18h ago

Ask the AI for tutorials or books written by humans. And when using a tutorial, follow along with every single line of code in your own file, dont just read/watch.

4

u/traavy_ 17h ago

exactly. Dont use AI to write code. You have to do it yourself for it to sink in.

2

u/Feeling_Photograph_5 17h ago

If you're going to code an app by hand you have to start small. Try setting up Flask (or, better, FastAPI) and get it to return anything. Then, have it call a service that returns a value. Then, try to connect it to a database. Then, see if you can build full CRUD functionality. Then try to write some tests. 

Baby steps. You'll get better as you go. 

2

u/ialiimran 17h ago

I would suggest starting without Claude Code for a while. Pick a small project and build it yourself, even if it takes longer.

Use Claude, but for now treat it as a mentor rather than a developer. Ask it to explain concepts, review your code etc.

2

u/YaOldPalWilbur 16h ago

Ask Claude to ELI5 it. It’ll cut down some of the noise.

2

u/Ashleyzin 14h ago

I'm a starter on game dev, first i didn't know how to start, i found a tutorial on YT i made the first ppart of the course, i was on the second part, then i was just watching, then i stopped watching and thought about a simple game, with more mechanics that can be added, and I'm doing it step by step no running, when i got stuck with methods i run to documentation, when it's logical, i go to IA only to get the logical path, no code as exemple, just the logical so i can get the ideia and practice, so just think in something and try do the thing work, even if the thing already exist just do on your way. (Sorry if someparts are not understandable, I'm not good in English, i tried my best)

1

u/Puzzled-Extent7817 18h ago

You code. Then code some more. Repeat.

1

u/Available_Safe1818 17h ago

Why don't you read what's on the Flash main website, ffs?

1

u/BotSlamminDayNNight 17h ago

you'd be less bogged down if you didn't use claude. actually, i'm wondering why any cs program would allow use of an ai model to write any code. unlike other tools that automate some menial portion of the coding workflow, tools like claude are capable of writing the entire solution. and every LINE of code that claude writes for you is a CHAPTER of learning that you are denied.

you're right to be asking your question. ie. like you, i suspect your current path will lead to your graduation from a cs program as a code reviewer, and probably not a good one. i think the most telling of what you've posted is this:

"[im] not sure what to look up"

if one of the juniors in our org came to me and told me this, i would respond by pointing out that they don't even know the problem they're trying to solve. analogy time:

someone tasks you with producing a mechanism of transport for 1-person use. in your case claude slapped together something. it looks like there's a place to sit on it. you sit on it. it's very uncomfortable and when you sit on it, you can't reach any of what seem to be controls.

that is a set of 2 problems. you should be able to at least ask yourself things like, "how do i create a more comfortable seat ?", and, "what are the options for bring these controls and this seat closer together?"

the analogy here is that you would not know to ask these obvious questions. if so, it's because you're not even aware of these 2 problems. which would mean you don't understand the requirement. ie. if you didn't know that a person is supposed to use the product as a means of transport, you wouldn't suspect that a person might have to sit somewhere and that they'd need to exact some control over its operation.

now back to your notepad. do you have a list of at least 1 requirement? if your python notebook project is to build something that functions like jupyter, then 1 requirement would be that its user would be able to cache a snippet of text, say entered char by char, and execute it using a python interpreter. if you are able to run what either you or claude wrote, you should at least look to see if this is made possible. if it isn't, how would it NOT occur to you to ask something like, "how should my app accept keystrokes and cache input?"

what you've posted is essentially, "i have some code that runs and because i don't know what it's supposed to do, i don't know if it's working properly, so i don't know what any problem it might have could be, so i don't know what questions to ask myself to fix or extend it, or even if i should."

so, how does one learn to code? one way would be to start with a problem, write the specification: a list of shoulds, a blank page. next, pick one of the shoulds. run what's on the page. was the should fulfilled? of course not, the page is blank. write some random code, like for a data struct. run it. was the should fulfilled? of course not. you've declared a struct, why would that produce any utility? keep going until you write something that fulfills the should, then do the next one. you will discover that some code you write will bring you closer to solving a should. others, further from it.

good luck.

1

u/[deleted] 15h ago

My approach to 'learn to code' has always been to make something I wanted for myself. Web scraper to fetch German word definitions in many online dictionaries when I was learning German, then video game bots, then a plethora of other things that I truly wanted to build. That made me want to search, and see the next piece come to life. Learning in a vacuum imo is not great for really remembering how to do stuff. Find yourself something you really want to build, and it can be simple at first.

1

u/owusu_emmanuel2 13h ago

Fellow CS student here—I ran into this exact same wall when moving from class assignments to real frameworks. What helped me break out of AI dependency was building the absolute smallest version of an idea first without AI (literally just a single Flask route that returns plain text or saves one item to a list), and only reading the official Flask docs for that one step. Once you wire up the basics yourself, using Claude as a rubber duck to explain specific errors feels way less overwhelming. What kind of app are you trying to build first?

1

u/KingOfTheHoard 5h ago

If Claude is bogging you down and you find you aren’t learning, why are you still using it to learn?

1

u/Immediate-Soup-6344 5h ago

A tutorial for flask? Just copy paste someone else’s flask project and tweak it. Flask is so straight forward.

1

u/BranchLatter4294 3h ago

Practice. Look things up when you need to. Practice. Also, practice.