Ancestors

Toot

Written by Hellfire103 on 2024-11-14 at 10:12

TIFU by not using objects in my object-oriented programming coursework

https://lemmy.ca/post/32965379

=> View attached media

=> More informations about this toot | More toots from hellfire103@lemmy.ca

Descendants

Written by Dunstabzugshaubitze@feddit.org on 2024-11-14 at 11:28

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

=> More informations about this toot | More toots from Dunstabzugshaubitze@feddit.org

Written by ddplf@szmer.info on 2024-11-14 at 14:49

Good, OOP can suck my balls

=> More informations about this toot | More toots from ddplf@szmer.info

Written by vext01@lemmy.sdf.org on 2024-11-14 at 18:32

Balls.suck() is the correct syntax.

=> More informations about this toot | More toots from vext01@lemmy.sdf.org

Written by RagingToad@feddit.nl on 2024-11-14 at 18:37

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

=> More informations about this toot | More toots from RagingToad@feddit.nl

Written by vext01@lemmy.sdf.org on 2024-11-14 at 18:41

Or I didn’t using the correct naming convention!

=> More informations about this toot | More toots from vext01@lemmy.sdf.org

Written by xigoi on 2024-11-14 at 19:38

ballsFactory.setSuckable(true);

Balls balls = ballsFatctory.create();

=> More informations about this toot | More toots from xigoi@lemmy.sdf.org

Written by whats_all_this_then@lemmy.world on 2024-11-15 at 00:35

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 suctionProvider = SuctionProvider.getIstance();


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


sucker.setSuctionProvider(suctionProvider);
sucker.setSuckable(balls);
sucker.setIntensity(SuckerSuctionIntensities.medium);
sucker.suckSuckable();

=> More informations about this toot | More toots from whats_all_this_then@lemmy.world

Written by whats_all_this_then@lemmy.world on 2024-11-15 at 00:40

Python port:

suck()

=> More informations about this toot | More toots from whats_all_this_then@lemmy.world

Written by luciferofastora@lemmy.zip on 2024-11-15 at 06:16

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

=> More informations about this toot | More toots from luciferofastora@lemmy.zip

Written by tyo_ukko@sopuli.xyz on 2024-11-14 at 15:41

You did the right thing. OOP was invented by people who were worried about their job security to obstruct others from understanding their code.

=> More informations about this toot | More toots from tyo_ukko@sopuli.xyz

Written by LavenderDay3544@lemmy.world on 2024-11-14 at 18:40

Obfuscation Oriented Programming as I call it

=> More informations about this toot | More toots from LavenderDay3544@lemmy.world

Written by marzhall@lemmy.world on 2024-11-15 at 12:06

Damn I’m stealing that

=> More informations about this toot | More toots from marzhall@lemmy.world

Written by Lightor on 2024-11-14 at 19:18

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

=> More informations about this toot | More toots from Lightor@lemmy.world

Written by electricprism@lemmy.ml on 2024-11-14 at 20:06

Right, most things are a fine thing in moderation.

=> More informations about this toot | More toots from electricprism@lemmy.ml

Written by tyo_ukko@sopuli.xyz on 2024-11-15 at 09:14

Well, bad code is bad code regardless of the paradigm. I’ve just had bad experiences rewriting some horrible OOP codebases and opted out to use as much functional style as C# allowed me to.

The main problem, as I see it, is that OOP encourages unnecessary abstractions and inheritance. These should be used as little as possible, because they typically increase complexity and make code harder to read and untangle. As an example, I’ve seen people define interfaces that don’t essentially define anything.

Another problem is that OOP encourages mutable member variables. It’s very annoying to try to understand code where class C inherits from class B that inherits from class C. Good luck debugging when the methods of C modify a variable declared in A in subtle ways.

As an idea OOP is very appealing. When I was younger, I would be thrilled to start designing a class hierarchy and interfaces when encountering a new programming challenge. Now I just try to think how to make things as simple and modular as possible.

=> More informations about this toot | More toots from tyo_ukko@sopuli.xyz

Written by HStone32@lemmy.world on 2024-11-14 at 17:32

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.

=> More informations about this toot | More toots from HStone32@lemmy.world

Written by CausticFlames@sopuli.xyz on 2024-11-15 at 02:55

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

=> More informations about this toot | More toots from CausticFlames@sopuli.xyz

Written by HStone32@lemmy.world on 2024-11-15 at 14:44

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

=> More informations about this toot | More toots from HStone32@lemmy.world

Written by LavenderDay3544@lemmy.world on 2024-11-14 at 18:42

I hate that schools basically teach students to overuse 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.

=> More informations about this toot | More toots from LavenderDay3544@lemmy.world

Written by Eager Eagle on 2024-11-15 at 00:43

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

=> More informations about this toot | More toots from eager_eagle@lemmy.world

Written by LavenderDay3544@lemmy.world on 2024-11-15 at 11:37

I strongly disagree.

=> More informations about this toot | More toots from LavenderDay3544@lemmy.world

Written by Eager Eagle on 2024-11-16 at 00:44

I’ve seen plenty of grad student code, abundance of OOP concepts was never an issue.

=> More informations about this toot | More toots from eager_eagle@lemmy.world

Written by Chais@sh.itjust.works on 2024-11-17 at 08:57

You can’t teach experience.

=> More informations about this toot | More toots from Chais@sh.itjust.works

Written by Kache@lemm.ee on 2024-11-23 at 04:16

Bad abstraction is worse than no abstraction

If the code is going to poorly organized, I’d prefer it to just be one single gigantic standalone script than some wrong arrangement of objects that adds more complexity than it removes

=> More informations about this toot | More toots from Kache@lemm.ee

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113480772355124180
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
337.003637 milliseconds
Gemini-to-HTML Time
4.551856 milliseconds

This content has been proxied by September (3851b).