Please don't rule that READ REC is the same as IF THEN. The whole premise of an IF statement is predominately looking for the positive test. While many can argue, it's no way a 50/50 split between the IF being true and the IF being false. The majority usage happens to be the positive, ie the THEN.
So when I'm reading through code my brain is acclimated to reading IF X = 1 blah, blah, blah assuming the conditions are aiming towards True (THEN). When I come across an IF X = 1 ELSE statement it's so out of the ordinary that it looks out of place. Is it wrong and illogical? No, But it's not that welcome when it could have easily been IF X # 1 THEN. Period. There are thousands of IF X # 1 THEN examples as compared to IF X = 1 ELSE. Years ago the earlier forms of IF did not have an ELSE so you had to program around it. I'm not stuck there. It's just a good foundation to consider IF statements leaning towards the positive. The THEN in READ REC wasn't there in the beginning of MV either. There was the mental conditioning that you kinda assumed that it was going to be there and had to handle the exception differently (ELSE). Even OPEN didn't have a THEN then as it was a failure oriented command like READ. THEN came later. I'm not saying any is better or not. But if you review decades of code, both new and old, you'll see that the predominance of IF is THEN and READ and OPEN is ELSE. You can look that up. ----- Original Message ----- From: "Scott Ballinger" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, July 28, 2007 2:10 AM Subject: Re: [U2] RE: Cleaner Case Statement > On 7/27/07, MAJ Programming <[EMAIL PROTECTED]> wrote: > > > > [snip] > > BTW, using IF X = 1 ELSE GOSUB 100 is also very hard to read. Sure it > > compiles but source code should be readable for the programmers who have > > to > > visually interpet these things. EVERY IF should have an THEN as it's > > predominately a positive test instead of a negative test. Then use IF X # > > 1 > > THEN GOSUB 100. > > > > By that logic READ REC FROM FILE,ID ELSE ... should be banned as well? > I think we are all pretty well conditioned to not be confused by the lack of > the THEN clause in this case. I suspect it is mostly what you are used to, > and I think you can get used to quite a lot. Sometimes adding extra words to > make code more "readable" has just the opposite effect. It's all really just > personal preferences, but it feels more professional to call them > "standards." > > my 0.02... > /Scott Ballinger > Pareto Corporation > Edmonds WA USA > 206 713 6006 > ------- > u2-users mailing list > [email protected] > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
