• @LavenderDay3544
    link
    30
    edit-2
    1 month ago

    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
      link
      English
      121 month ago

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

        • Eager Eagle
          link
          English
          1
          edit-2
          29 days 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…

          • @[email protected]
            link
            fedilink
            1
            edit-2
            22 days ago

            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 and misleading arrangement of objects or functions that adds more complexity than they solve

  • @HStone32
    link
    91 month ago

    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.

      • @HStone32
        link
        330 days ago

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

        • xigoi
          link
          fedilink
          English
          7
          edit-2
          1 month ago
          BallsFactory ballsFactory = new BallsFactory();
          ballsFactory.setSuckable(true);
          Balls balls = ballsFactory.create();
          
          • @whats_all_this_then
            link
            10
            edit-2
            1 month 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();
            
  • @[email protected]
    link
    fedilink
    -8
    edit-2
    1 month ago

    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
      link
      181 month ago

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

      • @[email protected]
        link
        fedilink
        3
        edit-2
        1 month ago

        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.

        Edit: of course bad functional code is also bad code. It’s also very annoying to try to understand code where functions pass badly named functions around as parameters and use 10 function compositions in a sequence.

      • @marzhall
        link
        230 days ago

        Damn I’m stealing that