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

    K Offline
    K Offline
    Kitty234
    wrote on last edited by
    #30

    Probably based on my (disappointly-small) objective-C experience, I'd see that as being: [anObject copyObjectArray: anArray toRecord: aRecord]; otherwise knows as: anObect.copyObjectArrayToRecord(anArray, aRecord);

    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

      H Offline
      H Offline
      HuntrCkr
      wrote on last edited by
      #31

      1. is the logical answer... Why do you ask? ;P

      1 Reply Last reply
      0
      • D DaveX86

        This convention actually drives me crazy...it should be from left to right to keep the flow natural...assembly language does it like that: MOV dst, src ...no wonder nobody uses it. It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle...an unnecessary direction change. :~

        D Offline
        D Offline
        DavidNohejl
        wrote on last edited by
        #32

        David Lockwood wrote:

        It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle.

        Something like German? ;P


        [My Blog]
        "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
        "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

        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
          Duncan Edwards Jones
          wrote on last edited by
          #33

          1 is logical.

          '--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd

          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

            M Offline
            M Offline
            Maidomax
            wrote on last edited by
            #34

            No.1

            bling bling

            T 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
              Andrew Leeder
              wrote on last edited by
              #35

              2 of course because I was brought up on K&R and PDP architecture. I'm told being left handed also helps :-D ~A

              R 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
                #36

                1 since that matches the name of the function.

                Visit http://www.notreadytogiveup.com/[^] and do something special today.

                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
                  Dalek Dave
                  wrote on last edited by
                  #37

                  Logic says 1 But I would presume from your question that this may not be the case! What has logic to do with programming?

                  ------------------------------------ Happy Primes Lead to Happy Memories. Don't Google FGI

                  1 Reply Last reply
                  0
                  • D DaveX86

                    This convention actually drives me crazy...it should be from left to right to keep the flow natural...assembly language does it like that: MOV dst, src ...no wonder nobody uses it. It's like reading a sentence that you have to start at the beginning, then jump to the end and read back to the middle...an unnecessary direction change. :~

                    M Offline
                    M Offline
                    Marc Clifton
                    wrote on last edited by
                    #38

                    David Lockwood wrote:

                    assembly language does it like that:

                    Not all. One of the stark differences between the Intel processors and the Motorola processors was the src/dest order. Marc

                    Thyme In The Country
                    Interacx
                    My Blog

                    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

                      C Offline
                      C Offline
                      Carlos Mariano
                      wrote on last edited by
                      #39

                      First. It makes more sense. Carlos

                      Carlos Mariano

                      1 Reply Last reply
                      0
                      • S Shog9 0

                        Bah! Madness! record.AddCopyOfObjectArray(array)

                        every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?

                        T Offline
                        T Offline
                        thatreallybytes
                        wrote on last edited by
                        #40

                        #1 makes more sense to me, too...:cool:

                        C. Durand Sr. Programmer/Analyst

                        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
                          Mike Doyon
                          wrote on last edited by
                          #41

                          I'd say 1. Generally speaking, I'd adhere to that logic. Also, I believe that it is common in copy methods to organize parameters as (source, destination).

                          Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, burger in one hand, drink in the other, body thoroughly used up, totally worn out and screaming "WOO HOO......What a ride!"

                          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
                            Dan Neely
                            wrote on last edited by
                            #42

                            1

                            -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

                            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
                              Ponytail Bob
                              wrote on last edited by
                              #43

                              #1 seems the most logical. If you renamed it CopyToRecordFromObjectArray, then #2. Peace

                              http://bobp1339.blogspot.com/

                              1 Reply Last reply
                              0
                              • M Marc Clifton

                                Well, bucking the trend (as usual), whatever it's called, I would expect the destination (target) object to be the first parameter. So, #2! :-D [edit]And sadly, in C#, Array.Copy takes the source array as the first parameter. Which leads me to end of teeth gnashing because I liked the platform SDK's consistency of having the destination as the first parameter, such as in the BitBlt function or, in the C/C++ language, another example is the memcpy function. So, here's another perfect example of how the designers of C# BLEW IT!!![/edit] Marc

                                Thyme In The Country
                                Interacx
                                My Blog

                                N Offline
                                N Offline
                                Nish Nishant
                                wrote on last edited by
                                #44

                                Marc Clifton wrote:

                                Well, bucking the trend (as usual), whatever it's called, I would expect the destination (target) object to be the first parameter. So, #2!

                                That's my instinctive reaction too. We've mentally been so used to the destinatioin being the left argument. MOV ax, 9 strcpy(dest,"...") But one subtle difference in Rama's function name is that, it goes slike this :- CopyXtoY(X src_x , Y dest_y) : so here the order actually makes sense . Buthad it been Copy(Y dest_y, X src_x) : then this makes better sense.

                                Regards, Nish


                                Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                                My latest book : C++/CLI in Action / Amazon.com link

                                1 Reply Last reply
                                0
                                • M Maidomax

                                  No.1

                                  bling bling

                                  T Offline
                                  T Offline
                                  Tarisai
                                  wrote on last edited by
                                  #45

                                  True true, true Numero un makes more sense

                                  1 Reply Last reply
                                  0
                                  • I idontbelivethateverynameiwantistaken

                                    True that.

                                    Zakk Of all Trades

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

                                    I'm believe the name "everynameiwant" is still available.

                                    "Shoes For Industry!" - G. Tirebiter

                                    1 Reply Last reply
                                    0
                                    • A Andrew Leeder

                                      2 of course because I was brought up on K&R and PDP architecture. I'm told being left handed also helps :-D ~A

                                      R Offline
                                      R Offline
                                      Robert Surtees
                                      wrote on last edited by
                                      #47

                                      PIP for the win!

                                      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

                                        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
                                          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