Debug express typescript projects in VS Code with watch and live reload
Posted on April 6, 2022
| 3 minutes
| Arpan Vaidya
VS Code set up to live reload individual typescript based express apps within single repo With the advent of micro services, Many set ups have emerged to take an advantage of individual app development and deployment while sharing code between the apps. There are more than one way to approach it but the monorepo setup is the most common and most widely adopted solution to manage individually versioned apps into a single repository.
[Read More]Promises and Microtask queue
Posted on June 6, 2020
(Last modified on June 7, 2020)
| 3 minutes
| Arpan Vaidya
Promises execution order Before we dive deep into promises execution order, try to figure out the output of the following piece of code.
console.log("Hello there"); setTimeout(function () { console.log('Hello - setTimeout'); }, 0); Promise.resolve() .then(function () { console.log('Hello - Promise 1 resolved'); }) .then(function () { console.log('Hello - Promise 2 resolved'); }); console.log("Good Bye"); The answer is
Hello there Good Bye Promise 1 resolved Promise 2 resolved Hello - setTimeout Ever wondered how the javascript execution context decided to come up with this execution order?
[Read More]Mixin class in Typescript - The Good? bad? ugly?
Posted on May 24, 2020
| 3 minutes
| Arpan Vaidya
What is mixin? Typescript introduced mixin pattern via mixin classes with this push
Wikipedia defines mixin as followed
Mixin programming is a style of software development, in which units of functionality are created in a class and then mixed in with other classes.
Mixin is a composition pattern where a unit of functionality is injected in a class by a wrapper function or an object. In the typescript world, it usually contains a small class with a single behavior that wraps another class to extend the functionality or behavior.
[Read More]Book Review: Talking to Strangers
Or what we should know about building software for people we don't know.
Posted on May 1, 2020
(Last modified on May 9, 2020)
| 7 minutes
| Arpan Vaidya
Book Summary: Talking to Strangers Software construction, or any knowledge work which involves formulating something concrete out of loosely defined abstract ideas, is perhaps the most difficult endeavour for a software team. Most of the times, the final product fails to deliver and the scope creeps are frequent because a squad including product owner, software developers and everyone, thinks they understood what this user aka complete stranger wants but rarely is the case.
[Read More]Asynchronous operation in Javascript: Async/Await
Posted on September 23, 2018
(Last modified on May 2, 2020)
| 2 minutes
| Arpan Vaidya
Asynchronous programming with Async/Await: This is the second post in the multi part series about understanding and using async/await. The second part tries to cover the asynchronous programming using async/await.
Simple asynchronous function using Promise Imagine a piece of functionality that fetches the data and based on the returned result it get has to decide weather to get more information or return the current result
const simpleRequest = () => { return getSomeData() .
[Read More]Javascript Generators - 1: Introduction
Posted on June 20, 2018
(Last modified on May 2, 2020)
| 4 minutes
| Arpan Vaidya
Why we need Generators ? You may already know from /posts/2017-02-02-event-loop/ that that Javascript has an unique take on asynchronous processing and it’s never been easy to write clean succinct async code. Initially there were call backs. Need something to happen outside of execution context of javascript eventloop ? just use setTimeout and pass your callback function. Soon enough, people started abusing( and no mistake of their own as there wasn’t any alternative ) callbacks and turned it into a call back hell.
[Read More]Event Loop in JavaScript
Javascript's take on asynchronosity
Posted on February 2, 2017
(Last modified on May 2, 2020)
| 5 minutes
| Arpan Vaidya
What is Event Loop and why we need it ? There was a time when hardware resources were expensive, like “you can go broke” expensive. Developers had to manually manage the memory and do bunch of other stuff, which we take for granted today, to make sure the system works in that tiny resource requirement. People used to land on moon for 4kb-of-memory( Today you can’t even load that viral meme for that much ).
[Read More]