Microservices and its Architecture pattern-short note

Image

Important Architecture Styles & patterns of Software Design in Microservices

Image
In software design, various architecture styles and patterns are used to solve common problems and improve the quality of software systems. There are several types of software architectures, each with its own principles and goals. Here we discuss Four popular architectural styles are Types of Important Architecture In Microservices: *️⃣Clean Architecture, *️⃣Onion Architecture *️⃣Hexagonal Architecture *️⃣Vertical Slice Architecture Clean Architecture: what is Clean Architecture: 💥Clean Architecture is a software design philosophy that emphasizes separation of concerns and maintainability. It was introduced by Robert C. Martin, also known as Uncle Bob. The key idea behind Clean Architecture is to create software that is independent of frameworks, UI, databases, and other external concerns, allowing it to be easily testable and adaptable to changing requirements. Core Principle: The core principle of Clean Architecture is the separat

GRPC VS REST

Image
🔸GRPC: GRPC (gRPC Remote Procedure Call) is a high-performance, language-agnostic framework for building remote services. It uses Protocol Buffers (protobuf) as the interface definition language and binary serialization format. It uses HTTP/2 as its underlying protocol, which provides features like bidirectional streaming, header compression, multiplexing, and more. It's designed for high-performance, low- latency communication between clients and servers. 🔸Streaming is one of the core concepts of gRPC where several things can happen in a single request. This is made possible by the multiplexing capability of HTTP/2 . Server Streaming RPC: Where the client sends a single request and the server can send back multiple responses. For example, when a client sends a request for a homepage that has a list of multiple items, the server can send back responses separately, enabling the client to use lazy loading. Client Streaming RPC: Where the c

🚀🚀Angular 16 Signal in Action With Reactivity🚀🚀

Image
What is Angular Signal? . Angular introduced a Signal as developer preview in angular 16 Before getting into Angular Signal , Angular works in away of change detection. what is Change detection and zone js role in angular? 🌊: Zone.js detects when something happens in the application. 🌊: Zone.js triggers change detection to update the application state. When change detection starts 🔥, the framework goes through all the components in the tree to verify if their state has changed or not and if the new state affects the view. If that’s the case, the DOM part of the component which is affected by the change is updated. This functionality have a significant impact on the performance of the application, Change Detection is How Angular Updates the UI when the state and app changes.This could be some user interaction or some new data changes in the app. Why Angular Signal? What is Reactivity? Making Something happen when there is a Change is Called Reactivity.

Angular 17 Features Hint

Image
Angular 17 was released on Nov 2023 Features 1️⃣ Built-in control flow. @if (loggedIn) { The user is logged in } @else { The user is not logged in } 2️⃣. Built-in for loop @for (user of users; track user.id) { {{ user.name }} } @empty { Empty list of users } 2️⃣.Deferrable views @defer { } 3️⃣.New lifecycle hooks. 🔸 afterRender — register a callback to be invoked each time the application finishes rendering. 🔸 afterNextRender — register a callback to be invoked the next time the application finishes rendering @Component({ selector: 'my-chart-cmp&#

Angular 14 and 15 Features

Image
Angular 14 Angular 14 Features Features: 🌟Angular 14 prerequisites. 1. Standalone components, directives, and pipes More Details ✅ Typescript 4.7. 2. Typed Angular forms More Details ✅ Node version 14.15.0 or later. 3.Streamlined page title accessibility. More Details

Angular 15+ New Way of Functional Router Guards

Image
🔸In Angular v14.2, angular team announced New Router API for standalone. 🔸Functional router guards in Angular allow you to define guards using functions instead of classes. 🔸This can be particularly useful when you want to keep your code concise and avoid creating separate guard classes. Here's how you can use functional router guards in Angular: 🔸Before Angular 15, We need to do Implement Guard with CanActivate and to do the logic inside the guard as class. Angular 15 below. @Injectable() export class AuthGuard implements CanActivate { constructor(private authServices: AuthService, private router: Router, private alertify: AlertifyService) {} canActivate(): Observable | Promise | boolean { if (this.authServices.loggedIn()) { return true; } this.alertify.error('You need to be loggin to acces this area'); this.router.navigate(['/home']); return false; } } Activate in guard

ValueObjects in DDD

In this example, Money is a Value Object representing an amount of money with a currency. Here's why it's a Value Object: public class Money : IEquatable { // Properties public decimal Amount { get; } public string Currency { get; } // Constructor public Money(decimal amount, string currency) { Amount = amount; Currency = currency; } // Equality check public bool Equals(Money other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Amount == other.Amount && Currency == other.Currency; } public override bool Equals(object obj) { return Equals(obj as Money); } public override int GetHashCode() { unchecked { return (Amount.GetHashCode() * 397) ^ Currency.GetHashCode(); } } } Immutable: The properties of Money are read-only, and there ar

Microservices DDD Design Pattern

Image
Domain-Driven Design (DDD) is an approach to software development that focuses on understanding and modeling the domain of a problem to create a shared understanding between technical and non-technical stakeholders. DDD emphasizes collaboration and communication between domain experts and developers to build a rich and accurate model of the problem domain. Here are some key patterns in Domain-Driven Design: In Domain-Driven Design (DDD), entities and value objects are both core building blocks used to model domain concepts, but they serve different purposes and have different characteristics. Entity An Entity is a distinct, identifiable object that has a continuous existence. It is defined by its identity, which remains constant throughout its lifecycle. More Details Value Object A Value Object is an object that describes some characteristic or attribute but has no conceptual identity. They are immutable and can be shared.In C#, you can