68
you are viewing a single comment's thread
view the rest of the comments
[-] RagingToad@feddit.nl 4 points 2 days ago

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

[-] xigoi@lemmy.sdf.org 9 points 1 day ago* (last edited 1 day ago)
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)

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@lemmy.world 12 points 1 day ago

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!

this post was submitted on 14 Nov 2024
68 points (89.5% liked)

Programmer Humor

32476 readers
727 users here now

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

Rules:

founded 5 years ago
MODERATORS