Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
gandalf_der_12te ( gandalf_der_12te@discuss.tchncs.de )  to Programmer Humor@programming.dev · 2 years ago

new preference war just dropped

i.redd.it

message-square
43
link
fedilink
423

new preference war just dropped

i.redd.it

gandalf_der_12te ( gandalf_der_12te@discuss.tchncs.de )  to Programmer Humor@programming.dev · 2 years ago
message-square
43
link
fedilink

geteilt von: https://lemmit.online/post/3018791

This is an automated archive made by the Lemmit Bot.

The original was posted on /r/ProgrammerHumor by /u/polytopelover on 2024-05-26 21:23:20+00:00.

alert-triangle
You must log in or register to comment.
  • alexdeathway ( alexdeathway@programming.dev ) 
    link
    fedilink
    arrow-up
    115
    ·
    edit-2
    2 years 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.

    • crispy_kilt ( crispy_kilt@feddit.de ) 
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      Lol mutable state

  • rekabis ( rekabis@lemmy.ca ) 
    link
    fedilink
    arrow-up
    48
    ·
    2 years 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 ( deadbeef79000@lemmy.nz ) 
      link
      fedilink
      arrow-up
      12
      ·
      edit-2
      2 years 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 ( rekabis@lemmy.ca ) 
        link
        fedilink
        arrow-up
        6
        ·
        2 years 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 ( deadbeef79000@lemmy.nz ) 
          link
          fedilink
          arrow-up
          2
          ·
          2 years 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.

      • redfellow ( red@sopuli.xyz ) 
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        I put all those in different files

        compont/functions/foo.ext etc.

        • deadbeef79000 ( deadbeef79000@lemmy.nz ) 
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

          Depends on the language’s constraints, but yes: more smaller files please!

  • morrowind ( morrowind@lemmy.ml ) 
    link
    fedilink
    arrow-up
    43
    ·
    2 years ago

    Where’s file_dialogue_open

    • verstra ( verstra@programming.dev ) 
      link
      fedilink
      arrow-up
      19
      ·
      2 years 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

    • janAkali ( janAkali@lemmy.one ) 
      link
      fedilink
      English
      arrow-up
      8
      ·
      2 years ago

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

    • xmunk ( xmunk@sh.itjust.works ) 
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      We’re all trying our best to ignore the Americans and you bring up m/d/y… why!

  • redcalcium ( redcalcium@lemmy.institute ) 
    link
    fedilink
    arrow-up
    40
    ·
    2 years 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.

    • And009 ( And009@lemmynsfw.com ) 
      link
      fedilink
      English
      arrow-up
      14
      ·
      2 years ago

      Not a programmer, but I’d prefer right naming convention because sorting

      • Lightfire228 ( Lightfire228@pawb.social ) 
        link
        fedilink
        arrow-up
        11
        ·
        2 years ago

        I am a programmer, and i also like the naming scheme on the right

        Especially for things like filenames

        • bitwolf ( bitwolf@lemmy.one ) 
          link
          fedilink
          arrow-up
          7
          ·
          2 years ago

          Also a programmer and think method names would be conducive using little endian.

          TopicGet()
          TopicCreate()
          TopicDelete()
          

          Writing this I realize we do this implicitly in some instances.

          http.Get() -> httpGet()
          http.Post() -> httpPost()
          
    • kunaltyagi ( kunaltyagi@programming.dev ) 
      link
      fedilink
      arrow-up
      10
      ·
      2 years ago

      We need a new framework, one that allows universal lookup, and makes life easier

      x = _.dialog.file.open
      y = _.open.file.dialog
      z = _.file.open.dialog
      a = _.file.dialog.open
      

      Once done, the formatter simply changes everything to _.open.file.dialog

      Let’s get this done JS peeps

      \s

  • evatronic ( evatronic@lemm.ee ) 
    link
    fedilink
    English
    arrow-up
    27
    ·
    2 years ago

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

    • livingcoder ( livingcoder@programming.dev ) 
      link
      fedilink
      arrow-up
      24
      ·
      2 years 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 ( evatronic@lemm.ee ) 
        link
        fedilink
        English
        arrow-up
        13
        ·
        2 years 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.

  • Hazzia ( Hazzia@discuss.tchncs.de ) deleted by creator
    link
    fedilink
    arrow-up
    16
    ·
    edit-2
    2 years ago

    deleted by creator

  • onlinepersona ( onlinepersona@programming.dev ) 
    link
    fedilink
    English
    arrow-up
    14
    ·
    2 years ago

    I used to like the action followed by direct object format, until some time ago when trying to find methods or variables related to a specific object. If the action comes first, scanning for the object without an IDE means first reading unnecessary information about the action. That convinced me to opt for $object-$action in situations where it makes sense.

    For example in CSS, I often scan for the element, then the action, so $element-$action makes more sense. BEM kinda follows this. When dealing with the DOM in JS, that makes sense too button.fileDialogOpen(), button.fileDialogSend(), … makes more sense when searching.

    Of course one has to use it sensibly and where necessary. If you are writing a code that focuses more on actions than objects, putting the action first makes sense.

    A similar thing is definition order.

    def main(args):
      result = do_something(args.input)
      processed = process_result(result)
      transformed = transform_object(processed)
      return transformed.field
    
    def do_something(some_input):
      ...
    
    def process_result(result):
      ...
    
    def transform_object(obj):
      ...
    

    I find this much easier to follow than if main were defined last, because main is obviously the most important method and everything else is used by it. A flattened dependency tree is how these definitions make sense to me or how I would read them as newbie to a codebase.

    Anti Commercial-AI license

    • gandalf_der_12te ( gandalf_der_12te@discuss.tchncs.de ) OP
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      I agree with you especially on the definition order of functions. I, too, define main() first.

  • katy ✨ ( cupcakezealot@lemmy.blahaj.zone ) 
    link
    fedilink
    arrow-up
    13
    ·
    2 years ago

    the people who chose the first one…who hurt you?

    • MechanicalJester ( MechanicalJester@lemm.ee ) 
      link
      fedilink
      arrow-up
      9
      ·
      2 years ago

      No one, it just makes sense.

      You must be one of those “Throw your mother downstairs, the box of tissues” types.

      Yoda sounded normal to you I bet.

      • LoudWaterHombre ( loudWaterEnjoyer@lemmy.dbzer0.com ) 
        link
        fedilink
        arrow-up
        8
        ·
        2 years ago

        It makes sense until you write 30 methods to manipulate the data layer.

        • Lifter ( Lifter@discuss.tchncs.de ) 
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

          Fuzzy search solves this pretty good

      • Swedneck ( Swedneck@discuss.tchncs.de ) 
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        reverse polish notation time

    • lightnsfw ( lightnsfw@reddthat.com ) 
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Powershell

  • crispy_kilt ( crispy_kilt@feddit.de ) 
    link
    fedilink
    arrow-up
    13
    ·
    2 years ago

    First of all, it’s spelled dialogue

    • Sotuanduso ( Sotuanduso@lemm.ee ) 
      link
      fedilink
      English
      arrow-up
      10
      ·
      2 years ago

      Two wars can exist simultaneously.

  • roon ( roon@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    12
    ·
    2 years ago

    Powershell has a lint warning for functions that don’t follow Verb-Noun format, and verbs here are a list of approved verbs lol

  • jarfil ( jarfil@beehaw.org ) 
    link
    fedilink
    arrow-up
    12
    ·
    2 years ago

    Both:

    dialog_error = Dialog_plain.create_modal(error_text)
    

    Variable and class names go from more general to more particular, functions begin with a verb.

    Global functions are either “main”, or start with one of “debug”, “todo”, or “shit”.

  • jjjalljs ( jjjalljs@ttrpg.network ) 
    link
    fedilink
    arrow-up
    12
    ·
    2 years ago

    I worked at a place where all the DB column names were like id_user, id_project. I hated it.

    • Terrasque ( theterrasque@infosec.pub ) 
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      I worked on one where the columns were datanasename_tablename_column

      They said it makes things “less confusing”

  • Fish [Indiana] ( Fish@midwest.social ) 
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 years ago

    Variety is the spice of life.

  • todd_bonzalez ( todd_bonzalez@lemm.ee ) deleted by creator
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    2 years ago

    deleted by creator

  • Matty_r ( Matty_r@programming.dev ) 
    link
    fedilink
    arrow-up
    8
    ·
    2 years 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 ( locuester@lemmy.zip ) 
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

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

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.09K users / day
  • 1.47K users / week
  • 5.12K users / month
  • 8.17K users / 6 months
  • 464 local subscribers
  • 34K subscribers
  • 1.64K Posts
  • 27K Comments
  • Modlog
  • mods:
  • Feyter ( Feyter@programming.dev ) 
  • adr1an ( anzo@programming.dev ) 
  • BurningTurtle ( BurningTurtle@programming.dev ) 
  • Pierre-Yves Lapersonne ( pylapp@programming.dev ) 
  • BE: 0.19.21
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code