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 1 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.
  • D Dinobot_Slag

    Is the intent here to present a hardheaded boss/co-worker with a shower of opinions supporting your own, from an independent panel of developers? I sure hope so! :laugh:

    R Offline
    R Offline
    Rama Krishna Vavilala
    wrote on last edited by
    #8

    Dinobot_Slag wrote:

    with a shower of opinions supporting your own

    Yes:)

    Co-Author ASP.NET AJAX in Action

    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
      Anthony Mushrow
      wrote on last edited by
      #9

      Id have to go with 1 as well.

      My current favourite word is: Waffle Cheese is still good though.

      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
        Miszou
        wrote on last edited by
        #10

        ObjectArray.CopyToArray( record ); ;P


        Sunrise Wallpaper Project | The StartPage Randomizer | The Windows Cheerleader

        S 1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          Dinobot_Slag wrote:

          with a shower of opinions supporting your own

          Yes:)

          Co-Author ASP.NET AJAX in Action

          T Offline
          T Offline
          Thunderbox666
          wrote on last edited by
          #11

          So which one should we be agreeing with?

          "There are three sides to every story. Yours, mine and the truth" ~ unknown

          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

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

            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

            S D N 3 Replies 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
              martin_hughes
              wrote on last edited by
              #13

              I use Intellisense, earn lots of money, sleep in a big comfy bed with my wife and don't tend to worry about these things :)

              Me: Can you see the "up" arrow? User:Errr...ummm....no. Me: Can you see an arrow that points upwards? User: Oh yes, I see it now! -Excerpt from a support call taken by me, 08/31/2007

              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

                S Offline
                S Offline
                Shog9 0
                wrote on last edited by
                #14

                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.

                Wouldn't you call it IntoRecordCopyObjectArray() then... ;P

                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?

                M 1 Reply Last reply
                0
                • M Miszou

                  ObjectArray.CopyToArray( record ); ;P


                  Sunrise Wallpaper Project | The StartPage Randomizer | The Windows Cheerleader

                  S Offline
                  S Offline
                  Shog9 0
                  wrote on last edited by
                  #15

                  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 1 Reply Last reply
                  0
                  • T Thunderbox666

                    So which one should we be agreeing with?

                    "There are three sides to every story. Yours, mine and the truth" ~ unknown

                    R Offline
                    R Offline
                    Rama Krishna Vavilala
                    wrote on last edited by
                    #16

                    1

                    Co-Author ASP.NET AJAX in Action

                    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

                      H Offline
                      H Offline
                      Hans Dietrich
                      wrote on last edited by
                      #17

                      Rama Krishna Vavilala wrote:

                      Just based on the name what do you expect the order of parameters to be

                      I wouldn't have any expectation - I would look at the definition. :) You could make a case for either one. For example, the CRT has functions

                      char *strcpy( char *strDestination, const char *strSource );

                      void *memcpy( void *dest, const void *src, size_t count );

                      while Win32 has function

                      VOID CopyMemory(PVOID Destination, CONST VOID* Source, SIZE_T Length);

                      but also has function

                      BOOL CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists);

                      I think the more important question is, what do other functions in your namespace do? It would be a source of confusion/bugs if one function did it one way, while all others did it another way.

                      Best wishes, Hans


                      [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

                      1 Reply Last reply
                      0
                      • S Shog9 0

                        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.

                        Wouldn't you call it IntoRecordCopyObjectArray() then... ;P

                        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?

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

                        Shog9 wrote:

                        Wouldn't you call it IntoRecordCopyObjectArray() then...

                        Nah. In fact, I'd just call it "Copy" and let the args tell me what its copying and from and to. Marc

                        Thyme In The Country
                        Interacx
                        My Blog

                        S 1 Reply Last reply
                        0
                        • M Marc Clifton

                          Shog9 wrote:

                          Wouldn't you call it IntoRecordCopyObjectArray() then...

                          Nah. In fact, I'd just call it "Copy" and let the args tell me what its copying and from and to. Marc

                          Thyme In The Country
                          Interacx
                          My Blog

                          S Offline
                          S Offline
                          Shog9 0
                          wrote on last edited by
                          #19

                          Marc Clifton wrote:

                          In fact, I'd just call it "Copy" and let the args tell me what its copying and from and to.

                          Yeah, that's probably the least idiotic method. So long as you don't, say, wrap your static copy method in the wrong class...

                          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?

                          1 Reply Last reply
                          0
                          • R Rama Krishna Vavilala

                            1

                            Co-Author ASP.NET AJAX in Action

                            T Offline
                            T Offline
                            Thunderbox666
                            wrote on last edited by
                            #20

                            :) good thing i said #1 then

                            "There are three sides to every story. Yours, mine and the truth" ~ unknown

                            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

                              J Offline
                              J Offline
                              Jim Crafton
                              wrote on last edited by
                              #21

                              Phil Martin... wrote:

                              I were in C (and not C++)

                              I think you mean: int obj_rec_n_cpy(void*, void*, int);

                              ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                              P 1 Reply Last reply
                              0
                              • J Janzen

                                Number one makes the most sense to me.

                                I Offline
                                I Offline
                                idontbelivethateverynameiwantistaken
                                wrote on last edited by
                                #22

                                True that.

                                Zakk Of all Trades

                                _ W D 3 Replies Last reply
                                0
                                • I idontbelivethateverynameiwantistaken

                                  True that.

                                  Zakk Of all Trades

                                  _ Offline
                                  _ Offline
                                  _Damian S_
                                  wrote on last edited by
                                  #23

                                  LMFAO... surely you could find one name that wasn't taken? How about ihavetheworldslongestscreennameanditshardtoread

                                  ------------------------------------------- Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Just bugger off and leave me alone!!

                                  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

                                    D Offline
                                    D Offline
                                    DaveX86
                                    wrote on last edited by
                                    #24

                                    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. :~

                                    R D M 3 Replies 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. :~

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

                                      David Lockwood wrote:

                                      ...it should be from left to right to keep the flow natural

                                      So I'm guessing you would prefer 3 = a over a = 3 to assign 3 to a? :)

                                      D 1 Reply Last reply
                                      0
                                      • R Robert Surtees

                                        David Lockwood wrote:

                                        ...it should be from left to right to keep the flow natural

                                        So I'm guessing you would prefer 3 = a over a = 3 to assign 3 to a? :)

                                        D Offline
                                        D Offline
                                        DaveX86
                                        wrote on last edited by
                                        #26

                                        Well..hmmm...if you put it that way If you put it more like MOV 3, a ...though, it does work better. It's not totally the same thing, a math equation and a computer instruction. maybe my brain is reversed...that's always been my problem :~

                                        1 Reply Last reply
                                        0
                                        • J Jim Crafton

                                          Phil Martin... wrote:

                                          I were in C (and not C++)

                                          I think you mean: int obj_rec_n_cpy(void*, void*, int);

                                          ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                          P Offline
                                          P Offline
                                          Phil Martin
                                          wrote on last edited by
                                          #27

                                          Nope, I don't think I meant that.

                                          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