Design Patterns AssignmentThese are the OO Principles we have looked at from HFDP Encapsulate what varies: Identify the aspects of your application that varyand separate them from what stays the same Favor composition over inheritance (Prefer a HAS-A relationship to an IS-Arelationship) Program to interfaces, not implementations Strive for loosely coupled designs between objects that interact Open-Closed Principle: Classes should be open for extension but closed formodification Dependency Inversion Principle: Depend on abstractions; do not depend onconcrete classes Single Responsibility: A class should only have one reason to changeThese are the Design Patterns we have looked at from HFDP Strategy Observer Decorator Factory (Simple, Method, Abstract) Singleton Adapter Iterator CompositePart 1For each of the design patterns we looked at in class (see above) write the following: The name of the pattern The description of the pattern as given in the Who Does What exercise inchapter 13. The category of pattern Creational, Structural, or Behavioral as given inthe Sharpen Your Pencil exercise on the next page. The second category of pattern Class or Object as given just after the firstcategory.Further exam study tip: The bullet points at the end of each chapter make greattrue/false questions!Part 2Answer the following questions.1. Give the three OO design principles that the Strategy Pattern uses accordingto HFDP.2. Give the three OO design principles that the Observer Pattern uses accordingto HFDP.3. What are observers called in the Swing framework? (see Other places youllfind the Observer Pattern in the JDK in Chapter 2)4. What is the main OO design principle introduced in the discussion of theDecorator Pattern?5. The Java I/O package is largely based on decorator. InputStream representsthe abstract component. What class represents the corresponding abstractdecorator? (see Decorating the java.io classes in chapter 3)6. What is the main OO design principle introduced in the discussion of theFactory Method Pattern?7. What OO design principle does the Factory Method Pattern ignore? (seebullet points in chapter 4)8. What kind of class (introduced in Java 1.5) does Effective Java by JoshuaBlock recommend for creating singleton objects in Java?9. What keyword (instead of class) does Scala to create a singleton object?10. There are two forms of the Adapter Pattern: object and class adapters. Whichone did we cover? (see bullet points for chapter 7)11. What is the main OO design principle introduced in the discussion of theIterator Pattern?12. What OO design principle does the Composite Pattern violate? (see thesection just before Flashback to Iterator in chapter 9)13. The Java Swing components rely heavily on the Composite Pattern. Considerthe following four JComponents: JPanel, JButton, JLabel, JMenu. Which aretypically used as leaf classes and which are typically used as compositeclasses?14. Look at the Builder Pattern in HFDP. Give its brief description; tell whether itis a creational, structural, or behavioral pattern; and tell whether it is a classor object pattern.15. What is the name of the Builder for the String class? What is the name of itsprimary method? Is the builder class mutable or immutable?
CS5704
[Solved] CS5704 Assignment-Design Patterns
$25
File Name: CS5704_Assignment_Design_Patterns.zip
File Size: 310.86 KB
Only logged in customers who have purchased this product may leave a review.

![[Solved] CS5704 Assignment-Design Patterns](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] River Crossing Project Code Solution](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.