• rekabis@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    6 months 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
      0
      ·
      6 months ago

      That’s actually filtering not sorting.

      Tha 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
        0
        ·
        6 months 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.

        • deadbeef79000@lemmy.nz
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          6 months ago

          We probably have slightly different work processes.

          I’m more likely to be making “foo” functionally complete and then making “bar” complete than I am to be making all my dialogs functional then all my tabs/whatever.

          This comes from TDD where I’m making a test pass for “foo”, once done, I’ll do the same for “bar”.

          Though it’s even more likely these are different files entirely, rendering the arguments moot.

    • Static_Rocket@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      6 months ago

      But also, sorting big endian automatically groups elements associated with common functions making search, completions, and snippets easier (if you use them). I’m torn

    • 33550336@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      I was going to write something like this. You actually wrote about semantic order, but syntactically it is as much important e.g. it is easier to sort dates such as 2024-05-27 than 27.05.2024 in chronological order.

  • evatronic@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    6 months 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
      0
      ·
      6 months 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.

      • evatronic@lemm.ee
        link
        fedilink
        English
        arrow-up
        0
        ·
        6 months ago

        Preachin to the choir, friend. I’d get worked up about it but I’m paid the same regardless of how upset I get.

        • locuester@lemmy.zip
          link
          fedilink
          English
          arrow-up
          0
          ·
          6 months ago

          Agreed. This type of fun is good for the team. Trying to stamp it out, when it impacts very little, is just a buzzkill to the team.

  • Zangoose@lemmy.one
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    6 months ago

    I know I’m late to this but here’s my (probably insane?) take. We use Subject-Verb-Object in English right? So, hear me out:

    dialog_create_tab(...)
    dialog_open_file(...)
    dialog_close_file(...)
    
    • Croquette@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      6 months 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.

          • sus@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            edit-2
            6 months ago

            that works for 2 word names eg is_open or is_file, but in this case is_dialog_file_open is structured like a question, while dialog_file_is_open is structured like a statement

            • redfellow@sopuli.xyz
              link
              fedilink
              arrow-up
              0
              ·
              6 months ago

              It still works. is_this_thing_some_thingy. Is is just a prefix for if the suffix returns true/false.

            • Rinox@feddit.it
              link
              fedilink
              arrow-up
              0
              ·
              6 months ago

              Doesn’t matter, the point is that, if it starts with “is” then you automatically know it’s a boolean.

      • 4wd@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        6 months ago

        In Elixir, we mark statuses by using a question mark at the end of the variable name. Something like this:

        authorized? = user |> get_something() |> ensure_authorized?()
        

        I like this better than the is_ prefix

          • Faresh@lemmy.ml
            link
            fedilink
            English
            arrow-up
            0
            ·
            6 months ago

            If it’s like Lisp, then ? is just part of the symbol and doesn’t have any special syntatic meaning. In different Lisps it’s also convention to end predicate names with a ? or with P (p for predicate)

          • FMT99@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            6 months ago

            We do this in Ruby all the time, we just prefer methods over variables, usually.

            def authorized?
              current_user&.authorized?
            end
            
            • cytokine0724@sh.itjust.works
              link
              fedilink
              arrow-up
              0
              ·
              6 months ago

              I’m a principal backend engineer routinely writing Ruby for my day job, so I’m familiar, lol. But you can’t do it for local variables and that just sucks. Definitely a +1 for Elixir.

  • Matty_r@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    6 months ago

    The object/class/thing would normally be its own class file, the action would be a method/function of said class.

    Ie:

    fileDialog.open()

    fileDialog = Class (Dialog), Subclass (FileDialog)

    • locuester@lemmy.zip
      link
      fedilink
      English
      arrow-up
      0
      ·
      6 months ago

      It’s referring to variable names. For example, you have a variable named fileDialog. I would prefer to have that named dialogFile.

    • verstra@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      6 months ago

      This is the real big-endian way. So your things line-up when you have all of these:

      file_dialogue_open
      file_dialogue_close
      file_dropdown_open
      file_rename
      directory_remove
      

      If I were designing a natural language, I’d put adjectives after the nouns, so you start with the important things first:

      car big red

      instead of

      big red car

      • dohpaz42@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        6 months ago

        Heathen! You must alphabetize all the things!

        Like seriously. It makes scanning code much easier.

      • funkless_eck@sh.itjust.works
        link
        fedilink
        arrow-up
        0
        ·
        6 months ago

        If I were designing a natural language, I’d put adjectives after the nouns, so you start with the important things first

        So - French?

        • lunarul@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          6 months ago

          The thing is that in French, Spanish, etc. it still makes sense if you put the adjective before the noun, even if it might sound weird in some cases. An adjective is an adjective and a noun is a noun.

          But English is positional. Where you put a word gives it its function. So “red car” and “car red” mean different things.

          • deadbeef79000@lemmy.nz
            link
            fedilink
            arrow-up
            0
            ·
            edit-2
            6 months ago

            That’s because they are romance languages. They come from Latin where word order is irrelevant as each “word” has a different form for the specific use.

            • lunarul@lemmy.world
              link
              fedilink
              arrow-up
              0
              ·
              6 months ago

              Yes, that’s what I said. My native language is a romance language too. And after speaking it her whole life, my wife has trouble getting the grasp of how in English swapping two words completely changes the meaning of what she’s saying (especially when it’s two nouns, like e.g. “parent council”)

    • janAkali@lemmy.one
      link
      fedilink
      English
      arrow-up
      0
      ·
      6 months ago

      To be fair, it’s also missing open_dialog_file, dialog_open_file and most crucially file_open_dialog

  • Goodie@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    Whatever is more useful goes first.

    For example, if this we’re a list of UI text strings, finding all of the dialogue options together might be useful.

    If, instead, this is a series of variables already around one dialogue, then finding the open or close bits together would be useful.

        • stufkes@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          6 months ago

          Dialogue is UK English. But I just looked it up and apparently ‘dialog’ is a computer term, but should not be used on its own but rather in combination, such as ‘dialog box’.

          • smeg@feddit.uk
            link
            fedilink
            English
            arrow-up
            0
            ·
            6 months ago

            Americans sadly got there first and defined all the computer terms, that’s why it’s a TV programme but a computer program. I can deal with that though, helps distinguish computer things from real things!

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    I don’t know and that’s the problem :(

    I keep asking myself what to choose, only for changing it a day after cursing myself to choose a stupid name.

    Big endiant is great for intellisense to quickly browse possibilities, since it groups it all in the same place. But that’s also a detriment when you know what you want. You can start typing without the prefix but you’ll have to go through the better suggestions of intellisense first.

    Little endiant is the same thing, but in reverse. Great when needed, but bad for browsing.

    Although I do have some fix I’m starting to use. But it’s not applicable everywhere, and not in every language.

    What I do is use module as prefix. Instead of dialogue_file_open, I create a file_open in the dialogue module, allowing either directly calling file_open, or dialogue::file_open. Using intellisense on the module allow for easy browsing too!

    Although in OP’s post I’d rather have file_open_dialogue as it convey the more significant meaning, being to open a file, first. Then “dialogue” is just the flavour on top