понедельник, 12 октября 2015 г.

#828. Description of the model

Original in Russian: http://programmingmindstream.blogspot.ru/2015/08/blog-post_28.html
This is a “new reading” of Example of generation templates in use.

The previous series was here – Description of the model. Technical details

The meta-model was described previously.

Now we are going to describe one of specific models:

https://bitbucket.org/lulinalex/mindstream/src/6b9f39b15ecc6d83dbcd4219dc2c214f562c7297/Examples/Scripts/CodeGeneration/CodeGen12.ms.script?at=B284

USES
 metaMACRO.ms.dict
;
 
Test CodeGen
 // %SUMMARY is meta information that allows binding the documentation to the code elements. Consequently, the documentation is available from the script engine. 
%SUMMARY '
 '
 ; // %SUMMARY
 
// ---------------------------------------------------------------------------
 
meta-meta-model-begin
 ' That is where we test meta-model building, model building and then code generation.
 '
 
StereotypeStereotypeProducer meta
 %SUMMARY '
 Base element of meta-model determined
 This is the element that allows us to pull the rest “by hair out of the swamp”.
 Other primitives are derived from this one.
 '
 ; // %SUMMARY 
; // meta
 
meta-meta-model-end
 
// ---------------------------------------------------------------------------
 
// ---------------------------------------------------------------------------
 
meta-model-begin
 'That is where we determine axiomatic of meta-meta model and extract it in a separate dictionary later.
  Next we will determine the UML concepts -   https://en.wikipedia.org/wiki/Unified_Modeling_Language
  There are CATEGORIES and CLASSES in it
  Actually, they merely differ from each other, however, let it be so 
  for it was so decided by some wise men
 
Let’s start with them:
  '
<<@meta>> UMLCategory
 %SUMMARY '
 Category on UML
 ' 
 ; // %SUMMARY 
; // UMLCategory
 
<<@meta>> UMLClass
 %SUMMARY '
 Class on UML
 ' 
 ; // %SUMMARY 
; // UMLClass
 
meta-model-end
 
// ---------------------------------------------------------------------------
 
// ---------------------------------------------------------------------------
 
concrete-model-begin 'Templates model'
 ' This is where we determine axiomatic of the specific model.
  For now let’s determine axiomatic of “template model”
  We will extract it in a separate dictionary later.
 '
 
<<UMLCategory>> Project
 %SUMMARY '
 We probably bump into projects here and there when developing.
 The Project is a stereotype describing our projects.
 '
 ; // %SUMMARY
; // Project
 
<<UMLCategory>> Library
 %SUMMARY '
 We probably bump into design libraries here and there when developing.
 The Library is a stereotype describing our libraries.
 '
 ; // %SUMMARY
; // Library
 
<<UMLCategory>> Programm
 %SUMMARY '
 We probably bump into programs here and there when developing.
 The Program is a stereotype describing our programs.
 '
 ; // %SUMMARY
; // Programm
 
<<UMLClass>> Class
 %SUMMARY '
 We probably bump into design classes here and there when developing.
 The Class is a stereotype describing our design classes.
 '
 ; // %SUMMARY
; // Class
 
// Some time later, when we start to use these we will find out whether
// the Library can be embedded in Project and, vise versa, the Project embedded
// in the Library or whether the Program can be embedded in the Class and, vise
// versa, the Class embedded in the Library as well as other relations between stereotypes.
 
model-end
 
// ---------------------------------------------------------------------------
 
USES
 CodeDump.ms.dict
 // - the CodeDump.ms.dict is loaded so we can “see” the DumpElement word
;
 
@SELF DumpElement
// - the CodeGen element and its contents are dumped in a standard output device.
// We only do it to debug what we’ve written.
 
help
// The available axiomatic is output to a standard output device.
// We only do it to debug what we’ve written.
 
; // CodeGen
 
CodeGen

- So, we have described the stereotypes of the specific model: Project, Library, Programm и Class.

Комментариев нет:

Отправить комментарий