|
I was just given a project to rewrite, cleanup, and add features to. The first class I look at has these variables. It appears the original author liked to use almost every convention for naming variables, arbitrarily changing it up.
private string ip_addr = "xx.xx.xx.xx";
private int _port = 2000;
public int countQuotesReceived = 0, countQuotesCreated = 0;
public bool _connected = false;
public bool _initialized = false;
public bool BroadCast = false, ResetHighsLows = false;
public bool reconnecting = false;
modified on Monday, January 17, 2011 4:35 PM
|
|
|
|
|
Where's Hungarian?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Here it is. Note, it's on a public variable, too. I should have posted more the first time. This is a copy/paste, so this is his spacing, and his ordering of the access levels:
public DataTable dtQuotes;
private QuoteHub _QuoteHub;
private string ip_addr = "xx.xx.xx.xxx";
private int _port = 2000;
public int countQuotesReceived = 0, countQuotesCreated = 0;
public bool _connected = false;
public bool _initialized = false;
public bool BroadCast = false, ResetHighsLows = false;
public bool reconnecting = false;
modified on Monday, January 17, 2011 4:35 PM
|
|
|
|
|
So, it should be "m_dtQuotes" anyway.
Make his wages as consistent as his naming conventions. Bet he falls into line quickly.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Well, he's no longer at the company, not sure why .
I was hired to fill his position.
|
|
|
|
|
By Hungarian @OriginalGriff is looking for m_
|
|
|
|
|
|
By Hungarian I mean the type is prefixed onto the variable name as in iCount, lpszName etc. The "m_", "p_", g_" etc. metaprefix indates the scope: Member of class, function parameter, global and so on.
Once upon a time we thought this was a good idea! But then incremental compilation meant we could go back to readable, pronounceable variable names.
(I'm waiting for the next generation retrospective on naming, when we go back to a maximum of six characters, and the first character defines it as a integer if it is 'i' to 'n' so you don't even have to declare them...)
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
OriginalGriff wrote: (I'm waiting for the next generation retrospective on naming, when we go back to a maximum of six characters, and the first character defines it as a integer if it is 'i' to 'n' so you don't even have to declare them...)
Good idea. Let us know when it is released
|
|
|
|
|
Don't remind me. I was downgraded by a professor for defining variables that just happened to start with i and j. Apparently, Pascal teaches you bad habits
|
|
|
|
|
rentzk wrote: Apparently, Pascal teaches you bad habits What do variable names like i and j have to with Pascal?
/ravi
|
|
|
|
|
Nothing that I remember: 'i' through 'n' inclusive being default declaration for integer, and the six character limit were FORTRAN.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Sorry, I was in a bit of a hurry. Pascal was where I was taught to always define my variables. This was not appreciated by a very old school instructor who taught the FORTRAN class. Fortunately, the Pascal lessons stuck with me a lot better than the FORTRAN ones.
|
|
|
|
|
The m_, g_ etc. prefixes are all later inventions MS added when they started writing MFC (I guess, that's the first usage I ever came across). You don't really need them in C as the only scopes are global, file and local.
|
|
|
|
|
That's where I first met Hungarian notation.
The only problem is I still use a bastardized version of it: tb for TextBox, but for Button, dgv for DateGridView...
One day, I must try to make a clean break!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
You called?
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
No, not you - your name doesn't start with a lower case letter, and is quite pronounceable.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
His name is probably the only Hungarian name that CAN be pronounced. Man, do they know how to mess up names, or what?
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
They say variety is the spice of life
There is such a thing as taking it too far, however.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Maybe every piece of code comes from another on-line tutorial where various naming conventions were used. Better not to change anything if it works you know.
Greetings - Jacek
|
|
|
|
|
|
This Website calls for .Net hall of shame
=========[^]
sorry no code here posted.
|
|
|
|
|
"[Update: 18 November 2002: Microsoft have announced that a future version of C# will include support for anonymous methods.]"
The article must have been written against .net 1.0, when the framework was pretty immature compared to Java.
|
|
|
|
|
If c is blank do nothing, but still if c is blank, output blank array!!
Changing mind while coding!? and it is VBS
Function e1(c,outv)
ReDim outv(anc-1)
If c="" Then
Else
If c="" Then
For i=0 To ubound(outv)
outv(i)=""
Next
Else
x1=split(c,",")
For i=0 To ubound(x1)
If i<=ubound(outv) Then outv(i)=x1(i)
Next
End If
End If
End Function
|
|
|
|
|
I think examples like this provide an argument for making programming languages inherently complex - that way people would really have to learn their craft and it may weed out some of the f*wits who write this kind of drivel.
|
|
|
|