this post was submitted on 14 Nov 2024
52 points (89.4% liked)

Programmer Humor

32464 readers
355 users here now

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

Rules:

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

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

[–] [email protected] 3 points 14 hours ago* (last edited 14 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 8 points 11 hours ago (1 children)

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

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

Right, most things are a fine thing in moderation.

[–] LavenderDay3544 4 points 11 hours ago

Obfuscation Oriented Programming as I call it

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

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

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

Good, OOP can suck my balls

[–] [email protected] 6 points 12 hours ago (2 children)

Balls.suck() is the correct syntax.

[–] [email protected] 1 points 21 minutes ago

Actually, it would be OOP.suck(ddplf.getBalls())

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

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

[–] [email protected] 7 points 10 hours ago* (last edited 10 hours ago) (1 children)
BallsFactory ballsFactory = new BallsFactory();
ballsFactory.setSuckable(true);
Balls balls = ballsFatctory.create();
[–] whats_all_this_then 5 points 6 hours ago* (last edited 5 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 7 points 5 hours ago

Python port:

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

Or I didn't using the correct naming convention!