Microservice is an other way of service oriented architecture(SOA). All are independent services, So we can add or remove services independently. It is valuable and practiced some architectural view. Refer my Introduction to Microservice article for more details. So, If the development team wants to adopt to Microservice Architecture, they should follow a set of best practices and use a set of reusable, battle-hardened design patterns. So, we are going to cover some important patterns in this article.
Aggregator is a basic web page which invokes multiple services to get the required information or achieve the required functionality.
Before we use microservices in web application, first we want to know what is microservices? and why we need it.
It is a single executable file (exe) for the entire application. So, it is easy to monitor, test and run the application. But the entire application have been packed into one file, So Regression testing is difficult(need to test the entire project), debugging and installation are also difficult. And it is hard to scale, in that case microservices step in.
It is a behavioral design pattern used to undo/rollback/revert the state of an object to its previous state. It has three pillers,
Originator always couples with memento and pass the state to the care taker. It should hold sufficient information to restore the previous object. …
MODERN is really subjective. i.e
2004 modern => AJAX
2006 modern => jQuery
2010 modern => Angular 1
2012 modern =>Node JS
2014 modern =>React
2016 modern =>Angular 2
2019 modern =>Deno runtime.
This is a widely used behavioral design pattern. Sender sends a request to a chain of objects to process them. Then the object in the chain will decide themselves that who will be processing the request and If one object cannot handle the request then it passes the same to the next object along the chain until an object handles it. Mainly It is used to achieve loosely coupling in the software engineering field. It means avoid coupling the sender to its receiver by giving multiple objects a chance to handle the request. …
It is an alternative way to construct a complex object step by step and the final step will return the object. The process of constructing an object should be generic so that it can be used to create a different representations of the same object. This should be used only when you want to build different immutable objects using same object building process.
We use only single line and just pass the parameters that we want. We don’t pass null value, because the builder will handle other parameters. String Builder is a good example for builder pattern.
Note : We…
Creating an object is expensive and go through several steps to create. This pattern is to copy an existing object rather than creating a new instance from scratch. We don’t use new keyword here. It allows us to hide the complexity of making new instances from the client. The copied object may change some properties only required. This approach saves resources and time. Using clone() method is one of the best way to create an object from existing objects. Object creation is expensive after a database operation. In that case, we can cache the object, returns its clone on next…
It is pattern that define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In this pattern subclasses are responsible to create the instance. It is also known as Virtual Constructor. It is one of the best way to create an instance where object creation logic is hidden from the client.
When a solution gets repeated over and over again in several projects, then someone puts a name to it and describes the solution in detail. That’s how basically a pattern gets discovered. So, Design pattern is a general repeatable solution. And It is used for commonly occurring problem in software design.
It was initiated by Gang of Four in 1994 and they published a book called ‘Design Patterns: Elements of Reusable Object-Oriented Software’. Design pattern is not a finished design to transform directly into the code, instead it is a specific piece of code (eg. template). …
It is a distributed system used to translate domain names into IP addresses. DNS returns the IP address which is specific to a domain name, the process is called name resolution. For this, IP address of the DNS server must be stored on each device. If no DNS server has been stored on the device, the one for the local router will automatically be used. It is an unencrypted protocol, So, it is easy to intercept traffic with spoofing. Normally It does not validate the IP addresses to which they are redirecting traffic.
What is spoofing :- It means deception…