----Original Message---- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Taylor Sent: Friday, September 30, 2005 7:53 AM To: [email protected] Subject: RE: [U2] Good Programming Practice Question.........
> I would add a few: > > 1) no multi-command lines (i.e. command ; command; command Generally speaking, I agree. But there are places where it actually enhances readability. For example, in front of a section of code you initialize a set of counters to 0, or a set of arrays to ''. Stacking them together keeps more program real estate visible on the screen. But I'm of two minds on this one myself. :) A better example is a short set of cases where they all set a variable or two and do a GOSUB. > [snip] > > 4) No MATREAD & MATWRITE. Some will probably disagree, but to me this > takes a wonderfully dynamic system and hamstrings it. I have > also seen > data corruption happen when you have a large file dictionary than the > array dimension. This is definitely platform dependant > though. Unidata > just puts all remaining fields into the last array position. > If you then > change that position expecting it to be just the one field you want to > work with, the remainder of the data is lost. Universe behaves > differently, but I still don't think using these commands is > a good idea. Yes, this is application-dependent. If the app is bottle-necked because of huge dynamic arrays (like invoices with hundreds of line items can be), then MATREAD/WRITE can give you an order of magnitude better performance. > Generally, I have always had three general rules that I apply > up front. > All the specific standards created work to support those three rules. > > 3) The code must be maintainable. Proper structure, NO use of the > 'command-that-must-not-be-named' Well, there's at least *one* valid use for a GOTO ... :) Let's say you define a common in an INCLUDE. You need to initialize it somewhere, and I don't like separat init routines, because there's too much chance of them getting out of synch. So I embed an init GOSUB at the end of the INCLUDE. Since it's embedded (and that's the *only* case one should be embedded) you need to GOTO a label after the sub's RETURN. -Keith ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
