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

Programmer Humor

32476 readers
282 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 22 comments
sorted by: hot top controversial new old
[–] LavenderDay3544@lemmy.world 26 points 2 days ago* (last edited 2 days 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@lemmy.world 8 points 1 day ago (1 children)

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

[–] LavenderDay3544@lemmy.world 5 points 1 day ago (1 children)
[–] eager_eagle@lemmy.world 1 points 18 hours ago* (last edited 18 hours ago)

I've seen plenty of grad student code, abundance of OOP concepts was never an issue. Complete lack of any structure on the other hand....

[–] HStone32@lemmy.world 9 points 2 days 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.

[–] CausticFlames@sopuli.xyz 2 points 1 day ago (1 children)

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

[–] HStone32@lemmy.world 2 points 1 day ago

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

[–] Dunstabzugshaubitze 11 points 2 days ago

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

[–] ddplf@szmer.info -5 points 2 days ago (1 children)

Good, OOP can suck my balls

[–] vext01@lemmy.sdf.org 10 points 2 days ago (2 children)

Balls.suck() is the correct syntax.

[–] luciferofastora@lemmy.zip 2 points 1 day ago

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

[–] RagingToad@feddit.nl 3 points 2 days ago (2 children)

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

[–] xigoi@lemmy.sdf.org 8 points 1 day ago* (last edited 1 day ago) (1 children)
BallsFactory ballsFactory = new BallsFactory();
ballsFactory.setSuckable(true);
Balls balls = ballsFactory.create();
[–] whats_all_this_then@lemmy.world 8 points 1 day ago* (last edited 1 day 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();

Python port:

from ballsucker import suck
suck()
[–] vext01@lemmy.sdf.org 3 points 2 days ago

Or I didn't using the correct naming convention!