Seminar on Design and Architecture Patterns

Ošlejšek

Feedback to Strategy/Builder/Composite proposals

  • Basic|Optional|PeriodicAnalysis: Many teams tried to introduce them as sub-classes of an Analysis class. It could make sense if these sub-types have fixed metrics, e.g., the basic analysis consists of the number of lines of code, while periodic analysis always includes the function point metric. But it's not true. The system description clearly states, for instance, that "Analyses marked as basic for a given project...". Which means that they can differ across projects. The difference between basic, periodic, and optional analysis is only in their usage (role played by the Analysis class in the Project association).

A common assignment for all teams

  • A Project has a ProjectStructure, which consists of directories, configuration files, source files, heard files (for C/C++), and other files/directories. The project structure is always a tree => we want to decompose it using the Composite pattern.
  • The quality of the project is measured by applying a set of code quality metrics (and issues, which are understood as special metrics). Therefore, we introduce the QosConfig class remembering which metrics will be used for the project. The instantiation of the QosConfig is conducted step-by-step using Builder.
  • We can conduct three types of quality analysis: basic, optional, and periodic. They differ only in how or by whom they are used. Therefore, we associate QosConfig with the Project under three different roles. The specific basic|optional|periodic QosConfig can be considered strategies for the computation of the project's quality. Therefore, we implement them using the Strategy pattern.
  • The application of the selected analysis (i.e., one of the QosConfig instances) is encapsulated in the ProjectStructure as an auto-propagating method. This method takes QosConfig as an input parameter and automatically propagates to child nodes. Some child nodes ignore this method (do nothing), e.g., configuration files, while some of them provide their content to metrics and add results into an AnalysisResult object.
  • The Project class provides methods like runBasicAnalysis() that take the appropriate QosConfig instance and apply it to the ProjectStructure

Required output

Until Fri. 4.11. at 6:00

  • Draw and submit a class diagram (one per team) using the patterns. Use/update your existing class diagram (do not create a new one).
  • The model will be at the necessary level of detail (methods, attributes, ...)
  • Assign stereotypes to classes reflecting their roles in used patterns: <<composite>>, <<leaf>>, <<strategy-context>>, etc.
  • Submit results to the "09 - Design patterns modelling".
Voluntary now, but will be required next week, anyway: 

  • Draw a sequence diagram capturing the creation of a basic analysis and its assignment to the project.