Programming Convention Survey of the day
-
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, arrayCo-Author ASP.NET AJAX in Action
-
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, arrayCo-Author ASP.NET AJAX in Action
#1 seems most logical
"There are three sides to every story. Yours, mine and the truth" ~ unknown
-
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, arrayCo-Author ASP.NET AJAX in Action
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
-
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, arrayCo-Author ASP.NET AJAX in Action
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:
-
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:
Dinobot_Slag wrote:
with a shower of opinions supporting your own
Yes:)
Co-Author ASP.NET AJAX in Action
-
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, arrayCo-Author ASP.NET AJAX in Action
Id have to go with 1 as well.
My current favourite word is: Waffle Cheese is still good though.
-
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, arrayCo-Author ASP.NET AJAX in Action
ObjectArray.CopyToArray( record );
;P
Sunrise Wallpaper Project | The StartPage Randomizer | The Windows Cheerleader
-
Dinobot_Slag wrote:
with a shower of opinions supporting your own
Yes:)
Co-Author ASP.NET AJAX in Action
So which one should we be agreeing with?
"There are three sides to every story. Yours, mine and the truth" ~ unknown
-
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, arrayCo-Author ASP.NET AJAX in Action
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
-
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, arrayCo-Author ASP.NET AJAX in Action
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
-
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
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... ;Pevery 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?
-
ObjectArray.CopyToArray( record );
;P
Sunrise Wallpaper Project | The StartPage Randomizer | The Windows Cheerleader
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?
-
So which one should we be agreeing with?
"There are three sides to every story. Yours, mine and the truth" ~ unknown
1
Co-Author ASP.NET AJAX in Action
-
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, arrayCo-Author ASP.NET AJAX in Action
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]
-
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... ;Pevery 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?
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
-
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
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
Co-Author ASP.NET AJAX in Action
:) good thing i said #1 then
"There are three sides to every story. Yours, mine and the truth" ~ unknown
-
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
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
-
True that.
Zakk Of all Trades
-
True that.
Zakk Of all Trades
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!!