Hellfire103 to Programmer [email protected]English • 6 months agoTIFU by not using objects in my object-oriented programming courseworklemmy.caimagemessage-square24fedilinkarrow-up179cross-posted to: [email protected][email protected]
arrow-up179imageTIFU by not using objects in my object-oriented programming courseworklemmy.caHellfire103 to Programmer [email protected]English • 6 months agomessage-square24fedilinkcross-posted to: [email protected][email protected]
minus-square@[email protected]linkfedilink4•6 months agoDon’t you need to declare new Balls() first? Or do you suck() Balls static?
minus-square@[email protected]linkfedilink3•6 months agoOr I didn’t using the correct naming convention!
minus-squarexigoilinkfedilinkEnglish9•edit-26 months agoBallsFactory ballsFactory = new BallsFactory(); ballsFactory.setSuckable(true); Balls balls = ballsFactory.create();
minus-square@[email protected]linkfedilink11•edit-26 months agoAll 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();
minus-square@[email protected]linkfedilink14•6 months agoPython port: from ballsucker import suck suck()
Don’t you need to declare new Balls() first? Or do you suck() Balls static?
Or I didn’t using the correct naming convention!
All of this is okay, but it’s not production ready. This is what real production code looks like:
Python port: