Top 10 Design Pattern Interview Questions and Answer Creational,structural,Behavioral | InterviewDOT

preview_player
Показать описание

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"]
Рекомендации по теме
Комментарии
Автор

The tutorial is concentrated and good. Try to also add a live project with some examples that model real life business situations. Design patterns are nothing more than a more fancy way to avoid duplication and obtain a more elegant architecture of certain components and their interaction. Maybe also present how multiple design patterns work together to accomplish certain complex things. How do you foresee design patterns when doing TDD. What about design patterns in BDD ? Maybe do a classification of the most used design patterns. Talk about their abstract variants and when are those used for ? Focus more on the WHY, HOW and WHEN, and less on the WHAT. Definitions should be as intuitive as possible to provide learning through association rather than relying on brute forcing your memory.

ForgottenKnight
Автор

Many Thanks to you. I had a nice session and recollected overall design patterns.
i got new thing 'Double checked locking' which i never heard.

srimanrao
Автор

So much details in one place.i took a snap shot of each slide for my future reference. Thank you .. keep up the good work.

NaliniSelvam
Автор

It's good for student. However the example should be more real live project example.

aloksaxena
Автор

Nice attempt but you were all over the place. Very scattered and overwhelming to grasp.

suerayss
Автор

bro, innum neriya system design questions post panunga

abrahamwilliam
Автор

Geez man take the mic away when you sneeze or cough or whatever you’re doing that blows the speakers.

saifa