This site is no longer active and is available for archival purposes only. Registration and login is disabled.

C++ / MFC Naming Conventions


C++ / MFC Naming Conventions

Postby Dan East » Jul 14, 2001 @ 10:05am

Last edited by Dan East on Jan 15, 2003 @ 12:33am, edited 2 times in total.
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: C++ / MFC Naming Conventions

Postby Moose or Chuck » Jul 14, 2001 @ 12:06pm

Moose or Chuck
 


Re: C++ / MFC Naming Conventions

Postby Dan East » Jul 14, 2001 @ 1:55pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: C++ / MFC Naming Conventions

Postby PDAFantast » Jul 14, 2001 @ 6:41pm

PDAFantast
 


Re: C++ / MFC Naming Conventions

Postby Moose or Chuck » Jul 15, 2001 @ 10:28am

<br>Here is the link if anyone wants to buy it, or just look at it's details. It seems like quite a nice book. It's too bad I have so much time on my hands, which everyone tries to make me use their way so I don't have any time to do what I want anymore.<br>
Moose or Chuck
 


Re: C++ / MFC Naming Conventions

Postby randall » Jul 16, 2001 @ 2:25am

I have no idea why this thread insists on being "New!"
User avatar
randall
pm Insider
 
Posts: 3426
Joined: Feb 23, 2001 @ 4:02pm
Location: Schnoogie


Re: C++ / MFC Naming Conventions

Postby Moose or Chuck » Jul 16, 2001 @ 2:32am

well its not. Boy i wish i could post html here. but that will have to wait...
Moose or Chuck
 


Re: C++ / MFC Naming Conventions

Postby Moose or Chuck » Jul 16, 2001 @ 3:04pm

Probably because i modified that last post there. I should really go in there and fix that bug, since Chris and Matt are too ignorant in the ways of Perl. But that involves work, and investigation, and reading... None of which suit me well.
Moose or Chuck
 


Re: C++ / MFC Naming Conventions

Postby RICoder » Jul 20, 2001 @ 6:42pm

Not gonna make friends today.<br><br>Dan.  Nice list, but I have a problem with<br>LPTSTR pszName;<br>TCHAR  szAddress[256];<br><br>BOTH are pointers.  I typically use sz in either case, since it is more indicative of use than datatype.<br><br>n for int....what happened the old stand-by of i?<br><br>And p for pointer is ok, but I am a bad boy from the old school who still uses lp.<br><br>m_  EVERYONE should do this...glad you said it too.<br><br>MooseMaster...the book is great.  I have a copy that I think I wore the ink off of.  ALSO GREAT BOOKS.<br><br>Anything by Knuth.<br>Writing Solid Code.<br>Code. (I forget who it is by, but it has everything about bits and bytes and switches you can imagine.  He starts out with creating a basic switch from an iron rod and some coil...heheh)
<iframe src="http://gamercard.xbox.com/RICoder.card" scrolling="no" frameBorder="0" height="140" width="204">RICoder</iframe>
User avatar
RICoder
FOX News Correspondent
 
Posts: 3948
Joined: Jul 10, 2001 @ 1:48pm
Location: the matrix has me


Re: C++ / MFC Naming Conventions

Postby Dan East » Jul 20, 2001 @ 8:00pm

Last edited by Dan East on Jan 15, 2003 @ 12:30am, edited 1 time in total.
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: C++ / MFC Naming Conventions

Postby RICoder » Jul 23, 2001 @ 12:29am

<iframe src="http://gamercard.xbox.com/RICoder.card" scrolling="no" frameBorder="0" height="140" width="204">RICoder</iframe>
User avatar
RICoder
FOX News Correspondent
 
Posts: 3948
Joined: Jul 10, 2001 @ 1:48pm
Location: the matrix has me


Postby dlshores » Jan 14, 2003 @ 11:08pm

Will program for coffee and doughnuts.
User avatar
dlshores
pm Member
 
Posts: 5
Joined: Jan 14, 2003 @ 10:56pm
Location: Houston, Texas


Postby Dan East » Jan 15, 2003 @ 12:36am

Wow, I'm surprised people are reading my posts that are 1.5 years old. :) I've updated the tags for the current php BBS software.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Kzinti » Jan 15, 2003 @ 12:40am

Hungarian notation has both advantages and disadvantages.

1) It has the general advantages of having a naming convention.
2) It serves to document types in a weakly typed language. This doesn't apply as much for C++ as it does for C.

But Hungarian has serious drawbacks:

1) Hungarian ignore the use of abstract data types as base types. Because of this, it forces programmers to worry about manual type checking instead of letting the compiler check the types more rapidly and accurately.
2) It combines data "meaning" with data "representation". This is so bad, I don't even know where to start.
3) It encourages lazy, uninformative variable names. (ie: "hWnd" vs "MainMenuWindow").

These ideas are taken directly from "Code Complete" mentioned up there, and I totally agree with the author's point of view. Hungarian simply sux. It isn't all that bad when programming in C, but it is a real problem when dealing with C++. It encourage slopiness in the architecture. If you want a good example of a crappy architecture, look no further then MFC. It's an old library that was written before C++ had a standard. I am not saying MFC wasn't good when it came out, it is simply a product of it's time.

Now prefixing all class names with "C" or even "T" or whatever is not that bad, although I prefer to start my type definitions with an uppercase letter. This way, the prefixing is not needed.

To anyone who will argue that having the type described as a prefix "pwstr" is useful because you don't have to go check the type of a variable when you use it: that's exactly why prefixes shouln't be used. To me, "playerName" is infinitely more clear then "pszname", and "pszPlayerName" is not adding anything. It even become a problem when I change my variable to a "std::string".
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby dlshores » Jan 15, 2003 @ 6:32am

Sorry, I didn't look at the date. I'm new to the board and was just reading through the posts.
Will program for coffee and doughnuts.
User avatar
dlshores
pm Member
 
Posts: 5
Joined: Jan 14, 2003 @ 10:56pm
Location: Houston, Texas


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum