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 495 | Next

Steven Kelly and Juha-Pekka Tolvanen

"Domain-Specific Modeling"

Store.MetaDataDirectory.
FindMetaRole (BReferencesB.ReferringBsMetaRoleGuid);
if (roleInfo != null)
{
foreach (object link in b.GetElementLinks(roleInfo))
{
BReferencesB relationship = link as BReferencesB;
if (relationship != null)
{
%>

Refers to: <%#relationship.ReferencedB.Name%>


<%
}
}
}
}
%>
And here in Listing 11.2 is the same thing using a DSL, in the crawler-based
MetaEdit+ Reporting Language.
274 GENERATOR DEFINITION
Listing 11.2 Generator written in a language made for generating.
'

ConceptBs

'
foreach .ConceptB
{
'

Name:' :Name '

'
'

Outgoing links:

'
do ~From~To.ConceptB
{
'

Refers to:' :Name '

'
}
}
The key difference here is in the line in the middle, ???do FromTo.ConceptB.???
Starting from the outer foreach loop??™s current ConceptB, it says to crawl along any
From role and its To role into the next ConceptB. That one line replaces twelve lines
fromthe version written in C# (everything between ???Outgoing links??? and ???Refers to???).
This kind of pattern is very common in any code generation or reporting on a
model. Those using standard programming languages as generators will thus quickly
?¬?nd their generators full of blocks of code similar to the above. SinceDSMis intended
to save developers from precisely this kind of unproductive code duplication, this is
more than slightly ironic: the old adage of the shoemaker??™s children comes
inescapably to mind.


Pages:
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6