Photo by Zachariah Aussi on Unsplash

Javascript has really conquered the world of development, most cutting-edge technologies have been implemented in it. Projects like nodeJs, React and Angular are being adopted significantly, not just stop there but debate upon which is better.

One key aspect that’s common to all such frameworks is javascript in general. No matter how complex these frameworks are they are a javascript library, and this blog is an attempt to shed some light on javascript and event loop in detail.

TL;DR Event loop is a semi-infinite loop, polling and blocking on the OS until some in a set of file descriptors are…

Photo by Francesco De Tommaso on Unsplash

Back story: Back in 2013/12 when React was released it was widely popular because of virtual DOM. DOM updates are time-consuming and synchronous and so multiple updates to DOM are to be batched. So react updates DOM in two phases render and commit.
The render phase is to understand what has changed, as in if DOM properties are updated or new nodes are added, and so on. So react parses through all the DOM nodes and constructs a JSON object, which is virtual DOM. I’ve abstracted the process of reconciliation into a single line, I’ll write more about this in the…

Photo by Ivan Bandura on Unsplash

Separating the construction of a complex object from its representation so that the same construction process can create different representations.

I’ll be referencing to factory in this article, below links should help understand what a factory is.

Sometimes the creation of an object can complex, it could involve multiple steps. Let's take an example of a construction business, there’s usually a contractor who is responsible for the following:
1. What’s the design of the house?
2. What kind of materials to choose?
3. Define steps to build house.
4. Orchestrate steps one by one.
5. …

Photo by Mark König on Unsplash

Before continuing, I strongly recommend getting a good grasp of the Factory pattern.

In factory pattern, we have an abstraction for creating new objects using a factory. A factory can create a family of related products. Creating related products makes sense, but it could go out of hand, what if you want to mix and match these products? Well, the answer is Prototype pattern.

Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype.

Let’s consider the following factories:

We have three car factories: Ford, Ferrari, and Tesla. By applying…

Defines an interface to create products in superclass, but let the subclass decide the type of object.

A general thumb rule: create an interface before implementing any logic. So in factory pattern, we define an interface that specifies the superclass of the objects that’ll be created. Concrete factory decide which concrete objects to create based on the superclass.

The key take away from this pattern is to not instantiate objects in your app logic but to offload it to some class, factory in this case.

We’ll take a step back and look at why and how of a factory pattern.

Bridge to connect two places or ideas in this case.

Decouples abstraction from implementation so that both can vary independently.

Breakdown of definition: Abstraction is an idea and is likely to change, if your implementors are closely associated with any abstraction, implementations will have to re-implement to incorporate these changes.

Design patterns always advocate SEPARATION OF CONCERNS, a thumb-rule for extendable code.

Let’s consider the following Car hierarchy:

Simple inheritance

This is a pretty simple design and we are only concerned about implementing speed function. Ford and Ferrari roar in their own unique styles which is represented by system.out.println.

This design works for most cases but let’s say we needed…

Since the raise of webRTC technology many apps have been providing video-call which is pretty amazing. Developers all over the world have been building POC to test out. There’s not much in depth knowledge as to how things work under the hood, results in uncertain behaviour of the apps.

We first need to understand is that WebRTC technology uses UDP to commence communication instead of TCP. To quickly understand the difference between TCP and UDP is “TCP packets send acknowledgement to the sender and UDP doesn’t”. This makes UDP best candidate for video calling.

Many of us are used to…

In the recent years many applications have been implemented in nodejs stack and its no wonder given the scalability, so lets look into a few real-world problems and tools to solve them.

Its so easy to setup nodeJs isnt it, write an index.js with some basic js in it and run node index.js

But doing so is not enough when it comes to production environments. Node is designed to use multiple cores on your system and with not much configuration your application will only use single core for processing. …

Uday Reddy

Programmer | Starup/Farming enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store