Mine is that the useState hook is an actual plague on the entire React ecosystem. Regardless of your opinions of React, if you wanna use something then use it right.

  • jason@discuss.online
    link
    fedilink
    English
    arrow-up
    19
    arrow-down
    1
    ·
    6 hours ago

    OOP dogma isn’t just bad, it’s actively harmful. OOP leads to unnecessary boilerplate. Any boilerplate that is not absolutely necessary is noise and bad. Full stop.

    Private (Getters/setters): Strictly not a necessity in any sense of the word.

    Short functions everywhere.

    Short files everywhere.

    I prefer to see the steps of execution that are actually happening in the real world on hardware. Not an ivory tower of code that happens to execute.

    • leMe@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      2
      ·
      3 hours ago

      generally agree, probably most devs nowadays do. otherwise there wouldn’t be stuff like @data in lombok.

      i think the word ‘dogma’ is pretty good: it takes a good idea (encapsulation) too far. i am not old enough to have been coding when OOP was the new and hot stuff. but i imagine it comes from the idea that it is a good idea to protect private members where needed.

      public class Account {
        private Integer balance;
        public Integer getBalance() {
          return new Integer(balance);
        }
      }
      

      that is not such a bad idea to protect balance from stupid sideeffects.

        public String getName() {
          return name;
        }
      

      is a nothing burger, as it returns the same reference and does not protect from accidental sideeffects.