Eyas's Blog

Occasional musings on software development, tech, the Middle East, and anything else.

Observables, Side-effects, and Subscriptions

My previous articles on using AsyncPipe and data refresh patterns in Angular hint at some common anti-patterns dealing with Observables. If there’s any common thread in my advice, it is: delay unpacking an Observable into its scalar types when performing logic you can rewrite as side-effect-free, leaving code with side-effects for subscription callbacks and other downstream logic. My two…

Read more →


Data and Page Content Refresh patterns in Angular

Part of why I recommend using RxJS Observable s all the way through in Angular TypeScript code, and only unpacking them at the closest point to where the UI is declared (often using the | async pipe) , is because it makes other transformations on an Observable available and convenient. Two such examples include retry and refresh logic. Two common reasons to reload/refresh data being displayed…

Read more →


Use AsyncPipe When Possible

I typically review a fair amount of Angular code at work. One thing I typically encourage is using plain Observable s in an Angular Component, and using AsyncPipe ( foo | async ) from the template html to handle subscription, rather than directly subscribing to an observable in a component TS file. Subscribing in Components Unless you know a subscription you're starting in a component is very…

Read more →


What, other than hypocrisy?

Close to half a million Syrians have died in the Syrian Civil war since 2011. In Aleppo alone, since 2012, over 100,000 Syrians have been killed. As of 2015, the UN puts the estimate of civilians killed by the Syrian regime at 250,000. Other estimates range from 150,960 to 470,000. ^1 More Arabs have been killed by Bashar Al-Assad since 2011 than by Israel since 1948. More Arabs have been killed…

Read more →


A fifteen year-old lesson from New York

Reading Gloria Steinem’s My Life on the Road gave me many treasured lessons. Many are relevant on election years. One is especially relevant on the heels of the 15th anniversary of the 9/11 terrorist attacks, and particularly during an election year where fear and Islamophobia are on the ballot. As a large portion of Americans react to fear of terrorism and religious-inspired radicalism with…

Read more →


123413