The document is an assignment cover letter submitted by Mohid-ur-Rehman, a student with ID 70068027 in the BSSE program at the University of Lahore. The cover letter is for Assignment 2 in the Design Pattern course, which was due on March 27, 2021 but submitted on March 26, 2021.
The assignment addresses the design issues addressed by the Factory Pattern and Abstract Factory Pattern. It also includes UML skeleton diagrams for each pattern and elaborates examples of each with additional UML diagrams.
The document is an assignment cover letter submitted by Mohid-ur-Rehman, a student with ID 70068027 in the BSSE program at the University of Lahore. The cover letter is for Assignment 2 in the Design Pattern course, which was due on March 27, 2021 but submitted on March 26, 2021.
The assignment addresses the design issues addressed by the Factory Pattern and Abstract Factory Pattern. It also includes UML skeleton diagrams for each pattern and elaborates examples of each with additional UML diagrams.
Title of ID 70068027 Assignment 2 Assignment Section T Due Date 27/March/2021 Submission Course Name Design Pattern 26/March/2021 Date Q1. What design issues does both of these patterns address? ANS:-
• Factory Pattern is an interface for creating objects in a superclass, but allows
subclasses to alter the type of objects that will be created. The factory method model suggests replacing direct calls to create objects (using the new operator) with calls to a special factory method. • Abstract factory pattern lets you produce families of related objects without specifying their concrete classes. The first thing the Abstract Factory pattern suggests is to explicitly declare interfaces for each distinct product of the product family example table, bench etc. Then you can make all variants of products follow those interfaces. That means all bench variants can implement the bench interface; all table variants can implement the table interface. • Both patterns are used when a class doesn't know what sub-classes will be required to create or when a class wants that its sub-classes specify the objects to be created or when the system needs to be independent of how its object are created, composed, and represented or when the family of related objects has to be used together, then this constraint needs to be enforced. Basically both pattern almost work same but in abstract factory pattern we make families of product. Q2. Draw a UML skeleton diagram for each of the pattern Ans:- Q3. Elaborate an example of each design pattern with the help of UML diagrams ANS:-