filmov
tv
Top 10 Design Pattern Interview Questions and Answer Creational,structural,Behavioral | InterviewDOT
Показать описание
Top 10 Design Pattern Interview Questions : Design Pattern Interview Questions :
1. What is Design Pattern ? Explain its advantages ?
A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems.
It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context. 2.Different Types of Design Patterns ?
There are three basic classifications of patterns: Creational, Structural, and Behavioral patterns.
Creational Patterns :Abstract Factory: Creates an instance of several families of classes
Builder: Separates object construction from its representation
Factory Method: Creates an instance of several derived classes
Prototype: A fully initialized instance to be copied or cloned
Singleton: A class in which only a single instance can exist
Structural Patterns :
Adapter: Match interfaces of different classes
Bridge: Separates an object's abstraction from its implementation
Composite: A tree structure of simple and composite objects
Decorator: Add responsibilities to objects dynamically
Façade: A single class that represents an entire subsystem
Flyweight: A fine-grained instance used for efficient sharing
Proxy: An object representing another object
Behavioral Patterns :
Mediator: Defines simplified communication between classes
Memento: Capture and restore an object's internal state
Interpreter: A way to include language elements in a program
Iterator: Sequentially access the elements of a collection
Chain of Resp: A way of passing a request between a chain of objects
Command: Encapsulate a command request as an object
State: Alter an object's behavior when its state changes
Strategy: Encapsulates an algorithm inside a class
Observer: A way of notifying change to a number of classes
Template Method: Defer the exact steps of an algorithm to a subclass
Visitor: Defines a new operation to a class without change
What is Builder design pattern in Java ? When do you use Builder pattern in Java ?
What is Singleton pattern in Java ?
What is decorator pattern in Java ? Can you give an example of Decorator pattern ?
Attach additional responsibilities to an object DYNAMICALLY.
What is Factory pattern in Java? What is advantage of using static factory method to create object ?A factory method pattern is a creational pattern. It is used to instantiate an object from one among a set of classes based on a logic.
What is Observer design pattern in Java ? When do you use Observer pattern in Java ?
Can you write thread-safe Singleton in Java ?["Double checked locking"]
Комментарии