× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott Klement wrote:
This, to me, is getting convoluted. The negatives in the "not notvalid" make things complex... but that's still a relatively simple example. Even so, it's nicer to have something like this:

chain ItemNo ItemMaster;
if not %found;
Valid = *on;
endif;

. . . 100 lines of code . . .

if Valid;
// use item
endif;

The more positives in your logic, the easier it is to understand. There are certainly cases where negative logic is easy and not a problem.. but it should be tempered with judgement. If it looks too complex, the logic should be cleaned up a bit.

Yet, you still got it wrong. Because clearly the item is valid if it is found in the ItemMaster. Not that your basic premise is bad; it's just that there really is no magic bullet. You need to code what makes sense to you, and then secondarily you need to consider the person who will maintain the code after you. I have my own coding technique that probably most people wouldn't want to use, but it hugely simplifies my programming and makes error checking routines for complex screens one half to one third the size they would normally be by removing superfluous if/endif blocks. When someone first maintains one of my programs, I sometimes have to explain it. But once they understand, they're quite comfortable.

Tradeoff? A few minutes of spin-up to save hundreds of lines of code. And the possible downside that everyone who understands the technique all go down in the same plane crash and someone else has to wade through it.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.