Design Pattern: The best way to write a code for extensive business scope

Mandanka Rajan
3 min readJun 21, 2021

In modern times, every business needs to extend its boundaries so that it might set up its own team or incorporate with other organizations. However, our software industry always ready to handle this kind of situation. The most important thing is how fast you can complete and integrate the new changes. To mitigate this, software architecture suggests various design patterns and its method.

Creational design pattern — provides various object creation mechanisms, which increase flexibility and reuse of existing code.

  • Factory Method — provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created.
  • Abstract Factory — produces families of related objects without specifying their concrete classes.
  • Builder — constructs complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.
  • Prototype — copy existing objects without making your code dependent on their classes.
  • Singleton — ensure that a class has only one instance while providing a global access point to this instance.

Behavioral design patterns — it concerned with algorithms and the assignment of responsibilities between objects.

  • Chain of Responsibility — pass requests along a chain of handlers. Upon receiving a request, each handler decides either to process the request or to pass it to the next handler in the chain.
  • Command — turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request’s execution, and support undoable operations.
  • Iterator is a behavioral design pattern that lets you traverse elements of a collection without exposing its underlying representation (list, stack, tree, etc.).
  • Mediator — reduce chaotic dependencies between objects. The pattern restricts direct communications between the objects and forces them to collaborate only via a mediator object.
  • Memento — save and restore the previous state of an object without revealing the details of its implementation.
  • Observer — define a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.
  • State is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class.
  • Strategy — define a family of algorithms, and each of them put into a separate class, and make their objects interchangeable.
  • Template Method — defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure.
  • Visitor — separate algorithms from the objects on which they operate.

Structural design patterns — explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.

  • Adapter — allows objects with incompatible interfaces to collaborate.
  • Bridge — split a large class or a set of closely related classes into two separate hierarchies — abstraction and implementation — which can be developed independently of each other.
  • Composite — compose objects into tree structures and then work with these structures as if they were individual objects.
  • Decorator — attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
  • Facade — provides a simplified interface to a library, a framework, or any other complex set of classes.
  • Flyweight — fit more objects into the available amount of RAM by sharing common parts of the state between multiple objects instead of keeping all of the data in each object.
  • Proxy — provide a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object.

I’ll provide an overview of the widely used design pattern in this article. I request you all my reader to comment with the method name which you want to learn or explore so that I will write my next post based on your comment. In addition, you may follow me that helps you to stay updated with the latest technology and news about the best practice of the software industry. The Majority of the content of this article I took from here.

I will post more articles under the series “The best …. “ to explain the most useful technique in this fast-growing era.

--

--

Mandanka Rajan

Feats to Explore, learn, adapt and share the best ways to become more successful than what I am today