Design Pattern - Part 2
Design Pattern - Part 2
12) Command
13) Bridge
14) Decorator
15) Proxy
11) Interpreter
“Given a language, define a representation for its grammar along with an interpreter that uses the
representation to interpret sentences in the language”.
if(context.contains(data)){
return true;
}
return false;
}
}
import java.util.Scanner;
12)Command:
“Encapsulate a request as an object, thereby letting you parameterize clients with different requests,
queue or log requests, and support undoable operations”.
import java.util.ArrayList;
import java.util.List;
13) Bridge:
“Bridge is a structural design pa ern that lets you split a large class or a set of closely related classes
into two separate hierarchies—abstrac on and implementa on—which can be developed
independently of each other.”
public interface Color {
public void drawColor(String shape);
}