1 / 35

Software Patterns

Software Patterns. Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad. Lesson 5: Documentation Template. 2. Lesson Objectives.

sibley
Download Presentation

Software Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Software Patterns Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad SJSU -- CmpE

  2. Lesson 5: Documentation Template 2 SJSU – CmpE --- M.E. Fayad

  3. Lesson Objectives • Understand why pattern documentation patterns • Learn how to document patterns • Explore each section of the template by example. • Understand the tips, rules, and guidelines for documenting each section. 3 SJSU – CmpE --- M.E. Fayad

  4. Basically, there are two types of templates for documenting stable patterns: 1. Full Template. Each stable pattern should have a full template that gives a detailed documentation for that pattern. The full template consists of 14 fields that will be discussed in details in the next section. 2. Short Template. A short template is a reduced size version of the full template. This template is usually used to document the pattern when this pattern appears within the main pattern that we are interested in documenting it. Short template consists only five fields. Documentation Templates 4 SJSU – CmpE --- M.E. Fayad

  5. Pattern Name Problem Context Forces Solution -- Pattern structure Participants CRC Cards Behavior Model Consequences Applicability with illustrated Examples Related Patterns Design/Implementation Issues Formalization Known Uses Several Perspectives Full Template 5 SJSU – CmpE --- M.E. Fayad

  6. Pattern Name Problem Context Solution -- Pattern structure Participants Short Template 6 SJSU – CmpE --- M.E. Fayad

  7. Presents the name of the presented pattern. Gives afocus and precise name for the pattern to be described. Choose the patterns’ names carefully. Patterns’ names should be natural, and descriptive, and unambiguous. Pattern names are very essential for understanding the purpose of the pattern. Pattern Name 7 SJSU – CmpE --- M.E. Fayad

  8. Pattern names should be bold and italic whenever they appear in the text. It is a single word or a short phrase. Pattern Name: Rules 8 SJSU – CmpE --- M.E. Fayad

  9. Name has to be a meaningful and natural name. Name must refer to the atomic concept and the core knowledge of the pattern. It has to be unique and descriptive and only refer to the pattern that describes. Multiple names cause confusion but it cannot be avoided. In this case the Aliases must be stated if applicable. Pattern names must imply the characteristics of EBTs or BOs Pattern Name: Tips 9 SJSU – CmpE --- M.E. Fayad

  10. Presents precisely and briefly the problem this pattern addresses. It is preferred that the problem is presented in the form of a question. For instance, for the pattern named “Negotiation” the problem could be described in the question: How does one build a negotiation model that can be used to model the negotiation problem in any application? Problem 10 SJSU – CmpE --- M.E. Fayad

  11. Gives the boundaries of the problem and preconditions in which the pattern may recur. This must be discussed thoroughly to avoid critic. Context -- Rules: Context must be clearly described. List all the preconditions for which the solution is valuable. Context 11 SJSU – CmpE --- M.E. Fayad

  12. Illustrates the challenges and the constraints that the pattern needs to resolve. Discusses the issue of the problem and the trade off between these issues. It is expected that reading these forces will help the reader in realizing the difficulty of the problem, while at the same time it helps him to appreciate the importance of having a solution to this problem. It must discuss problem’s constraints. Forces and constraints may contradict with one another. Forces 12 SJSU – CmpE --- M.E. Fayad

  13. Forces represent the “Why?” Forces also represent the problem’s constraints. Forces expose the particulars of the problem. Forces must be listed based on their priorities. Forces: Rules 13 SJSU – CmpE --- M.E. Fayad

  14. a)Static structure,which is stable object model or pattern structure. Static structure reveals the structure of the pattern that contains it participants and the relationships among them. We use UML notation and guidelines for generating the pattern structure. The solution must be described and it may contain pictures, diagrams, textual templates, descriptive artifacts, etc. b)Participants c)CRC Cards d)Dynamic behaviorwill be illustrated and discussed in the applicability of the pattern. Solution – Four Parts 14 SJSU – CmpE --- M.E. Fayad

  15. Gives the class diagram of the pattern (EBT or BO). It also introduces briefly each class and its role. Associations, aggregations, dependencies, and specializations should be included in the class diagram. Association classes, constraints, interfaces, tagged values, and notes must be included in the class diagram. A full description of the class diagram should be included. Pattern Structure (1) 15 SJSU – CmpE --- M.E. Fayad

  16. This part shows and describes briefly the stable object model of the pattern. We present two class diagrams for each pattern, one is brief version of the class diagram, where only the name of the classes and patterns and their relationships are shown. The other class diagram is the detailed one where operations and attributes are added to each class and pattern. Pattern Structure (2) 16 SJSU – CmpE --- M.E. Fayad

  17. <EBT> Class <BO> Class <IO> Class <Pattern-EBT> Pattern represents stable analysis pattern <Pattern-BO> Pattern represents stable design pattern Pattern Structure: Tag Names 17 SJSU – CmpE --- M.E. Fayad

  18. Rules Follow UML Use tagged value Heuristics ·EBTs or Pattern-EBT’s multiplicities is usually one or a fix number of instances. Avoid many to many relationship. Pattern Structure: Rules & Heuristics 18 SJSU – CmpE --- M.E. Fayad

  19. The participants of any pattern can be classified into two main categories: Classes and Patterns. The participants of the pattern are: 1. Classes. List all the classes in the pattern and a short description for each. 2. Patterns. List all the patterns in the main pattern and a short decription for each Participants (1) 19 SJSU – CmpE --- M.E. Fayad

  20. (Pattern-EBT = Stable Analysis Pattern, or Pattern-BO = Stable Design Pattern) EBTs usually do not have multiplicity around them (always considered to be 1, or a fixed number or a range if you are not sure.) Between any two components in the pattern class diagram the multiplicity, roles, and relationship names should be added. Participants: Rules 20 SJSU – CmpE --- M.E. Fayad

  21. A Role must be specified per the card’s class. Each CRC-Card should contain one and only one responsibility. This responsibility has to be unique and it must be specified within context. The Clients names are listed under each other without using bullets or dashes. Server part should contain all the services provided by the current Class/Pattern listed without bullets. Each severs will be written as an operation starting with small letter and has two curve parenthesizes at the end. Classes with multiple roles, such as actors, must have a CRC card per role. CRC Cards: Rules 21 SJSU – CmpE --- M.E. Fayad

  22. CRC Card filling process: 1. Identify the CRC card’s class name, 2. Name its role, 3. Name its responsibility under responsibility section, 5. List card class’s services (operations) under server and 6. Identify his clients in the client’s section. The clients must have direct or indirect relationships with the card class CRC Cards: Heuristics 22 SJSU – CmpE --- M.E. Fayad

  23. How does the pattern (EBT or BO) support its objectives? What are the trade-off and results of using the pattern? Nothing is perfect, and each problem has many issues that are usually hard, if not impossible, to be satisfied at once. This section lists the affect expected by using this pattern: good results (benefits), bad (drawbacks), ugly (which might cause major problems in specific situations), and the trade-offs (which shows what you gain versus what you scarifies from using this pattern in you development) Consequences 23 SJSU – CmpE --- M.E. Fayad

  24. Provides clear and detailed case studies for applying the pattern in different contexts. This section shows how the pattern can be used in different applications. Usually, it is good to show the applicability of the pattern through two examples where each example has different nature. Applicability with Illustrated Examples (1) 24 SJSU – CmpE --- M.E. Fayad

  25. For each case study the following subsections are usually filled: [a] Case Study # x: Case study name [b] Problem Description. This is a short problem statement about the case study where the pattern will be used. [c] Problem Class Diagram. Shows the class diagram of the problem with highlighting the original pattern in different color (gray, for instance). Applicability with Illustrated Examples (2) 25 SJSU – CmpE --- M.E. Fayad

  26. In order to ease the reading of the stable model, each class should be located within its layer in the following format: Applicability with Illustrated Examples (3) 26 SJSU – CmpE --- M.E. Fayad

  27. [d] Role-based Instance Diagram and Role-based Scenario for Pattern. Role-based Instance Diagramis a diagram that shows how can each pattern/class in the main pattern class diagram is instantiated in the example. It also shows how the pattern components interact with each others in the application soul. Figure, in the next slide, describes the symbols that are used in the Role-based instance diagram. The Role-based Scenario is a description of the role-based instance diagram in story wise, where each component in the pattern plays its role in the scenario. We found this story useful in gaining better understanding of the problem. In this scenario the pattern names are written in bold italic. The roles are written in bold and underlined Applicability with Illustrated Examples (4) 27 SJSU – CmpE --- M.E. Fayad

  28. Applicability with Illustrated Examples (5) AnyView SJSU – CmpE --- M.E. Fayad

  29. [e] Use Case Description. List 4-5 detailed use cases. Behavior Diagrams, such as Sequence Diagrams or STDs Sequence Diagrams A sequence diagram is a map of a giving use case. A sequence diagram usually forms a snake (only one snake) Applicability with Illustrated Examples (6) 29 SJSU – CmpE --- M.E. Fayad

  30. Specification Model for the Patternrepresents the AnyParty’s view of the pattern; therefore, it describes what the AnyParty (i.e., user) may expect. The classes and relationships illustrate the vocabulary of the pattern requirements. Type Specifications. Hooks Description. Hooks are extension points on the BOs that can be adapted by AnyParty (e.g. application developers, users, operators). Each hook provides a specific requirement to be fulfilled by AnyParty and documents how to extend the pattern or the framework to meet the requirements. All BOs provide implemented hooks that can be utilized by IOs, application classes. Design/Implementation Issues 30 SJSU – CmpE --- M.E. Fayad

  31. Shows other patterns that usually interact with the described pattern, and those who are included within the described pattern. Related patterns can be classified as related analysis or design patterns and related design patterns. Related patterns usually share common forces and rationale. Related Patterns 31 SJSU – CmpE --- M.E. Fayad

  32. Describes the pattern structure using the formal language (Z++ or Object Z) Formalization Using Z++ or Object Z 32 SJSU – CmpE --- M.E. Fayad

  33. Gives some examples of the uses of this pattern in existing systems (if the pattern has been already deployed before). Or it gives examples of existing system that can utilize this pattern as an alleviative to what they use currently Known Uses 33 SJSU – CmpE --- M.E. Fayad

  34. This section of the template provide a brief discussion of the strategic impact of using the described pattern from the following perspectives: Budgetary Culture Technical Managerial Marketing Economic Impact Several Perspectives (Optional) 34 SJSU – CmpE --- M.E. Fayad

  35. Use the pattern documentation template to document all EBTs (Stable Analysis Patterns) and all BOs (Stable Design Patterns) of the stable model (project #1). Discussion Questions 35 SJSU – CmpE --- M.E. Fayad

More Related