Mike Preece wrote:
You mean incorrectly.On Mar 4, 6:10 pm, Simon Verona <[email protected]> wrote:Agreed about the long term benefits of rewriting! This could not be more incorrect. The only way you could contrive to make this correct is if the variable were all called A1 A2 A3 etc and they have to be explained. Variables should be:I believe that comments are often a result of somewhat shabby work. recordCounter customerFile and so on. Comments are rarely about explaining what the code does. I know what COUNT() does and I can even infer G += (A++)+(-l--) does. Comments are about WHY it does it, and no amount of jiggering about with the code explains things like why are particular algorithm was chosen and so on. We would NEVER have to think twice about these things. And anyway, it's only BASIC, it isn't rocket science (expcet for the blokes at JPL that use jBASE that is). I was going to give lots of examples and so on but I don't think there is any point. I think that you must not have ever seen properly documented code. The comments rarely explain the lines of code that are going to run. Comments say things like:We ought to think twice. Look at the code you've written and see if there are changes you could make to it that would make it self explanatory. * Do not be tempted to change this algorithm basing it at 0 as then XYZ is * required.... * The front desk bell captain must be pinged before the bell as the * front stufle pump will explode if this happens out of order more than * 6 times - doing this here before starting the grunk engine guarantees order * * We must use a topological sort here as a straight qsort does not account * for interdependencies and we must detect dependency cycles here * * Use dynamic arrays here because.... I am sorry but this is utter rubbish. How is adding comments taking an easy way out - I think that perhaps you experience of other programmers can have been only of relatively mediocre ones. Can I guess that a lot of your code does not have comments in then, and you have self justified this by saying "Ah, now I have formatted it a bit, it is obvious"? This isn't how it works at all. Comments remind you of the thought process you went through 3 years ago to type in the program. If I need comments for something I wrote 3 years ago, then how can I expect someone who has never seen the code to get the gestalt?That little bit of extra effort is, in my opinion, better than taking the easy way out by throwing in a comment or two. Also, do not forget that sometimes code that is harder to read might be necessary because it is 10X faster and so on. It is part of your job as a programmer to look after the code. If you don't update the comments, then you are not doing your job. The number of times I have heard this crap from programmers is unreal. It is like your mechanic saying "I didn't put in any oil in your car because it will be out of date in 6,000 miles anyway". Just because there are comments does not mean you don't read the code.One argument in favour of this approach is that comments can end up misleading or extraneous after a code change. Then he isn't really any good. Good programmers are not hacks who do things that are 'clever' - programming is a profession.It'd be easy for a programmer to get in and fix or change something, get the code working as it should, and overlook that the comment should also have been changed. Exit to error condition that does not return. That's it.And - to add some extra heat to this discussion - GO can sometimes (although very rarely) have its place. Jim --~--~---------~--~----~------------~-------~--~----~ Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24
To post, send email to [email protected]
|
- Re: Jbase programming query Bruce Willmore
- RE: Jbase programming query Simon Verona
- Re: Jbase programming query Bruce Willmore
- Re: Jbase programming query Jim Idle
- Re: Jbase programming query concern shoko
- Re: Jbase programming query Simon Verona
- Re: Jbase programming query Richard Kann
- Re: Jbase programming query Charlie Noah
- Re: Jbase programming query Mike Preece
- RE: Jbase programming query Simon Verona
- Re: Jbase programming query Jim Idle
- RE: Jbase programming query Tony G
- Re: Jbase programming query Jim Idle
- Re: Jbase programming query Mike Preece
