r/learnprogramming Mar 26 '17

New? READ ME FIRST!

821 Upvotes

Welcome to /r/learnprogramming!

Quick start:

  1. New to programming? Not sure how to start learning? See FAQ - Getting started.
  2. Have a question? Our FAQ covers many common questions; check that first. Also try searching old posts, either via google or via reddit's search.
  3. Your question isn't answered in the FAQ? Please read the following:

Getting debugging help

If your question is about code, make sure it's specific and provides all information up-front. Here's a checklist of what to include:

  1. A concise but descriptive title.
  2. A good description of the problem.
  3. A minimal, easily runnable, and well-formatted program that demonstrates your problem.
  4. The output you expected and what you got instead. If you got an error, include the full error message.

Do your best to solve your problem before posting. The quality of the answers will be proportional to the amount of effort you put into your post. Note that title-only posts are automatically removed.

Also see our full posting guidelines and the subreddit rules. After you post a question, DO NOT delete it!

Asking conceptual questions

Asking conceptual questions is ok, but please check our FAQ and search older posts first.

If you plan on asking a question similar to one in the FAQ, explain what exactly the FAQ didn't address and clarify what you're looking for instead. See our full guidelines on asking conceptual questions for more details.

Subreddit rules

Please read our rules and other policies before posting. If you see somebody breaking a rule, report it! Reports and PMs to the mod team are the quickest ways to bring issues to our attention.


r/learnprogramming 4d ago

What have you been working on recently? [July 18, 2026]

1 Upvotes

What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

A few requests:

  1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

  2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

  3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

This thread will remained stickied over the weekend. Link to past threads here.


r/learnprogramming 8h ago

Why coding is so confusing and a braindrain.

52 Upvotes

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.


r/learnprogramming 7h ago

I'm in my 2nd year, but I don't know C. My college is teaching DSA in C. How much C should I learn before the semester ends?

14 Upvotes

Hi everyone,

I'm currently in my 2nd year of Computer Science. I don't have much knowledge of C.

My college has started teaching Data Structures and Algorithms (DSA) using C, and I'm worried because I feel like I'm already behind.

How much C should I aim to learn before the end of this semester to comfortably understand DSA? Do I need to master the language, or is learning the fundamentals enough?

Also, which C topics are absolutely essential for DSA, and which ones can I learn later?

I'd really appreciate any advice or learning roadmap. Thanks!


r/learnprogramming 1h ago

Topic is it a waste of time building projects without using frameworks if you already know the foundational concepts needed for it ?

Upvotes

so currently i'm learning web dev and decided to start building some projects with pure javascript before moving to the frameworks .

knowing that i already learned some react basics and build the simple projects that are listed in the freecodecamp tutorial video . i tried back then to pause before the solution to every problem and did fairly well on applying what i was learning but i never build something big like a e-commerce website with it or a blog or anything that requires databases even though i know mongodb , mysql , oracle databases and previously made a e-commerce website using php which i forgot btw .

i understand the important concepts in javascript lfor example asynchronous operations , objects ,Modules , destructing.

i really need advise like my goal right now is to be able to comfortably build a any web application that requires both front-end and backend .

i really don't enjoy front-end much as much as the code is functional i don't really take great detail in it . although i want to get into machine learning and automation after web dev as it is what i really like and enjoy.

i really need your advice programmers !


r/learnprogramming 11h ago

Starting

18 Upvotes

Is CS50x, then CS50 Python, and then CS50 SQL a good way to start backend engineering? I am really excited! My main goal right now is to land a part time job.


r/learnprogramming 4m ago

How to load large files into memory in c

Upvotes

I'm using a library that interacts with mpd (the music player) and have to use a function to receive the album art of a song, but the function only provides part of the the image at a time, receiving the full file over multiple function calls.

(libmpdclients's mpd_run_albumart() for those interested)

using malloc in this scenario, and assuming I don't know the file's size to begin with, what's the best way to do this?

Should I just malloc an arbiritarily large amount and fill it - seems very naiive.

Should I malloc an extra block of memory for each function call (I know the max amount i can receive per function call) - but surely this memory could be non-contiguous and cause problems?

Allocate a bit of memory -> function call and fill it -> if that's not the full image, then allocate a new bit of memory = to current size of the file+size of another incoming package -> copy the existing data in & free the old block -> repeat until the whole things' free?

Seems like a hell of a lot of malloc and free() calls though, would this too taxing?

What do people think?

Thanks so much in advance!


r/learnprogramming 7m ago

Monolithic designed auth solution

Upvotes

I am trying to learn modular monoliths and I want to use this auth solutions for repetitive use for my applications.

If I asked you to convert the repo linked, into monolithic patterns, how would you do it for app/.

Repo: https://github.com/auth0-blog/auth0-rbac-fga-fastapi

fastapi-openfga-project/
├── app/
│ ├── main.py # FastAPI application entry point
│ ├── config.py # Configuration settings
│ ├── database.py # SQLAlchemy database setup and models
│ ├── models/
│ │ ├── organization.py # Organization Pydantic models
│ │ └── resource.py # Resource Pydantic models
│ ├── routes/
│ │ ├── organization_routes.py # Organization management endpoints
│ │ └── resource_routes.py # Resource management endpoints
│ ├── services/
│ │ └── authorization_service.py # OpenFGA integration
│ ├── utils/
│ │ └── auth0_fga_client.py # OpenFGA client wrapper
│ └── openfga/
│ └── model.fga.yaml # OpenFGA model definition
├── app.db # SQLite database file (auto-created)
├── requirements.txt
└── README.md


r/learnprogramming 11m ago

I am 12 years old. I haven't written code yet, but I created a GitHub repository to "Refactor my Mindset" first. What do you think?

Upvotes

Hi everyone,

I’m a 12-year-old developer-to-be, and I’m deeply passionate about learning and tech. I’m already independently mapping out my academic and career goals.

Before diving into Python and writing my first lines of code, I decided that a great programmer needs to "refactor their own mind" first. That’s why I started a repository called **Mental Engineering**.

Right now, I am using this space to:

  1. Practice and sharpen my English by writing out my growth and productivity philosophies.
  2. Prepare the clean foundation and structure for when I start uploading my actual apps and scripts.

I just updated my main README.md and published my first thought log (about dealing with family judgments and focusing on results over noise). I’m not here to spam—I would just honestly love to get some feedback from experienced developers on this approach and the repository layout.

Here is the link: https://github.com/ivan8100

Thank you so much to anyone who takes a moment to check it out and support a young coder starting out! 🧠🚀


r/learnprogramming 1d ago

I want to make something cute for my boyfriend

75 Upvotes

Hello everyone, I want to program something for my boyfriend as a surprise and i need some ideas! (he's a programmer and I know nothing related to it BUT I'm trying). I already made some coding in html for a cute website where he couldn't press the button "no" before (I saw a tutorial in a youtube video xd) but i want to do something fully myself, I want to surprise him. I don't mind studying the languages I'm fine with that :(( just need some ideas...

Edit: I just want to surprise him and I thought it would be cute to program him something. I mean I know his taste and I know he likes stuff from marvel and dc (in fact, I started watching all marvel movies with him) so maybe something related to it? I want to make something cute and somewhat funny so he can laugh a bit aswell.


r/learnprogramming 2h ago

Newbie, how to manage dependency hell?

0 Upvotes

How do i successfully deploy a model or run it 😭😭?
I don't mean ollama deployments, I mean kling, LP, OP etc.

How do i manage dependency hell?

uv or pip?

Please help.


r/learnprogramming 30m ago

Is a Data crash possible in real life?

Upvotes

Hello! I'm a beginner programmer, I have my own prejudices and all that.

I've always wondered if it's possible to cause a Data crash like in Cyberpunk: Edgerunners? I have no idea what it would take to break the INTERNET.

(I used a translator, so please forgive any errors)

UPD: I noticed from the comments that someone latched onto the political aspect. I didn't intend to link it to politics in any way; I was simply interested in the question mentioned above.


r/learnprogramming 19h ago

System Design: What articles or videos do you recommend for making a Twitter clone or Newsfeed with followers that uses a Relational DB?

12 Upvotes

I want the simplest approach that would get me through an interview as mid-level. Specially about the news feed that seems like the worse problem.

I've watched the Hello Interview video but I'm too unfamiliar (and never used them in production where I work), with the patterns and technologies. I feel I wouldn't be able to explain it in depth.

Thanks!


r/learnprogramming 1d ago

Learning I want create an OS by my own

109 Upvotes

I want create a basic OS for an hypothetical dumbest phone that i would like to build (or initially emulate on my PC). I don't know ANYTHING about this world so i don't know where to start. I understand that this adventure can take me very much time but i want to learn. This OS should be only able to let me of doing calls.
I thought that i should programming in assembly and maybe an high level (as C/C++). Could i use RISC-V? Because i don't know the assembly and i think that for the purpose that i want achieve, that language can be enough to me, right?


r/learnprogramming 15h ago

Resource Expectations when developing an Android Application

5 Upvotes

I started to delve right into Kotlin Programming Language under Android Studio and it's getting interesting. But as I get further and further to the field, I realized that it wasn't really easy when dealing with advanced topics such as State Hoisting, Mutable States, ViewModels, and Hardware Services (Bluetooth, Camera, and Accessibility).

Therefore, as a hobbyist, I would like to ask what are the things I should expect while coding (i.e. getting frustrated or stuck)? Do I also need to code my own Unit Tests and Android Tests to confirm if it works? And finally, what are the best practices or habits that makes the code much more readable?


r/learnprogramming 9h ago

Code Review (C++) Reimplemented std::array with docs and a guide - looking for feedback

0 Upvotes

Hi everyone, I just released the first version of my educational project, STL From Scratch:
https://github.com/bilyayeva/stl-from-scratch

The goal is to reimplement STL components using the C++20 standard. (I use cppreference for comparison, and I’ve read the actual standard just a little bit.)

All of the self-implemented components are in the sfs namespace.

It also contains a pretty detailed guide on how to implement it yourself. I’ve tried to explain everything in my implementation. Every method has its own description and usage example, and there is also a test suite for all functions.

About the repo: every commit follows a consistent naming style. I also added GitHub Actions and Dependabot, and it has a .gitignore file.
I would really appreciate either a code review or just some hints.
P.S. The release has two compiler warnings, but I’ve already fixed them on master.


r/learnprogramming 6h ago

Using AI to have extra exercises

0 Upvotes

Good morning. I have recently started studying C# with the book The C# Player's Guide. To learn more effectively, I am using AI to generate extra exercises in addition to the ones in the book, but I don't know if the ones from the AI are good enough.

Here's an example of one I had to do after finishing the chapter about loops to review the previous chapters

The Tavern Simulator (Boss Fight: Total Review)

You just finished a quest and decide to rest at the local tavern. The program must simulate your choices during the evening, managing your wallet and your stamina.

Coding Rules:

Change the console title to "Tavern Simulator".

Ask the player for their name and store it in a string.

Create two starting status variables:

coins = 50

energy = 100

Open a large while(true) loop that represents your time spent at the tavern. At the beginning of each loop iteration, clear the screen (Console.Clear()) and print the player's current stats like this (use colors!):

Name: [Player Name]

Coins: [X] (in Yellow)

Energy: [Y] (in Green)

Display a menu with these options:

1 - Buy a hot meal (Costs 15 coins, restores 30 energy).

2 - Buy a dwarven ale (Costs 5 coins, restores 10 energy).

3 - Go outside and chop wood (Earn 20 coins, costs 40 energy).

4 - Go to sleep (End the evening).

Read the user's input and use a switch statement to handle the 4 choices.

Conditional Logic (The if statements inside the switch):

If choice 1 or 2: check first if the player has enough coins! If they do, do the math (subtract coins, add energy) and print a success message. Else, print a red error message ("Not enough coins!").

If choice 3: check if the player has at least 40 energy! Otherwise, print an error message ("You are too tired!").

If choice 4: use the break command to escape the infinite loop.

(Optional but recommended): Add a Console.ReadKey(); after the success/error messages, so the user has time to read what happened before the Console.Clear() wipes the screen for the next turn.

Outside the loop (after the user goes to sleep), print a goodnight message: "Goodnight [Name], you finished the day with [X] coins and [Y] energy."


r/learnprogramming 1d ago

Chess Engine

11 Upvotes

I am trying to code a chess engine as a personal project, but have literally no idea where to start.

I have some very limited experience with python, and would greatly appreciate any help in finding where to write my code, what programs to use etc, as well as any advice in general.

Thanks!


r/learnprogramming 1d ago

Struggling to retain programming fundamentals — what study methods work for you?

12 Upvotes

Hi everyone, I'm learning web development on my own. I did a bit of HTML, CSS, and JavaScript three years ago, then stepped away because of high school.

Now I'm in university (not a CS/BSc program) and getting back on track learning programming through online courses (currently taking the JavaScript Essentials Training course on LinkedIn).

My question is: what methods or techniques do you use when studying technical concepts like the DOM and prototypal inheritance in JavaScript?

The reason I'm asking is that I'm struggling a bit with retaining the foundational concepts themselves. I don't want to memorize code — I want to actually retain the fundamentals.

Also, if possible, could you recommend sources and material that you think would be beneficial alongside online courses? I'm relying on MDN's docs at the moment.


r/learnprogramming 1d ago

How should I learn programming from official documentation?

60 Upvotes

I am a student who wants to learn programming through official documentation. However, official documentation often contains many concepts and features, and most of them are not needed for everyday programming tasks.

Is official documentation an inefficient way to learn programming?

If official documentation is an effective way to learn, how should I read it? How do I decide what to read in depth and what to skip?


r/learnprogramming 9h ago

Is Python with DSA worth it?

0 Upvotes

Same as the Title


r/learnprogramming 1d ago

Solved I learned TCP server in a week and....

143 Upvotes

So as I posted a week ago regarding a task assigned to me by my mentor in this post .
I implemented beej's guide to networking and man , this was such a great resource, cant express enough. Also shoutout to the kind stranger u/teraflop who gave me some tips and introduced me to Beej the G.
Now I am thinking of creating a library of TCP server first and then implementing the Websocket logic and RFC6455. haha baby steps. It's gonna take a while I guess. Y'all are free to give me any advice or any resource to learn from.
Thank you for reading this
P.S I am new to C programming so your advice would be really helpful.
here is my repo


r/learnprogramming 1d ago

CSAPP or DSA first?

2 Upvotes

Hey everyone,

Just finished going through C programming book (by K.N King) and I am ready to move on to other topics. I was particularly interested in this book called Computer Systems a Programmer's perspective. I want to get into low level programming, but I am wondering whether I should learn data structures and algorithms (Algorithm Design Manual by Skiena) before diving into computer systems.

Any advice?


r/learnprogramming 1d ago

Can I only use C++ alone instead of using blueprints with them in UE5?

2 Upvotes

I've come to realize that C++ was not modified by Unreal Engine 5 like how Unity does it.

But something just came in my head that made me think if I fully learned C++ I could make only a C++ game with only typing instead of nodes.

What concerns me the most is that I am not sure if I will have to do hundreds and hundreds of lines just to make a single thing work.


r/learnprogramming 1d ago

godot collision help

0 Upvotes

I'm working on my first project, I've looked into a bunch of tutorials to figure out what's wrong with the code or maybe a different method like layering but I cant seem to figure out how to do enemy collision. i would really appreciate some help

maingd.

extends Node2D

# Called when the node enters the scene tree for the first time.

func _ready() -> void:

`_setup_level()`

# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta: float) -> void:

`pass`

func _setup_level() -> void:

`#connect enemies`

`var enemies = $levelroot.get_node_or_null("Enemies")` 

`if enemies:`

    `for enemy in enemies.get_children():`

        `enemy.player_died.connect(_on_player_died)`

# - - - - - - - - -

# signal handlers

#- - - - - - - - -

func _on_player_died(body):

`print(body)`

`print("Player_killed")`

.................................................................................................................

playergd.
extends CharacterBody2D

u/onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D

u/onready var jump_sound: AudioStreamPlayer2D = $"jump sound"

const SPEED = 300.0

const JUMP_VELOCITY = -850.0

var alive = true

func _physics_process(delta: float) -> void:

`if !alive:`

    `return`

`#Add animation`

`if velocity.x > 1 or velocity.x < -1:`

    `animated_sprite_2d.animation = "walk"`

`else:`

    `animated_sprite_2d.animation = "idle"`



`# Add the gravity.`

`if not is_on_floor():`

    `velocity += get_gravity() * delta`

    `animated_sprite_2d.animation = "jump"`



`# Handle jump.`

`if Input.is_action_just_pressed("jump") and is_on_floor():`

    `velocity.y = JUMP_VELOCITY`

    `jump_sound.play()`



`var direction := Input.get_axis("left", "right")`

`if direction:`

    `velocity.x = direction * SPEED`

`else:`

    `velocity.x = move_toward(velocity.x, 0, SPEED)`



`move_and_slide()`



`if direction == 1.0:`

    `animated_sprite_2d.flip_h = false`

`elif  direction == -1.0:`

    `animated_sprite_2d.flip_h = true`

func die() -> void:

`AnimatedSprite2D.animation = "dying"`

`alive = false`

..............................................................................................

enemygd.

extends Area2D

u/onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D

signal player_died

const SPEED = 100.0

var direction = 1

# Called when the node enters the scene tree for the first time.

func _ready() -> void:

`pass # Replace with function body.`

# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta: float) -> void:

`position.x += direction * SPEED * delta` 

func _on_timer_timeout() -> void:

`direction *= -1`

`animated_sprite_2d.flip_h = !animated_sprite_2d.flip_h`

func _on_body_entered(body: Node2D) -> void:

if body.name == "Player" and body.alive:
emit_signal("player_died", body)