Ben Lesh Profile picture
#RxJS core team lead. Dad. Art Lover. Literally not paid by the observable, or for anything RxJS-related. My views actually belong to @_jayphelps. he/him
Apr 2 7 tweets 1 min read
🅰️Angular folks,

Some Signals vs Observables info...

1. Use signals for state management, not observables.
2. Use observables for cancellation and other event coordination.
3. DO NOT TRY TO USE SIGNALS LIKE RXJS. It's a bad/silly idea.

They are complimentary technologies.

1/
What I mean by number 3 above: Any library that is like "let's debounce and switchMap signals" is a misguided idea. That's really, deeply not what they're for. Signals may have a simple API but they're much more complicated than observables in a variety of ways.

2/
Sep 9, 2021 6 tweets 1 min read
Folks, it's really important to me right now to remind everyone (myself included) that the folks that are pushing forward with the Hack Pipeline proposal REALLY ARE trying to do what they think is best for JavaScript at the web. We don't all have to agree, but please be civil. /1 As an open source author (and person with honestly too many followers on twitter), I should never forget that it's stressful and harmful to drum up angry mobs of people. /2
Sep 8, 2021 4 tweets 2 min read
Okay, trying to be more fair about this, since my last examples were from a library that is using functional pipe composition. Here are some more "general" case examples: F# vs Hack pipeline. (Poll in next tweet) // F# Pipeline - Composition Example  const pow = (exp) => (// Hack Pipeline - Composition Example  const pow = (exp) =>// F# Pipeline - Explicit Example  const pow = (arr, exp) =>// Hack Pipeline - Explicit Example  const pow = (arr, exp) Given the above example, comparing explicit vs composed functions, which pipeline operator do you find preferable?
Sep 7, 2021 6 tweets 2 min read
Given the two pipeline proposals below, which do you find preferable? (See poll in next tweet) // RxJS with the F# pipelin...// RxJS with the Hack Pipel... Given the two examples above, which do you find more preferable?
Jun 4, 2021 15 tweets 5 min read
This has come up a few times at work so:

Inputs, buttons, and form submission in the browser.... A little-understood tragedy in many parts, a thread:

(Yes yes, there are no labels or anything in this HTML, I'm keeping it down to the necessary parts)

🧵#WebDev <form onsubmit="alert('submitted')">   <input type The first thing to know is that if you have one, and only one TEXT input (and that's important), hitting ENTER inside of that text input will trigger form submission. <form onsubmit="alert('submitted')">   <!-- hittin
May 17, 2021 7 tweets 2 min read
When I first flew out to interview at Netflix in 2014, I didn't think I was qualified. I found myself -- an overweight, 37 year old father of 3, with no college degree -- sitting next to two bright, young fresh college grads. One from MIT, the other Carnegie Melon. One of them was into Linux kernel development. I couldn't even imagine what that entailed. I remember dread setting in. Feeling like a dopey old man flying out to the land of young geniuses. I couldn't understand why Netflix wanted me there to interview.
Mar 19, 2021 4 tweets 1 min read
Literally none of these things existed when I first taught myself web dev. Well, Google did, but it wasn't very good.

I was poor, libraries didn't have new enough books, so I loitered in bookstores and took notes (with paper and pencil). I asked questions on forums. I did buy a couple of reference manuals by O'Reilly. I liked the reference books the best because they lacked opinion, and mostly just had facts about different APIs.
Apr 29, 2020 6 tweets 2 min read
Short rant:

async/await is cool, but it is FULL of footguns. It makes complicated problems look so simple you can fall on your face and not see it.

I submit to you all that this is bad code waiting to happen.
(Shown in "react-esque" psuedo code)

1/ async function clickHandler() {<br />
  const data = await getData();<br />
  // update the view<br />
  setData(data);<br />
}<br />
<br />
<button onClick={clickHandler}><br />
  gotcha<br />
</button> The above example assumes that `getData()` will somehow always magically respond in a predictable time period.

But what happens if sometimes it responds quickly, and sometimes it's very, very slow? What happens when the user clicks the button faster than that?

2/
Apr 22, 2020 8 tweets 2 min read
In my view, there are three top-level code paths:

1. The happy path.
2. The error path.
3. Cancellation.

Most people only think about 1, and deal with 2 when they "have to". 3 is almost always an after thought. This is so pervasive, it's even in language design. Most languages do not have a unified cancellation type or semantic. At best it's a hodge-podge of happy-path mechanisms that are leveraged to make that path function. Almost always manually.
Oct 22, 2019 8 tweets 2 min read
1/ Me at age 38, versus me at age 42.

Today is my birthday. I'm not posting this just to show off. (I mean I am proud) I'm posting this because I am hoping it inspires somebody to do something to take care of themselves consistently. Me, age 38, very overweight, winning an Emmy for best double chin. Okay, really I'm just holding an Emmy I didn't win.Me, age 42, standing in the gym on the way out the door, after asking the lady that works at the gym to take a picture. (Sorta embarrassed) 2/ it doesn't matter to me if it is trying to get more fit, spending more time with your kids, pursuing some endeavor you've been putting off. For my birthday, just do something for yourself. Make a small change and be consistent enough for it to snowball into a big change.
Jun 23, 2019 11 tweets 2 min read
After a bad experience on Twitter a while back, about 80% of the time I type up a tweet, usually to say something fun, help, or even encourage someone else, I delete it and walk away, out of fear that something I don't see in it will offend someone. I limit my in-person interactions at conferences and the like as well. There, I try to hide among people who know me and that I feel I can trust.
Apr 25, 2019 15 tweets 6 min read
@getify So my wife used to be a recruiter. Here's what I can tell you: Most of these recruiting firms require recruiters to hit specific numbers of contacts made, emails sent, etc, _or you're fired_. On top of that, you're paid very low because most of it is commission. @getify .. combine that with the fact that you're reaching out to a group of people who have very little basis in reality for what the employment situation looks like in America for the average person. Entitled, wealthy, people that treat you like garbage consistently.
Mar 27, 2019 6 tweets 4 min read
I'm watching @aaronhma, age 10, speak about @TensorFlow at @moderndotweb! He is a frequent guest at these events, now a speaker. This guy is awesome! Excellent speaker. 💯 This guy has an @angular + Tensorflow app that identifies handwritten numbers! 🤯 Age 10!!!
Feb 5, 2019 5 tweets 2 min read
I see "async" and "sync" get misused or misunderstood a lot.

What's "asynchronous" or "synchronous" is always relative to a context. "asynchronous" really just means "executed later", but later relative to what? Consider the following... (thread) Here we have a simple queue mechanism.

If you call `schedule(fn)` it will enqueue the function `fn`, and start flushing the queue, executing queued functions one-by-one until it's empty.

This is a common method for breadth-first traversal (another topic)

Now let's use it...