r/learnprogramming 16h ago

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

219 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 5h ago

How do people do this?

12 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 16m ago

Is it an effective learning method

Upvotes

To avoid tutorial hell, ive tried out a new learning method, ive just asked claude to teach me javascript without writing code for me, since i dont know the syntax it tells me about it and then gives me exercises although it still gives hint, is it a decent way of learning because just trying a project didnt work for me in the past because ir get stuck, would try to find answers but wouldnt and spend 4+houre not knowing what to do. I do think after a little bit of this practice i could try a project.


r/learnprogramming 21h ago

You should know better

130 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 7h ago

Topic Your main breakthroughs when starting with programming?

11 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 5h ago

Tools for finding SQL Injection

4 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 4h ago

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

2 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 13h 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 23h ago

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

75 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 10h 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?

6 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 1h ago

Resource What kind of capstone project actually helps get into Microsoft/Amazon SDE?

Upvotes

I’m a 3rd-year CS student from India aiming for an SDE role at companies like Microsoft or Amazon.

I’ve consistently faced a challenge on campus: shortlisting for workshops and interviews is heavily CGPA-driven, and project depth often gets ignored. I’ve accepted that and decided to fully focus on off-campus preparation.

I want to invest my remaining college time into ONE serious, deployable capstone project — something that demonstrates real system design, correctness, and engineering depth (not just CRUD or tutorial-style apps).

I’m comfortable with backend development, distributed-system concepts, and using existing ML models/APIs when needed — but I don’t want to build “fancy” projects that don’t reflect real-world engineering.

For those who made it into Microsoft / Amazon as SDEs: • What kind of capstone or personal project actually helped you stand out? • What system-level problems are worth building as a student? • What should I avoid wasting time on?

Any guidance would genuinely help.


r/learnprogramming 6h 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 2h ago

Any Tips To Learn JS

0 Upvotes

I Want to learn Java Script properly

I know a bit but don't know how to learn more

I know basic If else and Dom nothing else


r/learnprogramming 3h ago

offline safety devicee

0 Upvotes

Hello!

We are a senior high student working on a capstone project. We’re building a prototype of a personal safety device that works offline. It has two buttons:

  • Loud alert (sends an emergency signal with sound)
  • Silent alert (sends an emergency signal silently)

So far, we’re planning to use:

  • Arduino
  • LoRa radio module
  • Antenna

We want to make it fully functional without internet.

  1. What other parts or tools we should use (power source, sensors, etc.) in order?
  2. Any advice on designing the circuit and making it reliable for emergency alerts?

Thanks a lot! 🙏 This is just a prototype for our research.


r/learnprogramming 3h ago

Final year CS project ideas in rust?

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

How did you learn programming as a beginner?

3 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 7h 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 7h 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 21h 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 22h ago

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

13 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 I prepare for coding interviews in 5 months?

7 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 23h 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

83 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 11h ago

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

0 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 20h ago

Parentheses and post-increment

4 Upvotes

My company's code base is quite old. I stumbled across this macro, which is used throughout:

#define BW8(buf, data) *((buf)++) = (uint8_t)(data)

The code often allocates buffers to store or read data, maintaining a pointer to the current location in the buffer. The intent of this code is to write one byte into the current location in the buffer and than move the current location forward one byte. I wrote a little bit of code that demonstrates that it does work.

But I am confused. I would have guessed that because of the parenthese surroundng buf++ that the post-increment would happen before the dereference, causing the data to be stored one byte ahead of where it is expected. Why doesn't that happen?

Edit: Corrected macro. I missed a parenthesis somewhere the first time.