Saturday, October 12, 2019

Microservices

What do we understand by microservices?


Microservice is basically decoupling of entire application into small small services, like take example of Amazon,  in Amazon we'll have many partners like seller then we will have buyers and at the end we'll have persons from Amazon who will be managing all the applications or we'll be seeing the transactions and every other details so we will mention it as an admin. 


This is an entire application and say suppose it is written in Java so what happen is if I need to change something in buyer I need to  give an offer of 5% so what I need to do is to write the code and deploy the entire application. 


Instead of this we can use microservice based architecture where the seller will be a single application, buyer will be another application and the admin would be another application. So here what happen is if the admin is down or like if the server is down not the entire Amazon website is down. 




If admin is down people can use the buyer option or if the seller is down seller will not be able to add any further items to his store but the buyer can able to check out from his cart and or you can add anything from other sellers or which are already in the stores and if suppose I want to change something in seller and want to deploy, so I will just go and deploy this application which will not disturb admin or buyer.



Monolithic vs Micro services:






Advantages:


- Independently develop and deploy the services

- Isolation - If one service fails, the other service will continue to work
- Micro services of an application can be written in different languages
- Micro service architecture enables the continuous delivery
- Micro services are scalable and reusable
- Security monitoring will be simplified by using micro services.

Tuesday, October 1, 2019

Angular Component

We are going to learn the basics of a component. We are going to understand what exactly makes up a component and how we can add a new component to our angular application. 

A component is made up of three parts the first one is a template which represents the view this is created using HTML. It will be the user interface for your application, next we have a class which is nothing but code that supports the view and this is created using typescript.


The class like any other programming language contains data properties and methods that can be used to control the logic of the view. For example we can have a method to show or hide an element based on the value of a property. 


Finally a component also has some metadata attached to it and this is the information that angular needs to decide if the particular class is in fact an angular component or just a regular class. 






The metadata is defined using a decorator which is a feature in typescript. A decorator is just a function that provides information about the class attached to it and for component we use the component decorator so if we put together a template a class and some metadata we get an angular component. 




Now let's try to relate this to the app component that we have in our hello world angular application so let me go back to visual studio code and open the file AB component.ts at the bottom we have our class and the name of the class is AB component.


This class currently contains one property which is the title and does not contain any methods keeping it simple to this class we have the metadata attached in the form of a decorator and to be more specific the component decorator. 


The component decorator is basically a function that attaches to the class right below it and in our case it is attached to the app component class and it is this decorator that tells angular hey this is not a plain class and this is a component. 


The component decorator contains both the metadata and the template which represents the view so as part of the metadata we have a selector, a template URL and styles.


The selector is basically a custom HTML tag that can be used to represent this component when you specify a selector in your HTML. Angular renders the components template in its place.



Whats new in Angular 8

Angular 8 was released in May 2019 and  th e key features of angular 8 are as follows in brief, Differential loading Dynamic imports ...