× 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.



> From: McCallion, Martin
>
> I think this thread has shown that that is not always true; or at least,
> it is not always obvious that you are updating a _substring_, rather
> than the whole field.  Yes, you should be aware of the attributes of the
> fields you are working with, but my point is that the use of the %subst
> bif makes it explicit both that you are doing a substringing operation,
> and that you _intended_ to.

So does a comment, without having to make someone take out a calculator to
figure out what you intended.


> My point here wasn't that the code above was necessarily that good, or
> even the best it could be, but simply to suggest that careful layout of
> code can greatly improve readability.

It's really little wonder that bloatware has taken over the industry.  It
seems that people have entirely forgotten that programming is about writing
good, fast programs, with an eye toward maintainability, as opposed to
writing good-looking, easy-to-read source code.

Give an end user a choice between readable code and a 50% performance
increase, and I can tell you what they'll take, every time.  It's our job to
figure out how to make the code maintainable, and that's why they invented
COMMENTS.  This idea of "self-commenting code" at the expense of performance
and ease of writing is misguided at best, and self-defeating at worst, as
the posts have shown.

C* Move lot sequence into last six places of lot number
C    MOVE LOTSEQ LOTNUMBER

The above is FAR easier to understand than this:

> > >   eval %subst( lotnumber :
> > >                      ( %len( lotnumber ) - %len( lotseq ) ) + 1 :
> > >                      %len( lotseq ) ) =
> > >              %editc( lotseq : 'X' )

And it's STILL less code to write.

No matter what, the %subst code above has no business in any business
program.  It's difficult to read, and, as Mr. Kilgore pointed out, requires
someone to sit down with a piece of scratch paper to determine the ACTUAL
intent (for example, just leave off the "+1", and you have a completely
different animal).  In fact, you need to comment this code to tell what it's
really doing, and at that point, the MOVE instruction truly wins hands down.
If you can't see that, then we have a difference about what the purpose of
programming is.  To me, it's about the end user, and getting good, solid
code in their hands as quickly as possible.

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.