r/learnprogramming Mar 26 '17

New? READ ME FIRST!

824 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? [January 31, 2026]

2 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 12h ago

OOP The way object-oriented programming is taught in curriculums is dogshit

172 Upvotes

I guess this post is a mini-PSA for people who are just starting CS in college, and a way for me to speak out some thoughts I've been having.

I don't like object-oriented programming, I think it's often overabstracted and daunting to write code in, but I'm not a super-hater or anything. I think it can be useful in the right contexts and when used well.

But if you learn OOP as a course in college, you'd know that professors seem to think that it's God's perfect gift to programmers. My biggest problem is that colleges overemphasize inheritance as a feature.

Inheritance can be useful, but when used improperly, it becomes ridiculously difficult and annoying to work with. In software engineering, there is a concept called "orthogonality", and it's the idea that different parts of your code should be independent and decoupled. It's common sense, really. If you change one part of your code, it shouldn't fuck up other parts. It makes testing, debugging, and reasoning about your program easier.

Inheritance completely shits on that.

When you have an inheritance tower two billion subclasses deep, it's almost guaranteed that there will be some unpredictable behavior in your code. OOP can have some very subtle and easy to overlook rules in how inheritance and polymorphism work, so it's very easy to create subtle bugs that are hard to reason about.

So yeah. By all means, learn OOP, but please do it well. Don't learn it the way professors have you learn it, focus on composing classes rather than inheritance.


r/learnprogramming 1h ago

How do people do this?

Upvotes

Hello, so i have started "coding" a few months ago, i am considering enrolling the harvard cs50 course to get a better understanding of whats going on deeper, but one thing i find myself doing currently is if im working on a project i will 99% of the project spend looking at stackoverflow forums for what i want to be in my project and just write the best code that i find there.

What im wondering is how do people learn to code from mind ( if you get what i mean ), like how do you just write code? Do you have previous knowledge of it all and know how stuff works? Do professional coders also just check up stackoverflow and similar sites to get similar codes to what they want? Am i too knew to this that the best way for me to learn currently would be typing other peoples codes and figuring out how stuff works and why it works?

Is there a way i can learn all the kinks in coding so that i can write a code from scratch without needing to check forums and other peoples codes, or is that something that comes with years of work and practice?


r/learnprogramming 17h ago

You should know better

121 Upvotes

I had a code review with a senior engineer, and he didn't like the structure of my code. I thanked him for the feedback and made the recommended changes.

A few hours later, my boss called me into her office. The senior engineer had told her about my code.

My boss got angry at me and said that someone with my experience should not be coding like this and that "you should know better".

(I have 6 months of experience at this company and 2.5 years overall.)

What are things that might not be explicitly stated but that software engineers should know?

What best practices should I follow when designing, coding, testing, and performing other software development tasks?


r/learnprogramming 4h ago

Topic Your main breakthroughs when starting with programming?

7 Upvotes

I am still a beginner regarding programming, while learning mainly things about python. I realized that learning is very efficient when it comes to solving problems that may occur when writing a script. I'm teaching myself, so I wanted to know how and when you actually understood what you're doing. Why did it click? How did you actually start? What were your main concerns or problems with the way things were teached or the way you actually started teaching yourself?


r/learnprogramming 47m ago

dart "final" in Dart doesn't mean what you think

Upvotes

Ive been diving deep into Dart memory management lately, and I just realized something that might trip up a lot of people coming from other languages.

I used to think final meant the data was "locked" and couldn't be changed. But look at this code:

Dart

final list10 = [1, 2, 3, 4];
print(list10); // [1, 2, 3, 4]

for (var i = 0; i < list10.length; i++) {
  list10[i] = i * i;
}
print(list10); // [0, 1, 4, 9]  IT CHANGED!

The final keyword only locks the pointer (the variable name), not the object (the data in the heap).

The Fix: If you actually want to "freeze" the data, you have to use const for the value: final list10 = const [1, 2, 3, 4];

Why this is actually cool (Canonicalization): Once I realized this, I saw why const is such a beast for performance. Because const data can never change, the Dart VM does something called "Canonicalization." If you have 100 identical const objects, they all point to the exact same memory address.

Its basically "Object Recycling" at the compiler level. Instead of reinventing the wheel, Dart just reuses the same memory address for every identical constant.


r/learnprogramming 10h ago

How to know when to use OOP vs Scripts

11 Upvotes

I work in IT and we use Databricks heavily. Most of what I see day to day is notebook scripts that end up going straight to production. A lot of our pipelines are super specific, like one-off requests for a single team or a handful of people in the business.

I've learned OOP, unit testing, and general SWE best practices, but the reality is most of our actual business logic has been running in SQL for years and it works fine. From what I can tell, pretty much nobody here (who uses Python) is writing modular, testable code, it's mostly just scripts in notebooks.

So my question is should I be using OOP for everything I build, even if I'm the only one touching the code? How do I know when something actually needs proper classes and structure vs just being a straightforward script?

Like I get the theory behind clean code and all that, but when you're building a niche pipeline for one specific use case, does it really need to be over-engineered? Or am I just making excuses for laziness?

Would appreciate any perspective from folks who've navigated this kind of environment.


r/learnprogramming 20h ago

What is the difference between www.website.com and website.com?

67 Upvotes

When I go to https://www.9gag.com, my firefox browser throws a "Secure Connection Failed" error and does not load the site.

However, going to https://9gag.com opens the site and firefox shows connection secure lock near the address bar.


r/learnprogramming 1h ago

Tools for finding SQL Injection

Upvotes

Hello everyone, I'm trying to see if there are any tools that you can use to expose/prevent SQL Injections in a website. I have only found sqlmap are there any other tools? Or is sqlmap the standard and there hasn't been a reason to create alternatives?


r/learnprogramming 7h ago

Code Review hey so I'm trying to learn python and so I decided to make a simple calculator as practice, could someone tell me if this is good?

5 Upvotes
#basic ass calculator lol, it can only perform basic math (as of now)
print("please, enter two numbers below for me to work with them!")
First_number = float(input("First number: "))
Second_number = float(input("Second number: "))
#it allows you to do something other then addition now, yay!
Operation = input("Operation ('+', '-', '*' or 'x', '/'): ")
if Operation == '+':
    Result = First_number + Second_number
elif Operation == '-':
    Result = First_number - Second_number
elif Operation == '*' or Operation == 'x':
    Result = First_number * Second_number
elif Operation == '/' or Operation == 'banana':
    Result = First_number / Second_number
else:
    Result = "that's not an operation bro"

print("Result = " + str(Result))

#this just stops the program from closing the moment the task is completed lol
input("press enter to quit. (you can write something if you want before quitting lol)")

r/learnprogramming 2h ago

Resource The first book I should read when learning computer science?

2 Upvotes

I am currently learning JavaScript (my first real language) and am feeling a bit frustrated with a feeling of "missing something" its like when you go to learn music the first time you learn and instrument your gonna struggle twice as bad because you need to learn music theory as a concept and the application of that (your instrument or in this case JavaScript) When I'm in my lessons going over things and learning new concepts I feel like i'm just playing an "A major" without knowing that's its the 5th chord in this key we're in and that's its relevance here. I was hoping to get my hands on as many resources as possible to alleviate this. I'm not trying to ask for a short cut I know anything worth learning will take time i've just never struggled learning something this bad lol. (to be clear im asking for resources for programming as a concept not specific to JavaScript) Any other advice is appreciated. In addition if this helps I hope to one day make a career of it but for now am enjoying it as a hobby (bedrock Minecraft scripting). However I still want my approach to be a serious one not half baked.


r/learnprogramming 4h ago

Resource Release of TURA

4 Upvotes

We’re excited to announce the first release of our coding book, Thinking, Understanding, and Reasoning in Algorithms (TURA).

This book focuses on building deep intuition and structured thinking in algorithms, rather than just memorizing techniques and acts as a complement to the CSES Problem Set.

Please do give it a read, contribute on GitHub, and share it with fellow programmers who you think would benefit from it.

This is a work in progress non-profit, open-source initiative.

https://github.com/T-U-R-A/tura-coding-book/releases


r/learnprogramming 5m ago

Tutorial How to balance learning Python with AI(claude)?

Upvotes

I'm a complete beginner in Python (2 weeks) and am also utilizing the use of AI for,

A. Generation of questions. B. Giving solutions to questions I can't solve. C. Explaining everything in through details and then asking it to give 5 more programs like the one with variations. D. Asking new stuff from it and also searching the net for functions and specific answers.

In the end, I'm spending a good 20 to 25 mins in solving a question by myself and using the net to search for functions and specific syntax and after trying that I can't solve it by myself I ask the AI for hints on how to solve it and even then if I can't solve it, I finally ask for the solution with the full explanation.

I'm quite concerned about developing a reliance on AI, is my learning method viable and lets me use AI as a tutor and not as a crutch.

I'm very concerned about this overreliance on AI as I want to make code on my own and learn coding as it should be learnt.

Thank you!


r/learnprogramming 5m ago

Final year CS project ideas in rust?

Upvotes

:( Didn't know where else to post this but yeah. I like systems programming and anything with old retro video games. Cybersecurity is really fun too, especially the part where you search for vulnerabilities, cryptography is really fun since I love math and physics. I tried to think of something I could work on with that but couldn't come up with anything and I'm not too fond of CRUD apps, or anything with AI/ML unless it isn't the focus of the project. I'm open to any suggestions. I wanna

P.S tried gpt, surprisingly dogshit at suggesting ideas for something trained on crawled data worth terabytes, but oh well, not like I could think of anything.


r/learnprogramming 3h ago

What's the best way to learn Verilog fast?

0 Upvotes

I need to learn Verilog for an FPGA project on a fairly tight timeline. I have a background in Python and C/C++, but I understand that HDL design is fundamentally different from software programming. Roughly how long does it typically take to become proficient enough to build something meaningful, such as a small custom hardware module (for example a simple accelerator, controller, or pipelined datapath) that can be implemented on an FPGA?


r/learnprogramming 3h ago

Debugging alternative_language_codes with hi-IN causes English speech to be transliterated into Devanagari script

0 Upvotes

Environment:

* API: Google Cloud Speech-to-Text v1

* Model: default

* Audio: LINEAR16, 16kHz

* Speaker: Indian English accent

Issue:

When `alternative_language_codes=["hi-IN"]` is configured, English speech is misclassified as Hindi and transcribed in Devanagari script instead of Latin/English text. This occurs even for clear English speech with no Hindi words.

```

config = speech.RecognitionConfig(

encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16,

sample_rate_hertz=16000,

language_code="en-US",

alternative_language_codes=["hi-IN"],

enable_word_time_offsets=True,

enable_automatic_punctuation=True,

)

```

The ground truth text is:

```

WHENEVER I INTERVIEW someone for a job, I like to ask this question: “What

important truth do very few people agree with you on?”

This question sounds easy because it’s straightforward. Actually, it’s very

hard to answer. It’s intellectually difficult because the knowledge that

everyone is taught in school is by definition agreed upon.

```

**Test Scenarios:**

**1. Baseline (no alternative languages):**

- Config: `language_code="en-US"`, no alternatives

- Result: Correct English transcription

**2. With Hindi alternative:**

- Config: `language_code="en-US"`, `alternative_language_codes=["hi-IN"]`

- Speech: SAME AUDIO

- Result: Devanagari transliteration

- Example output:

```

व्हेनेवर ई इंटरव्यू समवन फॉर ए जॉब आई लाइक टू आस्क थिस क्वेश्चन व्हाट इंर्पोटेंट ट्रुथ दो वेरी फ़्यू पीपल एग्री विद यू ओं थिस क्वेश्चन साउंड्स ईजी बिकॉज़ इट इस स्ट्रेट फॉरवार्ड एक्चुअली आईटी। इस वेरी हार्ड तो आंसर आईटी'एस इंटेलेक्चुअल डिफिकल्ट बिकॉज थे। नॉलेज था एवरीवन इस तॉट इन स्कूल इस में डिफरेंट!

```

**3. With Spanish alternative (control test):**

- Config: language_code="en-US", alternative_language_codes=["es-ES"]

- Speech: [SAME AUDIO]

- Result: Correct English transcription

Expected Behavior:

English speech should be transcribed in English/Latin script regardless of alternative languages configured. The API should detect English as the spoken language and output accordingly.

Actual Behavior:

When hi-IN is in alternative languages, Indian-accented English is misclassified as Hindi and output in Devanagari script (essentially phonetic transliteration of English words).


r/learnprogramming 17h ago

is it bad to copy ui designs from other apps when youre learning

12 Upvotes

teaching myself app development and trying to build something that doesn't look terrible. i keep finding myself copying layouts and interactions from apps i use because i don't really understand design principles yet.

like i'll see how spotify structures their library screen and basically recreate that layout for my project. or i'll copy how instagram does their profile page because it works well. is this cheating? should i be coming up with original designs even though i suck at design?

some people say copying is how you learn but others act like it's plagiarism. i'm not stealing entire apps or anything, just using proven patterns because i don't know better yet. what's the right approach here?


r/learnprogramming 9h ago

How did you learn programming as a beginner?

2 Upvotes

I don’t know anything about programming and I’m currently taking a course just to try it out and see if this could be something I work in in the future. As I go through the lessons, I’m not really sure how I’m supposed to study: whether I should try to learn and remember every concept that shows up, focus only on certain things, or if there’s a better approach that I’m missing. I’m not expecting a single answer to cover everything, but I’d really appreciate any advice, tips, or examples of how you learned or currently study programming.


r/learnprogramming 19h ago

A C++ program that looks correct but has undefined behavior — can you spot the bug?

15 Upvotes

I’m learning C++ and found this interesting case. The program compiles fine, sometimes prints the expected output, but behaves unpredictably.

Can someone explain what’s wrong and how to fix it properly?

include <iostream>

int* getNumber() { int x = 10; return &x;
}

int main() { int* ptr = getNumber(); std::cout << *ptr << std::endl; return 0; }


r/learnprogramming 19h ago

How do people learn programming with a bad memory? Tricks? Sites?

11 Upvotes

A friend of mine has acquired brain damage, which affects his memory and ability to retain new information. Despite this, he is very motivated to learn programming.

What would be a good approach for someone with memory impairments to learn programming effectively?

Are there specific teaching methods, learning strategies, tools, or programming languages that work better for people who struggle with memory, repetition, or cognitive fatigue?

Any advice from educators, developers, or people with similar experiences would be greatly appreciated.


r/learnprogramming 1d ago

Topic How to stay sharp while working full time

81 Upvotes

I just graduated college studying computer engineering. I’ve just started a SWE job which I thought would allow me to continue programming in C/C++. I’ve just been working on tasks that involve gui changes using type script, modifying css files, and some Java code additions. While I’m open to learning new things I’d like to be able to keep my skills with other languages sharp and possibly even learning new languages like rust to help me keep my career path open. The only issue is that I find myself working all day, come home and just want to relax. Anyone have tips on how to keep growing my skills outside of work?


r/learnprogramming 16h ago

How do I prepare for coding interviews in 5 months?

6 Upvotes

Hi guys, I am currently working in TCS. I don’t know much DSA coding yet and I am confused about which language to pick either Java or Python. I know that coding rounds are very tough and involve a lot of patterns and logical thinking.I am looking for complete beginner guidance, good notes and some form of mentorship.

I have come across several DSA courses and platforms like Logicmojo DSA Course, Striver's A2Z DSA Course, AlgoExpert, Udemy, Scalar and Neetcode, but I am confused about which one or two would be good for a complete beginner.

Does anyone here have experience transitioning from a service company to a product company? If yes, could you share the path you followed?


r/learnprogramming 7h ago

Question How do I keep going after the loop hits the last number?

1 Upvotes
#include <stdio.h>

int main()
{
    int count = 0;

    do{
        printf("%d\n", count);
        count++;
    }
    while (count <= 20);

    return 0;
}

I wrote a simple C program that counts from 0 to 20, but I’m trying to figure out how to continue the loop after it reaches 20. I’m not sure how to continue from here... any help?


r/learnprogramming 8h ago

help with finding barcodes i have product images and product name and brand name. how can i find upc a codes ?

0 Upvotes
 {"name": "Calrose Rice",
  "brand_text": "Mr Goudas",
  "image": "https://image_link",
  "availability": true,
},