Design Patterns Interview Questions

Design Pattern and software design is one of the most essential part of any programming interview whether you are going for Java interview, PHP interview or C# interview and so on. A good programmer are usually a good architecture designer as well as they know how to break down the issues to piece of code. If you have not researched about design pattern, don’t so worry but we recommend you should take a look on Design Patterns Overview. Anyway this article is about some Design Patterns interview questions from beginner to expert as normally questions start with some basic concept of subject then later they continue based on further discussion and your answer.Design pattern interview questions

Follow other post in design patterns series

1. What are Design Patterns?

Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.

2. What is Gang of Four?

The Gang of Four are the four authors of the book, “Design Patterns: Elements of Reusable Object-Oriented Software” in 1994. They are:

3. What is Abstract Factory Pattern?

The abstract factory pattern is the pattern used to provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Take a look on Factory Design Pattern Example to understand more.

4. What is Singleton Pattern?

The singleton pattern is one of the simplest design patterns: it involves only one class which is responsible to instantiate itself, to make sure it creates not more than one instance, in the same time it provides a global point of access to that instance

Check out Post to Post Links II error: No post found with slug "singletons-pattern-overview" then you will know about it.

5. What is Facade Pattern?

The facade pattern is a software design pattern commonly used with object-oriented programming. The name is by analogy to an architectural facade. A facade is an object that provides a simplified interface to a larger body of code, such as a class library.

This is one of the most useful pattern Design Pattern: Facade Pattern in PHP. Let’s check out

6. What is Adapter Pattern?

In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used from another interface. It is often used to make existing classes work with others without modifying their source code.

Visit this page if you don’t know about Adapter Pattern: The right way

7. What is MVC Pattern?

MVC Pattern stands for Model-View-Controller. This pattern was invented by smalltalk programmers in 1979.

  • Model: Model objects encapsulate the data specific to an application and define the logic and computation that manipulate and process that data
  • View: View represents the visualization of the data that model contains.
  • Controller: provides model data to the view, and interprets user actions. It keeps view and model separate.

8. What is Anti Pattern?

The term anti-pattern is used to describe a poor programming practice that leads to ineffective code. So we need to apply design pattern appropriately.

9. What is the disadvantage of using Singleton Pattern?

  • Singleton classes cannot be sub classed
  • Singleton hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes.
  • With more and more classes calling getInstance(), the code gets more and more tightly coupled, not testable and hard to change.

10. What are the differences between analysis patterns and design patterns

Analysis pattern are for domain architecture while design pattern are for implementation mechanism for some aspect of the domain architecture. In other words, analysis pattern are more high level and more functional oriented.

11. What are the differences between Factory and Abstract Factory Pattern

The Factory pattern produces product implementations while Abstract Factory Pattern produces interface to create family of related objects. In other words, Abstract factory is a set of Factory methods.

Conclusion

Above are just some common Design Patterns interview questions you may have. If you have some other interesting questions, don’t hesitate to leave it in the comment box below.

Related Post

Leave a Reply