Micro Services

In this tutorial, we will discuss about microservices but before we go to microservices, first let’s understand why we are here? Why there is so much of hype about microservices?

Before we get into microservices, it is very important to understand:

What is Monolithic application?

A monolithic application is an application where every part of a product is a part of single application or web application and usually the data of entire application is in a single data store.

Issues with Monolithic application?

  • Source code management in source control. It means each and every project’s module exists in single solution explorer of the project. So that we face lots of difficulties to maintain the project.
  • Code and Database Deployments and rollbacks are a nightmare.
  • Extremely big team, hence management nightmare. The side effect of this horizontal teams, which makes an organization move like a sloth due to interdendence.
  • Any changes or updates to the application require modifying and redeployment of entire code.

What is Microservices?

Microservices are smaller single responsibility services. It is an approach to dividing the application into smaller, independent services. Each services have an individual specific function that communicate with other services through Apis.

Design Pattern

What is Design Pattern?

Design pattern are evolved as reusable solution to the problems that we encounter every day of programming. They are generally targeted at solving of object generation and integration. In other words, Design Pattern act as a templates that can be applied to the real-world problem.

Evolution of Design Pattern and GoF

The four authors of the book “Element of reusable Object-Oriented Software” are referred as Gang of Four.

The book is divided into two parts in which first part explaining about the Pros and Cons of Object Oriented Programming and the second part explaining the evolution of 23 classic software design patterns.

From then, Gang of Four design patterns has made a significant role in the software development life cycle.

Types of Design Patterns

There are 3 types of Design Patterns

Creational

This type deals with the object creation and initialization. This program makes the program more flexible and decide which objects need to be created for a given case.

  • Example: Singleton, Factory, Abstract Factory.. etc.

Structural

This type deals with class and object composition. This pattern focuses on decoupling interface and implementation of class and its objects.

  • Example: Adapter, Bridge.. etc

Behavioral

This type deals with communication between Classes and objects.

  • Example: Chain of Responsibility, Command, Interpreter… etc

Types of Creational Design Pattern

  • Factory Method Design Pattern
  • Abstract Factory Method Design Pattern
  • Singleton Method Design Pattern
  • Prototype Method Design Pattern
  • Builder Method Design Pattern

Types of Structural Design Pattern

  • Adapter Method Design Pattern
  • Bridge Factory Method Design Pattern
  • Composite Method Design Pattern
  • Decorator Method Design Pattern
  • Facade Method Design Pattern
  • Flyweight Method Design Pattern
  • Proxy Method Design Pattern

Types of Behavioral Design Pattern

  • Chain Of Responsibility Method Design Pattern
  • Command Method Design Pattern
  • Interpreter Method Design Pattern
  • Mediator Method Design Pattern
  • Memento Method Design Pattern
  • Observer Method Design Pattern
  • State Method Design Pattern
  • Strategy Method Design Pattern
  • Template Method Design Pattern
  • Visitor Method Design Pattern

How to call JAVA API from ASP .Net Core

public static string GetAPIResponse()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string response = string.Empty;
string token = “VGhpcyB0b2tlbiBpcyBnZW5lcmF0ZWQgYnkgVmliZXJzb2w=
“;
string URL = “https://Vibersol.com/API/GetUserDetails/”
string AccessKey = “Basic ” + token;
var content = “grant_type=Admin&username=Vibersol&password=123”;
using (WebClient wc = new WebClient())
{
wc.Headers[“Content-Type”] = “application/x-www-form-urlencoded”;
wc.Headers[“Authorization”] = AccessKey;
wc.Headers[“X-User-Agent”] = “Test”;
response = wc.UploadString(URL, “POST”, content);

}
return response;
}

Learn MEAN Tutorial – Step By Step Guide

What is MEAN ?

MEAN comprises a set of 4 technology.

  • M => mongoDB
  • E => express
  • A => angular
  • N => node

Fist we know about the Angular.

What is Angular?

  • Angular is a client-side(Browser) Framework which allows us to build Single-Page-Applications(SPA).
  • Angular job is to not only render static data like html and cs.s but also render dynamic data to the browser.
  • Angular is responsible for validating user input and sending it to the server.
  • Angular communicate with our backend with Node, Express, Mongo combination.
  • Angular provides a “Mobile-App” like user interface that means it never need to reload the page just change the parts of the page with JavaScript to Angular and therefore everything happens instantly in very reactive way.

What is NodeJS?

NodeJS is a open-source and cross-platform JavaScript runtime environment. It takes the request from the front-end application like angular. Angular could send a request to fetch the list of all the post and node reach out to the database then send back the response with all these post.

  • NodeJS is primarily used for server side scripting to build scalable network connections.
  • NodeJS often used to create RESTful API’s and microservices.
  • NodeJS executes Server-Side logic in general

What is Express?

  • Express is a Node Framework which simplifies writing Server-Side code and logic.
  • Express framework creates fast, secure and scalable NodeJS application.
  • It provide some extra feature to node to create our application faster. We can use middleware to handle request.
  • Express connect to the database like MySQL, MongoDB and other quickly.

What is MongoDB?

  • MongoDB is a NoSQL Database which stores “Documents” in “Collection” instead of “Records” in “Tables” as in SQL.
  • It enforce no data schema or relations. All data store in the form of documents or collection.
  • It easily connected to node/express(not to angular).
  • It’s a powerful database which can easily be integrated into a Node/Express environment.