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.

Building the WDA Application 12.2

next dream, wakes up from that, opens her eyes in the next dream, wakes up, and

repeats the process until she wakes up and opens her eyes back in reality. The

ALV grid data in our program must feel a bit like that. The request rushes down

from the view, through the controller, and into the mo del, which instantly asks

its database layer to handle this request, which in return delegates that task to, in

this example, the BOPF framework. Regardless of how the data is retrieved, once

it’s there it then starts its journey back up toward the view.

If You Are Not Using BOPF (But You Should Be Using BOPF!)

Even though this book uses the BOPF framework, it’s more than possible in real life that

you may be reusing an existing model class that has some other sort of data retrieval

mechanism, the most obvious being direct database reads using SELECT statements. If

this is the case, the only difference is that the box labeled BOPF Framework gets

replaced by a box saying SELECT Statements or Shared Memory or Read from External

System or whatever. Due to the highly encapsulated design approach used in this chapter,

nothing else needs to change.

An alternative to the somewhat convoluted process of passing a request through

several layers is to have one line of code inside the view (the SELECT statement).

At this point, anyone not used to the OO concept of abstracting everything will

think I’ve gone fruit loops, barking at the moon, free energy crazy. What do you

get from this seemingly ludicrous, overcom plicated level of abstraction? It’s all

about making the program antifragile so that you can change one part without

breaking the others. Namely, it has the following advantages:

왘 The database layer can decide to use something else than the BOPF, such as

shared memory, plain SQL reads, or something exotic, like calls to an external

system.

왘 At the other end of the scale, you can add a lot of new views that all show the

same data in different ways, and becaus e they all farm off the data request to

the other layers they’re all automaticall y synchronized rather than having the

lookup logic in each view.

왘 In the middle, the model is framework independent and can be used by other

frameworks, like ALV grid-based prog rams or “old-fashioned” DYNPRO programs.

In each case, due to the separation of concerns, you can only break one part at a

time. The parts of the application that are not adjacent to the box you have

541

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

Saved successfully!

Ooh no, something went wrong!