Chapter 6_ Using Design Patterns.docx - Introduction to...

This preview shows page 1 - 5 out of 14 pages.

Introduction to Patterns Design Patterns The outline of a reusable solution to a general problem encountered in a particular context Many of them have been systematically documented for all software developers to use A good pattern should: - Be as general as possible - Contains a solution that has been proven to effectively solve the problem in the indicated context Pattern Description Context: General situation in which the pattern applies Problem: Short sentence or two raising the main difficulty Forces: The issues or concern to consider when solving the problem Solution: The recommended way to solve the problem in the given context to balance the forces Antipatterns (Optional): Solutions that are inferior or do not work in this context Related Patterns: (Optional): Patterns that are similar to this pattern References: Who developed or inspired the pattern The Abstraction-Occurrence Pattern Context Occurrence: set a related objects Members of such a set share common information but also different from each other in different ways Problems What is the best way to represent such sets of occurrences in a class diagram? Forces You want to represent the members of each set of occurrences without duplicating the common information
Image of page 1

Subscribe to view the full document.

Solution Antipatterns Square Variant General Hierarchy Pattern Context Objects in a hierarchy can have one or more objects
Image of page 2
above them (superiors) and one or more objects below them (subordinates) Some objects cannot have any subordinates Problem How do you represent a hierarchy of objects in which some objects cannot have subordinates. Forces You want a flexible way of representing the hierarchy that prevents certain objects from having subordinates All the objects have many common properties and operations Solutions
Image of page 3

Subscribe to view the full document.

Antipattern The Player-Role Pattern Context A role is a particular set of properties associated with an object in a particular context An object may play different roles in different context Problem How do you best model players and roles so that a player can change roles or possess multiple roles?
Image of page 4
Image of page 5
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes