In copy by reference, we can always change the content of the element, affecting all
places where it is used. We can also always change one or more uses to point to a
different element, simply by using the new element??™s name instead. The loose
coupling between the various occurrences of the name also gives rise to a new
possibility.We can deliberately change the name in the de?¬?nition of the element and
create a new element whose de?¬?nition includes the old name. All users of the old
element are now automatically users of the new element instead. This kind of
398 DSM IN USE
indirection can prove useful and powerful, but it introduces a problem: when changing
the name in the element de?¬?nition, a developer must remember to specify whether she
wants to change the name in the references too.
15.1.3 Copy by Reference in Models
In a modeling tool, we can use copy by reference via the names of modeling elements,
i.e., particular string properties. The tool itself need offer no particular support: it is
enough if the generated code is formed so that the references lead to the right elements
in the code.
In the dirtiest approach, it is even possible for copy by reference in a model to map
to copy by value in the code: the content is included many times in the code. This is
similar to the inlining performed by optimizing compilers: program size is increasing,
but speed may also increase.
Pages:
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768