SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 536 | Next

Steven Kelly and Juha-Pekka Tolvanen

"Domain-Specific Modeling"

Still, these actions may often be generated as direct inline code for
readability, so the problem remains.
Howthen do we include pieces of code in a data structure? Some languages such as
Smalltalk offer simple support for code as data, and in other languages it can often be
accomplished with a little work, for example, in Java via inner classes. If that is not
possible, the discussion on dynamic method invocation at the end of 11.3.5 above is
worth revisiting: we can implement each piece of code as its own function, and just
supply a reference to the function in the data structure. Where even that is not possible,
we can use the simple approach seen in the JavaWatch implementation: make one big
function that contains all the pieces of code in the model as cases in a switch or IF??“
ELSEIF statement.
11.3.7 Integrating Handwritten Code
Even a passing acquaintance with code generators will have taught you the cardinal
rule: never edit generated code. If you need different code than was generated, make
the necessary changes to the model. If you cannot accomplish what you want just by
editing the model, look at improving the generator or modeling language to handle
this and similar cases. If the code needed for this particular case really does seem to be
a one-off, the modeler will need to write the code by hand.


Pages:
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6