You were asked to design a smart control unit for a printer. The printer can print three types of documents: pdf, MSWord, and JPG (images).The smart printer keeps the documents sent for printing in a queue. It can perform 2 types of operations on the jobs in the queue. These are:(1) Add colored frame, which displays a colored frame on the edges of the printed paper. (2) Add background, which adds some background on the printed paper. The control unit should be designed in a way that allows clients to perform any operation on the jobs in the queue. So the problem is that you have a collection of heterogeneous objects, on which you want to perform similar operations. The design also allows adding more operations upon client's needs. Which design pattern best fits the problem above? 1)Iterator 2)Command 3)Strategy 4)Visitor
You were asked to design a smart control unit for a printer. The printer can print three types of documents: pdf, MSWord, and JPG (images).The smart printer keeps the documents sent for printing in a queue. It can perform 2 types of operations on the jobs in the queue. These are:(1) Add colored frame, which displays a colored frame on the edges of the printed paper. (2) Add background, which adds some background on the printed paper.
The control unit should be designed in a way that allows clients to perform any operation on the jobs in the queue. So the problem is that you have a collection of heterogeneous objects, on which you want to perform similar operations. The design also allows adding more operations upon client's needs.
Which design pattern best fits the problem above?
1)Iterator
2)Command
3)Strategy
4)Visitor
Trending now
This is a popular solution!
Step by step
Solved in 4 steps