题目内容

A likely violation of the Demeter principle:Which method?

A. zike
B. initialize
C. get_veem
D. wurgle
E. the class as a whole
F. No Violation

查看答案
更多问题

Customers can add milk, syrup, whipped cream, or any combination of these to their coffee. Each ingredient adds to the price and adds a preparation step after brewing.

A. Template or Strategy pattern
B. Decorator pattern
C. Adapter or Facade pattern
D. Null Object pattern Proxy pattern
E. Subclass inheritance with no other design pattern

Customers who drink their coffee in the restaurant have the option of getting free refills. The CoffeeWithFreeRefill product behaves the same as a Coffee except it also has a refill() method.

A. Template or Strategy pattern
B. Decorator pattern
C. Adapter or Facade pattern
D. Proxy pattern
E. Subclass inheritance with no other design pattern
F. Null Object pattern

Alyssa would like to sell gift cards for specific coffee drinks. Gift cards obviously don't need to be brewed or prepared, but in all other respects, gift card purchases should be recorded as and behave the same as the purchases of regular drinks.

A. Template or Strategy pattern
B. Decorator pattern
C. Adapter or Facade pattern
D. Null Object pattern
E. Proxy pattern
F. Subclass inheritance with no other design pattern

Ben Bitdiddle is opening a tea shop next door, Tea or Nil, which will serve both coffee and tea. You'd like to adapt your code to also handle tea. Like coffee, tea must be brewed, prepared after brewing, and served, but the brewing and preparation processes are quite different than for coffee.

A. Template or Strategy pattern
B. Decorator pattern
C. Adapter or Facade pattern
D. Null Object pattern
E. Proxy pattern
F. Subclass inheritance with no other design pattern

答案查题题库