|
Here's the sad part: note that much of the code crap in there is commented, "Added by ClassView ."
Code "wizards" are both a blessing and a curse: they can make life easier, but you've got to police them.
|
|
|
|
|
UltraJoe wrote:
Here's the sad part: note that much of the code crap in there is commented, "Added by ClassView."
I believe it was actually pushed down by the coder when inserting the struct definition, so it's not the class wizard to blame, or at least not entirely
UltraJoe wrote:
Code "wizards" are both a blessing and a curse: they can make life easier, but you've got to police them.
Yep. What I always hate is when some wizard tries to micro-manage code, changing the unrelated bits of code for some unknown reason. Really makes life hard if you work on the code in concurent way (like when using CVS for example).
|
|
|
|
|
I've seen this practice not so much as a "history book," but rather as a way of saying, "hey, I thought about this, but it's not ready for prime time yet, but I don't want to lose it." In other words, no, it's not part of live code, but it doesn't appear in version control, either.
|
|
|
|
|
I tend to leave commented lines until I get the code to work as I expect and until I'm pretty sure I'm not going to work on that bit of code anymore. Then I delete everything not needed.
Solid, working code should look good. I makes life easier for everyone.
Plus the execution flow should appear to you at a glance. I hate when my partners do the following:
if()
{
if()
{
if()
{
/* long code block here*/
}
else
{
return;
}
}
else
{
return;
}
}
else
return;
when they could just test conditions first and leave code visually clear:
if(!condition)
return;
if(!condition)
return;
if(!condition)
return;
if(!condition)
return;
/*long block code here*/
|
|
|
|
|
aritosteles wrote:
Plus the execution flow should appear to you at a glance.
Agree. I think both styles are acceptable if the nesting level is not too great. If it takes more than two "if's" then the second aproach is more readable. But for two or less levels the first approach is good in the sense that it leave a single exit point of the function.
|
|
|
|
|
Microsoft should better optimize their VS IDE (+ MSDN)!!!
I love the look and feel, but always have the feeling that with old-school C/C++ it could have been 1000+ times faster including no memory leaks at all (keep your IDE open and watch the memory consumption time by time . This is called GC and failed like the Java GC approach. Saddly...).
And MS coding style sux partwise. Take e.g. the naming conventions for callbacks:
- Good example
WNDENUMPROC - Bad example
LPTHREAD_START_ROUTINE
Never understood this. I asume, the MS developer was working late on the CreateThread function .
Good coding style is always important, because after hacking an hour on 20 lines of code you sometimes produce such a mess, that the next day you can start all over again (at least this happens to me sometimes).
Game programmers: forget everything I've said, code fast and slim please. My PC runs only 380 Mhz .
|
|
|
|
|
By MS is the problem that programmers from all over the world code together and sometimes there seems to be a clash of cultures.
I feel that people with very different skills and experience work on code.
|
|
|
|
|
Yeah, but somehow I have the feeling that MS USA writes 99.9% of the code and all other locations translate the stuff. Never saw a MSJ/MSDN article from a german MS developer.
Und hey, Ihr baut die beste ISDN Hardware dies gibt! Macht weiter so!
|
|
|
|
|
Colin Leitner wrote:
Good example
WNDENUMPROC
Bad example
LPTHREAD_START_ROUTINE
I think different
Bad example
WNDENUMPROC
Good example
LPTHREAD_START_ROUTINE
Do you like variables with a 1 - 2 symbols? like int i, ab, ac, aw ...?
All my variables , pointers and others have a strictly system.
And I can get the information from a "first look".
like a variable mp_dwordWasRead;
this is a Pointer to the class Member of DWORD size.
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
For the last 4 years I had an almost similar system, but with a little better defined system:
PIXELFORMATDESCRIPTOR * pfd_ipPixelFormat;
First a 1 - 3 character id, that gives a conclusion about the type of the var then a '_' and some kind of flags internal ('i'), temporary ('t'), pointer ('p'), array ('a'), unsigned ('u').
Now this can result in some strange names .
unsigned long * lng_tuapCount[4];
A unsigned long pointer array used to count something.
*lol*
Now I use simple and clear names without any pre and postfixes. It makes your code much nicer!
unsigned long * count[4];
Pavel Sokolov wrote:
I think different
That's OK, but MS should use a well defined system and don't let any programer type like he want's to. This happened with the CreateProcess, wich is BAD coding style. A THREADPROC would have been much more obvious and shorter to type (for casting).
Oops I forgot the global 'g', const 'c' and the volatile 'v' flags .
volatile const unsigned long * lng_vgcuapCount[4] = {0, 0, 0, 0};
(Probably not valid... I never use the volatile keyword and I'm no fan of const values)
|
|
|
|
|
Colin Leitner wrote:
unsigned long * lng_tuapCount[4];
A unsigned long pointer array used to count something.
*lol*
Now I use simple and clear names without any pre and postfixes. It makes your code much nicer!
unsigned long * count[4];
I can't use it, my current project have a 150 classes and unnamed variables is hell for me
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
Pavel Sokolov wrote:
I can't use it, my current project have a 150 classes and unnamed variables is hell for me
It sounds like your code needs to be cleaned up (simplified) if you have 150 classes!
|
|
|
|
|
Anonymous wrote:
It sounds like your code needs to be cleaned up (simplified) if you have 150 classes!
This is a minimum...
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
ps.
VS.NET have a poor interface with a poor speed ( pIII 450/ 768mb RAM ).
and I downgraded to VC6.0
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
Ok, but although it's a bit slow my cranky old f*ck (that's my PC) still runs VS.NET quite good. Viewing the DHTML reference in the MSDN is a real pain in the ass!
|
|
|
|
|
You do not buy new compiler, cause it is faster, but cause it is better (more new functionality, new classes, easier work - I don't say that it is all there, in vc7). If You want fast compiler, get Borland C++ 3.1 for DOS - heh - it is really fast for today.
|
|
|
|
|
where new classes? do you know vc7 ? if I want to add new class in vc7 I should wait 5 -7 seconds before html dialog is loaded. I have pIII-450 with 768 mb of RAM, I think this is not an old computer.
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|
|
Pavel Sokolov wrote:
if I want to add new class in vc7 I should wait 5 -7 seconds before html dialog is loaded. I have pIII-450 with 768 mb of RAM, I think this is not an old computer.
I have used VC7 a lot on my old computer, a PIII-600 with 512 MB Ram, and it worked great. Didn't have to wait much for those dialogs.
A lot of it have to do with your disks though...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
oh c'mon! you "programmers" can afford $1,000+ for VS.NET, but can't spend the same amount on a decent computer? sad sad thing.
|
|
|
|
|
First of all, I've only spent aprox. $350 on a VS.NET upgrade.
I also have a great almost new computer (Dual 1800+), but we were talking about the speed on low/middle range computers...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Ellery,
Some of the people replying to this discussion thread are not professional programmers. Rather, they are students learning how to use the latest and greatest tools. Unfortunately, this means that they never paid for VS.NET. I'm sure you can draw your own conclusions from that statement...
From this point of view, they are paying exactly the same amount for the hardware as the software.
--
Paul
"I drank... WHAT?"
|
|
|
|
|
Ellery Familia wrote:
oh c'mon! you "programmers" can afford $1,000+ for VS.NET, but can't spend the same amount on a decent computer? sad sad thing.
I suspect some of them may have bought on a "promotion" and paid only $2 each CD.
Concussus surgo.
When struck I rise.
|
|
|
|
|
I would think a laptop with a 1GHz Duron (256MB RAM) counts as a "decent computer"...and VS.NET runs like a fly in treacle on it.
IMHO There's no denying that VS.NET requires a lot more power than VS6...though even VS6 is pretty slow on large projects.
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
And if you change the DWORD to a WORD, do you diligently search and replace all references to the variable name with the corrected name? Maybe you do, but I bet a lot of other people don't. Plus, why code the storage method as part of the name? Isn't this why we have getter/setter methods, so we don't need to concern ourselves with internal implementation, and therefore don't care about the storage mechanism?
Marc
|
|
|
|
|
I'm happy with my notation
Pavel Sokolov,
CEZEO software,
LanTalk Network,
http://www.cezeo.com
http://www.lantalk.net
|
|
|
|