Daveb,
Perhaps the following example would get my point across to you:
DDSURFACEDESC2. Perhaps you find this hard to believe but I don''t really care what comments are in the code for IDirectDraw7::CreateSurface. All I care about is how to use it and if you read my posts I said that before you worry about comments write the frigging documentation. Comments are not a substitute for it. Now if I have to actually look at the code there two reasons. Either it runs too slow or doesn''t work right. The comments don''t help me in either case. Do you really think the comments are going to say:
// The following line should have been iValue = ++iOther;iValue = iOther++;[/source]or[source]// I Should have initialize value outside loop and incrementedfor (iCurrRow = 0; i < iMaxRow; iCurrRow++) for (iCurrCol = 0; i < iMaxColumn; iCurrCol++) int *piBufferOffset = iCurrRow * iRowLen + iCurrCol;
|
If the code works fine all I care about is how to use it and then I want program documentation, not comments. Hypertext links so I can jump from the explaination of the function to the explaination of the structures it uses. If you fail to produce program doc then yes I am forced into the code. Comments are not going to be making me feel you are a professional programmer at that point. Using names such as Whee and Val is not going to make me feel that way either. If you did the same thing with the names in the structure I''m going to think you are a glutten for punishment by forcing yourself to work on such garbage. Even if you did good naming I''m going to question your choices if you calculate some_combat_struct.right - some_combat_struct.left instead of giving it a member function that returns width. All these little pain in the ass things is the problem, not the lack of comments. Good names alone won''t do it, you are right, but if you can explain it easily in a few comments then it isn''t that complicated. I know this is a difficult concept for you, but if you can express it simply in one language then it is a simple concept. Explain implicit surfaces to me in one sentence so that I understand it well enough that I can implement it. Ok, do it in ten. How about 100? With good naming practices all you are doing is replacing operators with verbs, possibly changing the nouns slightly and added a few, um, what are they called, adverbs and adjectives, that don''t really matter to the logic.
As for your specific questions. Return values are what is in the return statements. Where a constant is returned it is usually an error code. So if I saw else return(0) then it most likely returns zero on failure. If I saw instead return(COMBAT_VALUE_ERROR) then I wouldn''t really care what it returned because I would just check for that value. I know it is an integer and that is all I need to know about an error in that case. So using good names does make a differance there. It flags the code so you can easily see the error returns and a small step from that tells you what conditions lead to what error returns.
If I didn''t have any idea what the return value is then why would I be calling the function? Just for the hell of it? I don''t think so. Perhaps you do that, but I don''t. If it is an existing program that already calls it then it did something with the value returned. That gives me some idea what it is which implies a little about how it was calculated. If it is then used in an if statement determining if a hit was scored then the realm of how it might be calculated is reduced considerably. If the code is well written then you can easily pick out the major factors in the calculation. It isn''t just a glob of code, but rather a series of operations. You have to pass test a before b is checked, you have to pass test b before c is checked. Then I only have to understand a few lines at a time. Oh, they checked where the hit was, then the armour rating on that section or some such. If they increment Val then hopefully the input was an array, but the function won''t tell me that and the comments can''t either. That is under the control of the call to the function. They could pass a pointer to an integer for all the function knows. All the code or comments can tell you is what was suppose to be passed.
Finally with the examples of your naming conventions in this I would have to agree that all the comments in the world are most likely not going to make up for your poor choice in names. Oops, sorry, my mistake all the comments in the world won''t make up for the convoluted code. Oops, that wasn''t it, all the comments in the world won''t make up for the lack of object oriented design. Oops, that wasn''t it. What was your point?
Now as far as your experience. I will certainly agree that professional game development is professional programming, but it rather skews your view of the world. Generally you have relatively small, highly skilled staff. Standards are easily agreed upon and enforced. Communication is direct and easy as well as bearacracy being at a minimum, but that is because you are a small organization. You are lead programmer out of how many programmers? Five or ten? That is an acheivement. Congrats, but I was lead programmer, actually technical architect, out of fifty split between two countries if you count Canada as a country instead of a state :-P That was out of an I/S organization of 2,600. We always had 200 to 300 job openings that would go months unfilled. Over 100 of those had gone unfilled for over a year. The annual operating budget excluding labor was $10 million for my system. Our annual budget for all I/S excluding labor was $250 million a year.
That isn''t meant to impress you. There isn''t any reason for it to impress you because it has nothing to do with game development and when it comes to game development I''m a newbie. I''ll tell you I envy you because the environment you work in is a world apart from the one I was in. I would certainly like to be in a environment where I could not only trust that I won''t have a strong urge to cring when I look at the changes someone just completed, but to actually have to defer to their skill. My experience has been out of 2,600 we considered 700 to be technologist which means their core skill was actually using/prodcuing technology rather than systems analysis or project management. Out of those 700 we had perhaps 100 that were what you would really consider good. Not average, but actually good. Out of that we had perhaps 10 to 20 that were world class meaning they can hold their own with virtually any expert in their subject area. That is the norm in extremely large organizations. I fell in that last group. When it comes to milking performance out of a multi-terabyte database it is a rare individual that is my equal no matter their experience. That skill comes from being able to understand what the entire system is doing, where the work went and make a few surgical changes that knock huge chunks of work out of the system while doing the same thing. That means going wherever the code is, with or without documentation, in whatever language it is in, with or without comments, good comments, bad comments, excessive comments, well structured code, f''ed up code, good variable names, bad it doesn''t matter. Now you can argue you are my equal when it comes to sorting through mountains of f''ed up code to find what you are looking for and I won''t argue with you. When you start arguing I can''t do it that is a differant story. That is as far as I''m concerned nothing but a personal attack. Believe whatever you want because I don''t have anything to prove to you. You choose to not believe anything outside the realm of your own personal experiences and that is your problem and not mine.