Best practices question: Do you use the this keyword when using instance members in a method?
-
Gizzo wrote:
What's wrong with it?
it's not cool any more. the smart people have decreed that we all need to use a different kind of notation now. Cleek | Image Toolkits | Thumbnail maker
-
Gizzo wrote:
What's wrong with it?
It spent too long as a fad, which means lots of people think they know how to use it while in reality having no clue, most of them not even grasping the problem it was intended to solve. Sorta like "object-oriented programming"...
---- Scripts i've known... CPhog 0.9.9 - make CP better. Forum Bookmark 0.2.1 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums
-
Colin Angus Mackay wrote:
You still use that!
what? the hungarian notation or this keyword? I use the hungarian notation. What's wrong with it? We have to use one, anyway.
Its crap. The hungarian notatin is a pile of shit that make windows documentation a joke. eg from MSDN: LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window WM_COMMAND, // the message to send WPARAM wParam, // notification code and identifier LPARAM lParam // handle to control (HWND) ); why? it is 32 bit. Why not dwParam. etc etc etc. Hungarian notation is an unmaintainable pile of crap. Nunc est bibendum
-
Its crap. The hungarian notatin is a pile of shit that make windows documentation a joke. eg from MSDN: LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window WM_COMMAND, // the message to send WPARAM wParam, // notification code and identifier LPARAM lParam // handle to control (HWND) ); why? it is 32 bit. Why not dwParam. etc etc etc. Hungarian notation is an unmaintainable pile of crap. Nunc est bibendum
-
But do you agree with me that is necesary to use some kind of notation? Overall if you are working in a team. When I have to revise some old code I feel lost trying to guest the types and everything...Imagine you wouldn't have Intellisense...
No, I dont. My notation differentiates between pointers, non pointers, and between global, local and member variables. p for pointer, g for global, m for member and that is it. Any distinction between data types is in the naming, so, for example, I might use NumberOfBytesWritten++; If it aint big enough I will make it unsigned, 32 but, etc. If I am using a string or an array, I will like wies use a meaningful name. BTW, if variable names are full descriptive names (and the same for functions too) then code commenting is less important. And I have had my code maintained very effectively by other coder who find it very easy to follow and read. Nunc est bibendum
-
No, I dont. My notation differentiates between pointers, non pointers, and between global, local and member variables. p for pointer, g for global, m for member and that is it. Any distinction between data types is in the naming, so, for example, I might use NumberOfBytesWritten++; If it aint big enough I will make it unsigned, 32 but, etc. If I am using a string or an array, I will like wies use a meaningful name. BTW, if variable names are full descriptive names (and the same for functions too) then code commenting is less important. And I have had my code maintained very effectively by other coder who find it very easy to follow and read. Nunc est bibendum
-
fat_boy wrote:
My notation differentiates between pointers, non pointers, and between global, local and member variables.p for pointer, g for global, m for member and that is it.
:doh: That's a notation itself. And it's derived from hungarian... I think.
-
doh: WTF? what is doh about it? I didnt say I dont use any notation, I just dont use the hungarian notation because it is crap. For the afore mentioned rasons. Nunc est bibendum
Gizzo: "But do you agree with me that is necesary to use some kind of notation? " fat_boy wrote: "No, I don't. My notation differentiates between pointers, non pointers, and between global, local and member variables. p for pointer, g for global, m for member and that is it." Forgive the doh: icon. I just wanted to point that your answer seemed to me a little bit contradictoriuos. Nothing more.
-
Gizzo: "But do you agree with me that is necesary to use some kind of notation? " fat_boy wrote: "No, I don't. My notation differentiates between pointers, non pointers, and between global, local and member variables. p for pointer, g for global, m for member and that is it." Forgive the doh: icon. I just wanted to point that your answer seemed to me a little bit contradictoriuos. Nothing more.
OK, fair point. The use of m gets forced on you by the MFC wizard, other than that I wouldnt use it. My only regularly notation is for pointers really. I find it helps building up casts such as:
*((PULONG)Irp->AssociatedIrp.SystemBuffer) = pAdapter->AutoConnect; *( ((PULONG)Irp->AssociatedIrp.SystemBuffer) + 1) = pAdapter->WaitForDCDgoing1;
Nunc est bibendum -
Chris Losinger wrote:
the smart people have decreed that we all need to use a different kind of notation now.
the smart people? and what did they decide it's better? I'm not been ironic, i just want to know.
Gizzo wrote:
the smart people?