Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Programming Convention Survey of the day

Programming Convention Survey of the day

Scheduled Pinned Locked Moved The Lounge
questioncsharpasp-netcomdata-structures
62 Posts 47 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rama Krishna Vavilala

    I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

    Co-Author ASP.NET AJAX in Action

    W Offline
    W Offline
    W Balboos GHB
    wrote on last edited by
    #48

    I prefer (1) as it is intuitive. On the other hand, before I even learned C I learned some Assembly - and got rather used to the target, source order. It was kept constant, and thus did not boggle the mind with inconsistencies. Not so fast: However, (2) has the following going for it: The best way would be to handle this by keeping the setup consistant within a given family of functions (methods, or whatever). Often this means putting the target first, and than various arguement sets would follow (called overloading these days). I do tend to like this consistency of form that target, params allows.

    "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

    1 Reply Last reply
    0
    • R Rama Krishna Vavilala

      I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

      Co-Author ASP.NET AJAX in Action

      M Offline
      M Offline
      M i s t e r L i s t e r
      wrote on last edited by
      #49

      CopyObjectArrayToRecord( array, record )

      M 1 Reply Last reply
      0
      • M M i s t e r L i s t e r

        CopyObjectArrayToRecord( array, record )

        M Offline
        M Offline
        M i s t e r L i s t e r
        wrote on last edited by
        #50

        in addition, when using COM for IDispatch programming, the last parameter is usually used as the return value... so your convention follows a common practice.

        1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

          Co-Author ASP.NET AJAX in Action

          P Offline
          P Offline
          pgorbas
          wrote on last edited by
          #51

          The obvious order to me is the order in which the terms are written - so number 1 - the from term Array then 2- the to term records. If someone wanted it the other way they should name the method CopyRecordFromObjectArray.

          1 Reply Last reply
          0
          • P Phil Martin

            WEllllll, for a modern language, I would expect CopyObjectArrayToRecord(object[], record) But, if I were in C (and not C++), I would fully expect it to be CopyObjectArrayToRecord(record*, object*), or more likely objrecncpy :) - Phil

            D Offline
            D Offline
            deltalmg
            wrote on last edited by
            #52

            All programming languages are "modern", we aren't talking about ancient arimaic or something :) int IfItAnitBroke(void[] *, void[] *) // todo make obscure as hell so nobody copies my idea

            1 Reply Last reply
            0
            • R Rama Krishna Vavilala

              I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

              Co-Author ASP.NET AJAX in Action

              J Offline
              J Offline
              Jasmine2501
              wrote on last edited by
              #53

              1 makes the most sense, but the thing is written wrong in the first place. It should be: Array.CopyTo(Record r) and/or: Record.CopyFrom(Array a)

              "Quality Software since 1983!"
              http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.

              1 Reply Last reply
              0
              • R Rama Krishna Vavilala

                I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                Co-Author ASP.NET AJAX in Action

                O Offline
                O Offline
                Owen37
                wrote on last edited by
                #54

                Ahhh, the little-endian/big-endian question again. Doesn't really matter what the order is. However, your department should pick one -endian naming convention and stick to it. Cheers, Owen

                1 Reply Last reply
                0
                • R Rama Krishna Vavilala

                  I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                  Co-Author ASP.NET AJAX in Action

                  D Offline
                  D Offline
                  Dwayne J Baldwin
                  wrote on last edited by
                  #55

                  I expect #1. What makes most sense is to never allow a developer to make this decision in the first place. Class Record Copy(array) Parameter lists are evil, period.

                  Dwayne J. Baldwin

                  1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                    Co-Author ASP.NET AJAX in Action

                    Y Offline
                    Y Offline
                    Yortw
                    wrote on last edited by
                    #56

                    1. array, record ... dunno why but I always expect source before destination.

                    1 Reply Last reply
                    0
                    • R Rama Krishna Vavilala

                      I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                      Co-Author ASP.NET AJAX in Action

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #57

                      #1--What did I when? And are ya ever gonna tell us your point?

                      ____________________________________________________________________________ "Space is big. You just won't believe how vastly, hugely, mind- bogglingly big it is. I mean, you may think it's a long way down the road to the chemist's, but that's just peanuts to space." -- Douglas Adams -- Shohom67

                      1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                        Co-Author ASP.NET AJAX in Action

                        P Offline
                        P Offline
                        Paolo Pagano
                        wrote on last edited by
                        #58

                        What about make the whole signature (parameters names too) tell about semantic? CopyTo( Object[] source, Record destination ) This can be lighter to use: array.CopyTo( record ) my fear is that people tend abuse naming, I saw around names like: CopyFirstObjectArrayParameterToSecondRecordParameter :wtf:

                        pp

                        1 Reply Last reply
                        0
                        • R Rama Krishna Vavilala

                          I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                          Co-Author ASP.NET AJAX in Action

                          S Offline
                          S Offline
                          steve teng
                          wrote on last edited by
                          #59

                          why isn't 2? I like 2!;P

                          1 Reply Last reply
                          0
                          • R Rama Krishna Vavilala

                            I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                            Co-Author ASP.NET AJAX in Action

                            R Offline
                            R Offline
                            Rick Shaub
                            wrote on last edited by
                            #60

                            As long as the types are different and the parameter names are sufficiently descriptive, I don't think it matters.

                            1 Reply Last reply
                            0
                            • R Rama Krishna Vavilala

                              I want to know what makes most sense for developers: Before you arm yourself and point it to be a programming question let me say that this is not a programming question. I have a function named CopyObjectArrayToRecord, it takes two parameters: an object array and a record. Just based on the name what do you expect the order of parameters to be: 1. array, record 2. record, array

                              Co-Author ASP.NET AJAX in Action

                              A Offline
                              A Offline
                              Abdellatif_El_Khlifi
                              wrote on last edited by
                              #61

                              1 is more logical ;)

                              1 Reply Last reply
                              0
                              • I idontbelivethateverynameiwantistaken

                                True that.

                                Zakk Of all Trades

                                D Offline
                                D Offline
                                destynova
                                wrote on last edited by
                                #62

                                It's "believe", not "belive". Your name is massive AND a typo!

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups