r/learnprogramming 9h 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 12h ago

Starting

17 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 8h 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?

16 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 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?

13 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 16h 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 40m 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 2h ago

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

5 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 33m ago

Tips on learning C #

Upvotes

hello im new to programming and i want to learn C# i already aquired the basics of algorithmics and i know C


r/learnprogramming 43m 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 10h 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 3h 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 7h 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 1h 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 10h ago

Is Python with DSA worth it?

0 Upvotes

Same as the Title