Browse Category: Design patterns

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
Continue Reading

Design Patterns: The Singletons Pattern

Follow the series topic regarding to Design Patterns Overview, today we will dive in to Singletons Pattern to understand clearly about it. Also checkout the design pattern series

Singletons Pattern’s definition

According to Wikipedia document:

In software engineering, the singleton pattern is a pattern in design patterns book that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.

In simple form:
A Singleton is a programming design pattern that ensures a single instance of a class across an application.

Singletons Pattern Overview
Continue Reading

Adapter Pattern: The right way

Follow the series topic regarding to Design Patterns Overview, today we will dive in to Adapter Pattern to understand clearly about this really useful pattern. If you want to know more other patterns, Let’s checkout the series of Design patterns

Adapter Pattern’s definition

According to Wikipedia document:

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.[1] It is often used to make existing classes work with others without modifying their source code.

In visualization:
Adapter pattern
Continue Reading

Design patterns: facade pattern

Design Pattern: Facade Pattern in PHP

In previous article, we already categorized the design patterns, you can check out Design Patterns Overview for more details. You also can checkout the series of Design patterns here

Definition of 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.

The main goal of Facade Pattern

  • Simplicity is the goal of facade pattern.
  • Make your code be structured then it will be easily to understand and well maintained.
  • Defines a higher lever interface that makes the subsystem easier to use.
  • Wrap a complicated subsystem with a simpler interface.

Continue Reading

Factory business logic

Factory Design Pattern Example

Factory Design Pattern are examples of creational patterns which abstract the object instantiation process. They hide how the objects are created and help make the overall system independent of how its object are created and composed.

When we use Factory Design Pattern

The Factory pattern is a good solution for the cases that the main part of the app needs to manage the objects and not create them.

  • If a class manages a shopping cart, it should deal only with shopping cart management (e.g., adding or removing products from the cart) and not be concerned with the manufacturing of those products.
  • A warehouse management class follows the quantities of items entering and leaving the warehouse but has no interest in making those items
  • A car buying agency should simply track orders and not have to also deal with the details of how the cars are made.

Continue Reading

Design patterns

Design Patterns Overview

Design Patterns: Elements of Reusable Object-Oriented Software as we know “the Gang Of Four” are the four authors of the book. They are:

described twenty three design pattern for object-oriented programming that categorized in this article. In this Design patterns series, we will provide

What are Design Patterns?

Design patterns provide solutions to common software design problems. In the case of object-oriented programming, design patterns are generally aimed at solving the problems of object generation and interaction, rather than the larger scale problems of overall software architecture. They give generalized solutions in the form of templates that may be applied to real-world problems.
The most important thing when we learn about design patterns is to understand the concepts that design patterns describe, rather than memorizing their exact class, methods and properties. Then we can apply patterns appropriately. Continue Reading