this post was submitted on 14 Nov 2024
61 points (87.7% liked)

Programmer Humor

32472 readers
667 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 21 comments
sorted by: hot top controversial new old
[–] [email protected] 20 points 22 hours ago* (last edited 22 hours ago) (1 children)

I hate that schools basically teach students to over use classes for everything especially by using Java as a teaching language and then they get into the real world or grad school and we have to unteach them those terrible habits.

I'm so glad a lot of the newer languages (Rust, Go, Zig, C3, V) don't have classes in them at all.

[–] [email protected] 9 points 16 hours ago (1 children)

Tbh if the average grad school student overused object oriented stuff they would produce vastly better code than the status quo.

[–] [email protected] 3 points 5 hours ago

I strongly disagree.

[–] [email protected] 6 points 23 hours ago (1 children)

I'm currently taking the very last CS class my major requires. I can't wait to leave OOP behind and focus on hardware completely.

[–] [email protected] 2 points 14 hours ago (1 children)

where do you plan to go to start that off after school?

[–] [email protected] 1 points 2 hours ago

Either microcontrollers, operating systems, or something else involving RISC-V. That's still a ways off though.

[–] [email protected] 9 points 1 day ago

Strings are Objects, Doubles are Objects (that are than unboxed into primutives doubles)...

[–] [email protected] -2 points 1 day ago* (last edited 1 day ago) (2 children)

You did the right thing. OOP was invented by people who were worried about their job security, to obstruct others from understanding their code.

[–] [email protected] 17 points 22 hours ago (2 children)

OOP is pretty readable though. What would be the alternative, functional programming with no ORM?

[–] [email protected] 1 points 8 hours ago* (last edited 8 hours ago)

Well, bad code is bad code regardless of the paradigm. I've just had bad experiences rewriting some horrible OOP codebases and opted out to use as much functional style as C# allowed me to.

The main problem, as I see it, is that OOP encourages unnecessary abstractions and inheritance. These should be used as little as possible, because they typically increase complexity and make code harder to read and untangle. As an example, I've seen people define interfaces that don't essentially define anything.

Another problem is that OOP encourages mutable member variables. It's very annoying to try to understand code where class C inherits from class B that inherits from class C. Good luck debugging when the methods of C modify a variable declared in A in subtle ways.

As an idea OOP is very appealing. When I was younger, I would be thrilled to start designing a class hierarchy and interfaces when encountering a new programming challenge. Now I just try to think how to make things as simple and modular as possible.

Edit: of course bad functional code is also bad code. It's also very annoying to try to understand code where functions pass badly named functions around as parameters and use 10 function compositions in a sequence.

[–] [email protected] 4 points 21 hours ago

Right, most things are a fine thing in moderation.

[–] [email protected] 4 points 22 hours ago (1 children)

Obfuscation Oriented Programming as I call it

[–] [email protected] 1 points 5 hours ago

Damn I'm stealing that