14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A

Improving Code Readability

This now works the same as MOVE-CORRESPONDING, but it’s longer—so if the target

structure is already partially filled and you want to keep the values, then you

might as well not bother and should stick with MOVE-CORRESPONDING.

The most compact code of all is of cour se machine code, which reads like this:

A098E564C63E231A45C. If you write a program in this fashion, then it ends up

very short indeed, but of course nobody can understand what it means. This is

why we have high-level languages like ABAP, which read like English and then

get compiled into a form the computer can understand but humans cannot. ABAP

has often been attacked for being very verbose when compared to other languages—for

example, ADD 1 TO ld_number., as opposed to Number++, which a lot

of experts seem to think is better. On the other side of the fence, academics such

as Donald Knuth have aimed for literate programming, in which the program is

supposed to read like a novel or a newspaper.

In essence, the benefit of “verbose” lang uage such as we have been used to in

ABAP is that the more like English it is, the easier it is to understand and thus to

change without breaking something. Contrariwise, as Tweedledum would say,

the benefit of the shorthand statements being introduced in ABAP 7.4 is to enable

you to achieve programming tasks in fewer lines of code, thus boosting productivity;

also, you can see more of the prog ram at once, so you don’t have to page

up and down so often.

Are these benefits mutually exclusive? Can you have the positive aspects of each

approach all at once—that is, have your cake and eat it too?

A.2 The What vs. the How

I think that we can, and the reason is thatthere are two things that we describe in

a program, each for different audiences.

When you’re tasked with adding some functionality or fixing a bug in someone

else’s program, a program you’ve never seen before, clearly the first thing you

need to understand is what it is doing (either what it is trying and failing to do or

what it needs to do in addition to what it currently does).

This “what I am doing” information needs to be in plain English so that you can

grasp it in a hurry. Programmers don’t read written documentation in Word documents

and the like—no one who works in IT does—so the information has to be

in the code.

708

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!