Larry Bradley wrote 2014-04-13 18:52: > Obviously, the program has to meet the specs. > > What I was trying to get across was that you make the code readable from > the outset; if you KNOW that you are going to have to do something > convoluted in order to make it meet the spec (like using a pointer to a > pointer to a pointer to a procedure which uses pointer to pointers), do > so. But if everything else is readable, and you are in the habit of > making things readable, then you can spend a bit of time to make the > convoluted code readable. > > If the initial version is readable, and while testing you discover it is > too large or too slow (or if using the XC8 free compiler, BOTH :) then > you can tweak things. > > There is no reason why readable code cannot be just as compact and just > as fast as spaghetti code. > > Things that help to make code readable are good program structure (if > performance won't suffer, break things up into small procedures), use > meaningful variable can constant names, be consistent in your naming > conventions, and use comments to describe WHY a piece of code is doing > something. WHAT it is doing should be evident from the code itself. And > if it isn't evident, then indeed comment that as well. > > I hope I'm not preaching to the choir, but I spent far too many hours in > my career trying to figure out what on earth THAT piece of code is > doing. And many times it was MY code. > He, my current assignment is on a system where we support code that is 20-30 years old. In Mars 2013 I made some moderate changes to a application whos source files was created in Mars 1983. Same source files all the time. Comments are sparse, changes have been made by different programmers now and then. Some would say that Cobol is self-commenting, but I don't know... :-) And now, a few months ago, this application support has been transfered to an Indian company called HCL. Now, all comments in the sources are 100% in swedish, the variable names themselfs are in swedish. Terminal screens are in swedish. Docs (those few that are available) are in swedish. The end-users that we support does *not* talk english. The two indian guys (nice guys b.t.w) have quite a hard time... :-) Those writing this in 1983 did probably now take into account that we would be supporting this appliations in 2014. :-) Best Regards, Jan-Erik. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .