Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. # EDOM - Project Increment 2
  2.  
  3.  
  4. ## Possible modifications to the Xtext-generated grammar ##
  5.  
  6. In this project there was a mandatory modification to the Xtext-generated grammar, related to the use attributes of the type **Date**:
  7.  
  8. - **String to Date and Date to String Conversion:** The Xtext file generated for the Requirements DSL does not come with a conversion from String to Date, or Date to String. The auto-genmerated file even comes with a comment suggesting to create an *IValueConverter* method to convert the Date to String, and vice-versa. Considering this, it was created the **RequirementsDSLValueConverter** class, containing two methods:
  9. - **toString**, with the objective of converting Date objects to a String, following a yyyy-mm-dd format;
  10. - **toValue**. with the objective of converting a String following the format yyyy-mm-dd into a Date object;
  11.  
  12. Other modifications could be applied, in order to simplify the preview of a model of this specific project: i.e., the **Requirement** contains a **Version**, which is represented by **3 values: major, minor and service.** All this values are int values, and are **meant to be read *major.minor.service*-** considering this, it could be made a **modification** to ensure that, inside a **Requirement** instance, the **Version** would be represented following a *major.minor.service* structure instead of the current representation. However, this was not implemented but it is a change that can be made pretty quickly and is being thought of.
  13.  
  14.  
  15. ## Requirements DSL Formatting ##
  16.  
  17. The formatting of this DSL project needed to be slightly adjusted - although there was already a formatting for the **Model** and the **Requirements Group** entities from the Xtext-generated project, there were none for the **Requirement**, **Comment** and **Version** entities - this being stated, it was needed to add a formatting to the entities that did not had one, and the auto-generated formatting needed to be reviewed in order to achieve what was the objective of this formatting.
  18.  
  19. The formatting of the different entities had the objective of facilitating the preview of a **Requirements Model**.
  20.  
  21. The applied formatting consists of, to a certain entity, guarantee that all its attributes are aligned and separated by a new line. If a certain attribute is an instance of another entity, then the formatting should ensure that occurs a new indent, and from there it should be presented the presentation of said entity.
  22.  
  23. For example, applying the formatting to this dsl
  24.  
  25. ```
  26. Model{title GorgeousFood groups{ RequirementsGroup "User Requirements" {description "A group of user-related requirements of the Gorgeous Foods App" id rg0000000 requirements {Requirement{title "Req01" description "Teste" type FUNCTIONAL priority MEDIUM author "RuiBarbosa" created "2019-06-09" id rq0000000 state NEW resolution INVALID version Version { major 1 minor 1 service 1 } comments{Comment{ subject "test" body "it's a test" author"Mario" created"2010-03-03" }}}}}}}
  27. ```
  28.  
  29. should return the following result
  30.  
  31. ```
  32. Model{
  33. title GorgeousFood
  34. groups{
  35. RequirementsGroup "User Requirements" {
  36. description "A group of user-related requirements of the Gorgeous Foods App"
  37. id rg0000000
  38. requirements {
  39. Requirement{
  40. title "Req01"
  41. description "Teste"
  42. type FUNCTIONAL
  43. priority MEDIUM
  44. author "RuiBarbosa"
  45. created "2019-06-09"
  46. id rq0000000
  47. state NEW
  48. resolution INVALID
  49. version Version { major 1 minor 1 service 1 }
  50. comments{
  51. Comment{
  52. subject "test"
  53. body "it's a test"
  54. author"Mario"
  55. created"2010-03-03"
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. }
  63. ```
  64.  
  65. ## Requirements DSL Unit Tests ##
  66.  
  67. The Unit Test on this project consist of ensuring that the model created representing the DSL follows the syntax of the previously referenced DSL.
  68.  
  69. If the syntax of the presented model is well written, the test will pass; if not, the test will fail.
  70.  
  71. The Unit Test are quite simple, but straight to the point. Considering this, the unit tests are considered sufficient to the project.
  72.  
  73.  
  74. ## Solution Analysis ##
  75.  
  76. The created mwe2 workflow consists of reaching a set of objectives. The objectives were:
  77.  
  78. - Reading a DSL file into memory;
  79. - Applying validations to the model;
  80. - Applying the formatter;
  81. - Saving the DSL file;
  82. - Generating a graphical diagram of the DSL file.
  83.  
  84. The new workflow consists of two main components, each one responsible of handling a different set of objectives:
  85.  
  86. - A component that imports, valides and saves a model from a file;
  87. - A component that generates a Requirement Diagram from the previously loaded dsl file.
  88.  
  89. The first component is based on the solutions used on the first increment of this project (primarly the SaveModel and the GenerateDot solutions).
  90.  
  91. The second component is based, once again, on the Generate Dot - this component imports the loaded dsl file and generates a diagram according to the model.
  92.  
  93. Although there are some differences between this approach and the one used on the first increment of this project, the main differences focus on the simplicity and modularity of using mwe2 workflows - the mwe2 workflow is easy to build using externally developed classes, what makes this solution more modular and extremely more simple to analyse and understand.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement