1 / 6

Design Patterns Exercises

Create Java implementations for tree and sort case studies incorporating various design patterns. Work in pairs, revise based on feedback, and submit electronic and written versions. Final solutions organized under CSE870 directory.

lura
Download Presentation

Design Patterns Exercises

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. Design Patterns Exercises

  2. Homework #5 • Create Java implementations for • Tree Case Study • Sort Case Study • For both case studies, add additional capability that illustrates one or more patterns not already used in case study (e.g. Iterator for Tree, Visitor for Sort) • Extra Credit: Sort Verifier Case Study • Work in pairs • Final solutions should be placed in subdirectories under CSE870 directory, indexed by the last names of each pair

  3. Preparatory Exercise • Break up in pairs • Take assigned code segments and give line-by-line comment • Present the commented version in class. • Revise based on class feedback • Submit electronic and written version for collection and distribution to class mates

  4. Tree Case Study Ramy, Xing • Tree.h/Tree.C (p. 15/37-38) • Node.h (p. 14) • Int_Node.h/Int_Node.C (p. 16/20) • Unary_Node.h/Unary_Node.C (p. 17/21) • Binary_Node.h/Binary_Node.C (p. 18/22) • Factory Pattern Implementation for initializing Node subclasses (p. 26) • Bridge Pattern for printing subtrees (p. 31, short) • Adapter Pattern integrates Tree print with C++ I/O Streams (p. 36) • Main Program (p. 39) • Ternary_Node.h/Ternary_Node.C (p. 42/43-44) Biyani, Mehta Vincent, Bao Huang, King, Liu 3 Arun, Tony

  5. System Sort Case Study Brown, Zhu • Detailed Format for Solution (p. 58) • Input Class (p. 61-62) • Implementation of Strategy Pattern (p. 73, 74) • Dynamic Array (p. 82) • Access_Table Class (p. 83) Explain how the 3 implement theFacade and Adapter • Sort_AT_Adapter Class (p. 86) • Options Class (p. 91-92) • Using the Options Class (p. 93) (singleton pattern) • Using the Double-Checked Locking Optimization Pattern (p. 97-98) • Using the Bridge Pattern (p. 103) • Using the Factory Pattern (p. 108-109) • Using the Factory Method Pattern for the Sort_AT_Adapter (p. 114) • Implementing the Factory Pattern (p. 115-116) • Iterator Pattern (p. 118-120) Middlin Malinak, Post 3 Kirit, James Hewitt, Kunath Joy, Latif, Kalaskar 3

  6. Sample Format for Commented Code //******************************************************* // Tree.h: Interface File for Tree Class (mathematical expression Tree) // Created by D. Schmidt and D. Levine // Modified by Student Name, Date, Michigan State University // as part of CSE 870 (Advanced Software Engineering Course, Sp01) // Point of Contact: Dr. Betty Cheng (chengb@cse.msu.edu) //******************************************************* #include "Node.h“ // Include Node interface file //Describes the Tree edges and acts as a Factory for producing…. class Tree { public: // The following operations are // available for use by other entities. // Factory operations … Tree (int); // comment Tree (const char *, Tree &); // comment Tree (const char *, Tree &, Tree &); // comment Tree (const Tree &t); // Copy constructor … void operator= (const Tree &t); // Assignment …. ~Tree (void); // Destructor ….

More Related