Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Reply to Comment: (1a): I\'ve provided a table that needs descriptions added to

ID: 3866223 • Letter: R

Question

Reply to Comment:

(1a): I've provided a table that needs descriptions added to each row, see:
Add description here.
Add short example here.
I've already identified the 5 Design Patterns.

Lastly, (1b): Add an example of combined patterns (listed above) to best solve a large scale problem.

------------------------------------------------------------------

Question #1a: According to our text, Horstmann, C. S. (2009). Big C++, 2nd Edition, and as defined by the GoF, the five categories of design patterns are:

5 Categories of Design Patterns

Pattern Name

Description

Example

Iterator

Add description here.

Add short example here.

Adapter

Add description here.

Add short example here.

Template Method

Add description here.

Add short example here.

Strategy

Add description here.

Add short example here.

Composite

Add description here.

Add short example here.

Note: Provide editable text in solution (no screenshots).

Excerpt from page 917 to explain the GoF:

“As you can see, a pattern is more abstract than an algorithm. An algorithm gives you specific instructions how to implement a computation. A pattern gives you advice on solving a design problem. The influential book, Design Patterns by Gamma, Helm, Johnson, and Vlissides, contains a description of many patterns for software design, including the ITERATOR pattern. (See [2].) Because the book has four authors, it is sometimes referred to as the “Gang of Four” (GoF) book. (The original Gang of Four were radical Chinese communists who were advocates of the Cultural Revolution. There is no apparent connection between the two “gangs” beyond the fact that they each have four members.) In this chapter, we cover five of the patterns in the Design Patterns book: ITERATOR, ADAPTER, TEMPLATE METHOD, STRATEGY, and COMPOSITE.”

These patterns may be combined to solve large scale problems. Here is one example:

Question #1b: Add an example of combined patterns (listed above) to best solve a large scale problem.

5 Categories of Design Patterns

Pattern Name

Description

Example

Iterator

Add description here.

Add short example here.

Adapter

Add description here.

Add short example here.

Template Method

Add description here.

Add short example here.

Strategy

Add description here.

Add short example here.

Composite

Add description here.

Add short example here.

Explanation / Answer

Design patterns are the strategies used for solving problems faced during software development by object oriented software developers.

1) Iterator :

Comment: This is a pattern used to access all the elements in a contained in sequential manner without knowing the exact exact internal representation of the container.

Example: Using for loop to print all elements in array.

2) Adapter :

Comment: Adapter pattern is used as a connector between two incompitable interfaces.

Example: When we want to read data from mobile memory card using laptop, we need to insert memory card into a card reader, and then insert the card reader into laptop. So, here card reader is working a s Adapter.

3) Template Method :

Comment: An abstract class is used to define ways to execute its methods. And further subclasses use these methodes as per their need

Example: An abract class used to define certain operations in games, and these operations can ve used as per need in particular games like Hockey, cricket etc.

4) Strategy:

Comment: In strategy pattern the behaviour or algorithm of a class can be changed at run time.

Example: Consider a program taking input two integers and then asks user to choose an operation to be performed out of (add, multiply and substract)

5 Composite:

Comment: When we need to to treat a group of objects is a same way as a single object, composite pattern is used.This pattern creates a class which contains a group of it's own objects.

Example: A java class used to represent employees structure in the company.