• alexdeathway@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 month ago

    First one are method name, second one are status name.

    
    def open_file_dialog(self):
           self.dialog_file_open = True
           pass
    
    

    Yoda level preference war.

    • Croquette@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      1 month ago

      I tend to add is to booleans toreally differentiate between a method name and a status.

      def open_file_dialog(self):
          self.dialog_file_is_open = True
          pass
      

      That way, it’s easier for my dumb brain to spot which is which at a glance.

  • redcalcium@lemmy.institute
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I’m truly torn with this. The first one seems sensible (action -> target) and easier to read and reason about (especially with long names), while the other one looks more organized, naturally sortable and works great with any autocompletion system.

  • Hazzia@discuss.tchncs.de
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    Can’t remember which is which but if it’s organized in a top-down way (broad category first) that’s just easier to look at and find stuff in the file system. I don’t want to have to actually read and mentally process the names of every single file to figure out if it’s the one I need. Sure, the “human readable” names are fine and good when you don’t have hundreds of them you’re trying to look through, but big projects I find are way easier to parse with the category naming.

  • rekabis@lemmy.ca
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    1 month ago

    There is a reason why little endian is preferred in virtually 100% of cases: sorting. Mentally or lexicographically, having the most important piece of information first will allow the correct item be found the fastest, or allow it to be discounted/ignored the quickest.

    • deadbeef79000@lemmy.nz
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 month ago

      That’s actually filtering not sorting.

      That being said, it’s more valuable (to me) to be able to find all my things for a topic quickly rather than type.

      Foo_dialog

      Foo_action

      Foo_map

      Bar_dialog

      Bar_action

      Bar_map

      Is superior IMHO.

      • rekabis@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        1 month ago

        If you are looking for Bar, it is highly likely that you are already looking specifically for a particular functionality - say, the action - for Bar. As such, it is irrelevant which method you use, both will get you to the function you need.

        Conversely, while it is likely you will want to look up all items that implement a particular functionality, it is much less likely you are going to ever need a complete listing of all functionality that an item employs; you will be targeting only one functionality for that item and will have that one functionality as the primary and concrete focus. Ergo, functionality comes first, followed by what item has that functionality.

  • evatronic@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    I do one, the other senior dev does the other. We fight about it in pull requests.

    • livingcoder@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Your team needs to have a coding standards meeting where you can describe the pros and cons of each approach. You guys shouldn’t be wasting time during PR reviews on the same argument. When that happens to me, it just feels like such a waste of time.