Microservices Communication Pattern

Microservice is a single application in a suite of small services. Each microservice communicates via a lightweight protocol e.g HTTP, Message Queues. In accordance with the database per service pattern, each of them has its own database. They must communicate with each other in order to access others data. Basically, there are two patterns that …

Why do we need threads along with processes?

Let’s first define what a process is. A process is an independent isolated program to which an OS gives resources, file handles, or credentials. An OS can have many processes with its own address space, heap, or stack. When processes need to communicate, they need to use coarse-grained communication mechanisms such as a socket, shared …

Isolation Levels in Transaction

As we have already discussed in the article, isolation specifies that each transaction should be executed independently of other transactions. The level specifies how much isolation can be provided to each transaction. Read Uncommitted It is the lowest level of insolation in a transaction. At this level, data changed during a transaction, which is essentially …

Transaction in database

A transaction is a unit of work that must maintain ACID properties. ACID is an acronym of Atomicity, Consistency, Isolation, and Durability Let’s look at each of them in detail. Atomicity A transaction contains a query or a set of queries. In order to maintain atomicity property, the transaction either has to execute all the …

Read Lock vs Write Lock

A lock is a synchronization primitive which limits access to a shared resource among multiple threads. We don’t need locks when only one thread is running or there is no shared resource because a lock is always acquired on a shared resource. Let’s look at what locks can be acquired. Read Lock Multiple threads can …

What are SOLID principles?

SOLID is an acronym of below five object-oriented design principles. S – Single Responsibility O – Open Closed L – Liskov Substitution I – Interface Segregation D – Dependency Inversion Single Responsibility Principle Every entity (class, method, or module) should have a single responsibility. In other words, every entity must have a single reason to …

Why Strings are Immutable in Java?

Before understanding why strings are immutable in java, we need to think about why do we make something immutable? Immutable means once created we cannot change it. The one reason that we can think of making anything immutable is synchronization when it’s shared. It’s the same reason that strings are immutable. In Java, String objects …

Difference Between Aggregation and Composition

Aggregation and Composition are basically the concepts about how to manage objects Aggregation Aggregation uses loose coupling, which means that it does not hold the actual object in the class. Instead, the object is being passed via getter or setter function. It gives the benefit that when the object of the parent class dies then the …