this post was submitted on 14 Nov 2024
48 points (88.7% liked)

Programmer Humor

32464 readers
139 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 16 comments
sorted by: hot top controversial new old
[–] LavenderDay3544 11 points 9 hours ago* (last edited 9 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.

[–] eager_eagle 2 points 3 hours ago

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

[–] HStone32 7 points 10 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] 1 points 1 hour ago

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

[–] [email protected] 4 points 12 hours ago* (last edited 12 hours 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.

[–] Lightor 6 points 8 hours ago (1 children)

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

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

Right, most things are a fine thing in moderation.

[–] LavenderDay3544 4 points 9 hours ago

Obfuscation Oriented Programming as I call it

[–] [email protected] 8 points 16 hours ago

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

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

Good, OOP can suck my balls

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

Balls.suck() is the correct syntax.

[–] [email protected] 3 points 9 hours ago (2 children)

Don't you need to declare new Balls() first? Or do you suck() Balls static?

[–] [email protected] 7 points 8 hours ago* (last edited 8 hours ago) (1 children)
BallsFactory ballsFactory = new BallsFactory();
ballsFactory.setSuckable(true);
Balls balls = ballsFatctory.create();
[–] whats_all_this_then 4 points 3 hours ago* (last edited 3 hours ago) (1 children)

All of this is okay, but it's not production ready. This is what real production code looks like:

SuckableFactory suckableFactory = new SuckableFactory();
Suckable balls = suckableFactory
    .setShape(SuckableShapes.round)
    .setCount(2)
    .create();

SuctionProvider mouth = SuctionProvider.getInstance();

SuckerFactory suckerFactory = new SuckerFactory();
Sucker sucker = SuckerFactory.create():

sucker.setSuctionProvider(mouth);
sucker.setSuckable(balls);
sucker.setIntensity(SuckerSuctionIntensities.medium);
sucker.suckSuckable();
[–] whats_all_this_then 6 points 3 hours ago

Python port:

from ballsucker import suck
suck()
[–] [email protected] 3 points 9 hours ago

Or I didn't using the correct naming convention!