tag:payments.posthaven.com,2013:/posts Experiments in managing perfectionism 2020-09-20T17:03:47Z tag:payments.posthaven.com,2013:Post/1583103 2020-08-11T01:03:00Z 2020-09-03T05:00:00Z RC W1D1 - Recommit yourself to lifelong learning

Day 1

When I first picked up Python, everything was new, everything was fun. Somewhere along the way work happened. I became more efficient at solving problems, by cherry-picking the things that are 'important'.

It's my first day at Recurse Center. Now's a good time as any to switch that off momentarily, and explore a bit more. To paraphrase Dave, one of the co-founders, it's time to "recommit yourself to lifelong learning".

I'm also taking this chance to try out blogging. I've tried it a couple of times, which have mostly failed on the back of perfectionism (including the one that resulted in payments.posthaven.com).

Content: Develop your potential

While I haven't created much content, I've collected quite a bit over the years. I'll include them here, starting with Justine Musk's wonderful answer to the question "Will I become a billionaire if I am determined to be one and put in the necessary work required?".

https://www.quora.com/Will-I-become-a-billionaire-if-I-am-determined-to-be-one-and-put-in-the-necessary-work-required

Ask yourself what you have the potential to offer that is so unique and compelling and helpful that no computer could replace you, no one could outsource you, no one could steal your product and make it better and then club you into oblivion (not literally). Then develop that potential.

]]>
tag:payments.posthaven.com,2013:Post/1583104 2020-08-12T00:53:00Z 2020-09-05T00:16:08Z RC W1D2 - The aspiring polyglot full stack developer
On learning new things

Prior to RC, my exposure had largely been Python and the back end. In the spirit of learning new things, I wanted to learn other languages and the front end.

I curate my Twitter bookmarks lovingly. As a project idea, I thought it would be useful to build a web app to extend its functionality. Suppose I'm logged on to Twitter on one browser tab, my web app in a different tab piggybacks the existing auth to get (and later manipulate) my bookmarks.

Taking a closer look, I discovered Twitter's API doesn't have a /bookmarks endpoint. I could use Postman to get the necessary tokens and spoof the web request. Perhaps v1 won't be the most user friendly of apps.

This discovery prompted me to commit to learning "how the browser works", which alas I only got as far as a Google search. The shiny object of the day? Compiling Rust into WebAssembly. I've been curious about WebAssembly hearing how it makes web apps run as fast as native apps, say at Figma. Well... I guess this still fits in the theme of 'the front end'.

Content: Design of Go

Carrying on with my practice of padding up my blog posts with other content (and the theme of 'other languages'), enclosed below is Rob Pike's talk on Go at the SPLASH 2012 conference (link to video here, not as detailed but tad easier to follow).


I had a bit of time between my previous role and RC, which I spent looking into Go. I was fascinated to learn various tools we used in production for Python (Bazel to avoid circular dependencies, Jenkins for cross compiles, yapf for formatting, futurize for upgrades, mypy for types) comes built in into Go. Having spent considerable time migrating Python 2 to 3, gofix seems magical.
]]>
tag:payments.posthaven.com,2013:Post/1583340 2020-08-13T00:49:42Z 2020-09-03T15:35:11Z RC W1D3 - Are computers making society more unequal?

Events

I committed to attending all events in the first week. It's Day 3. I'm wiped out.

Today I added OS and compilers to the list of things to play around with. I was also reminded of a command line course I started in the past but only got half of the way through - it's going on the list...

Content: Technology and inequality

Featured content for today is an insightful Tyler Cowen interview in the New Yorker titled "Are computers making society more unequal?". Feel free to ping in case there's a paywall.

https://www.newyorker.com/business/currency/are-computers-making-society-more-unequal

It's a reminder that it's a privilege to be able to continually work on self-development. Thank you RC for bringing us together.

]]>
tag:payments.posthaven.com,2013:Post/1583534 2020-08-14T00:57:29Z 2020-09-03T04:08:00Z RC W1D4 - Advice for data scientists

Twitter API

It's very convenient how a HTML/CSS/JS project on repl.it is automatically hosted, so there's no need to explicitly set up a back end (Hello World example here, viewable here).

I've been wanting to play around with Twitter's API, and thought setting up the client JavaScript to make the API call keeps things simple. Annoyingly .env files for HTML/CSS/JS projects get exposed and the more interesting parts of the API is behind the auth.

OK so I'll need my own back end. It turns out this is not too complicated. I stitched together a minimal Flask web server that dumps the response in the HTML (project here, viewable here).

Content: Data science

Today I also presented on applying machine learning to payments use cases - this flows nicely to the content of the day.

https://multithreaded.stitchfix.com/blog/2015/03/31/advice-for-data-scientists

I came across this Stitch Fix blog post when I was first interviewing for a data science role. The advice to choose (or perhaps, give considerable weight to) a company on whether data science makes-or-breaks the business is fantastic - if it's any one article I'd recommend on the topic, it's this.

]]>
tag:payments.posthaven.com,2013:Post/1583708 2020-08-14T22:33:33Z 2020-09-20T17:03:47Z RC W1D5 - Think clearly from first principles

Content: End of the énarques

I spent a summer in London, staying in Holborn. Every weekend I would walk over to the Royal Opera House to pick up a complimentary copy of the FT Weekend. Reading the cover article would be the highlight of my week.

The articles featured these days don’t seem to be as hard-hitting as they used to be; fortunately I managed to save up my favorites. Top of the list is an article by Jo Johnson on ‘the end of the énarques’. It’s no longer available on the FT (and nothing pops up on Google), so I’ve enclosed the article below.

Content: Goldberg Variations

Since we’re heading into the weekend, let’s include even more content. I came across Glenn Gould’s masterful performance of Bach’s Goldberg Variations in Walter Isaacson’s biography of Steve Jobs. Comparing the 1955 version (his first recording) with the one in 1981 (his last) is truly inspiring. It's a meditation on the passage of life.

Content: Jiro Dreams of Sushi

On the theme of achieving mastery, I’m reminded how Bradfield School of CS had a framed picture of Jiro on its walls. I learned a lot from the classes at Bradfield, but perhaps the most valuable lesson was a constant refrain from the instructor Oz telling us “think clearly from first principles”.

Nix

Getting back on topic i.e. RC, I looked into rebuilding my dev environment with Nix today as the issue with macOS Catalina has now closed. For context, Nix here is just the package manager (vs NixOS or the Nix language).

Nix lets you build environments in a declarative way. You write all the packages you need in a shell.nix file to create your environment. When you have a new machine, simply use the same shell.nix file and it’ll recreate the same environment. Another plus is much easier rollbacks.

On the flip side the Catalina issue is now closed because there’s a workaround, but this involves partitioning your drive. It was relayed to me how this can be "quite painful”. Also “the learning curve is really intense” when installing something that’s not in nixpkgs.

Since I’m juggling a few things, maybe rebuilding my dev environment can be pushed back a bit. It makes me wonder what things will be like further down the road when we have ARM MacBooks...

Week 1

I’m pretty spent from attending lots of events in the first week, didn’t do that much coding today and doubled down on more events - mathematical thinking, software design, ML theory. Presentations at 4 pm ET marks the end of the week quite nicely.

What can I say? Week 1 of RC has been a blast! It’s affirming seeing the diversity of backgrounds and knowledge. As a self-taught programmer, this week helped illuminate how the path towards mastery is not linear. It’s multi-dimensional.

Content: The Alchemist

I’ll end this post with one more piece of content. There are a few books that I’ve read and re-read, especially in moments of self reflection. I especially enjoy Paulo Coelho’s The Alchemist for this purpose, and particularly this quote:

"What is the world's greatest lie?" the little boy asks.

The old man replies, "It's this: that at a certain point in our lives, we lose control of what's happening to us, and our lives become controlled by fate. That's the world's greatest lie."


]]>
tag:payments.posthaven.com,2013:Post/1584448 2020-08-18T01:00:30Z 2020-09-20T17:02:06Z RC W2D1 - Work hard

Twitter API

It’s Open Source Week at RC! Today I attended a few events to kick off the week, and spent time closing the circle on things I started looking at last week.

First, the Twitter API. The API doesn’t have a /bookmarks endpoint, so instead I looked at the /friends endpoint which returns the list of users you follow. The idea is to find new users to follow i.e. a ‘user recommender’. The algorithm I used was:

1. Find all users I follow (let’s call this group A)
2. Find all users these users follow (group B)
3. For every user in group B, count the number of users in group A who follow that user

I follow 291 users, so the maximum number of ‘votes’ each user in group B can get is 291. While this seems simple, there’s a rate limit of 15 API calls every 15 minutes for that endpoint i.e. 291 calls takes about 5 hours. In descending order of votes, the top 3 are:

1. Elon Musk (116 votes)
2. Barack Obama (110)
3. Bill Gates (105)

WebAssembly

The second item I looked at last week was WebAssembly. I can’t help but find it amusing how this optimization looks to shave off milliseconds off a job that takes 5 hours...

The simplest way to run WebAssembly I found was actually out of the browser with Wasmtime (Rust example here, Python here). It probably makes sense to revisit running in the browser once there's more sensible use case, or at least after the events this week.

Content: Wisdom beyond your years

Re: extra content, I absolutely adore this post Sam Altman created when he turned 30. The wisdom here is way beyond his years.

https://blog.samaltman.com/the-days-are-long-but-the-decades-are-short

On work: it’s difficult to do a great job on work you don’t care about.  And it’s hard to be totally happy/fulfilled in life if you don’t like what you do for your work.  Work very hard—a surprising number of people will be offended that you choose to work hard—but not so hard that the rest of your life passes you by.  Aim to be the best in the world at whatever you do professionally.  Even if you miss, you’ll probably end up in a pretty good place.

]]>
tag:payments.posthaven.com,2013:Post/1584749 2020-08-19T00:43:09Z 2020-09-20T17:00:51Z RC W2D2 - Be a chef

Open source

I started taking a closer look at open source projects today, starting with urllib3. I've used it before, it's in Python and a fellow RC batchmate Andrey is a maintainer.

The issue I focused on involved type checking, so I spent a bit of time on a mypy refresher. In my previous role I had to make the existing py2 codebase compatible with py3, which means introducing lots of type comments. TIL type stubs can only be used to check clients of the stub, but not the code itself.

I also had a quick look at Kubernetes. I've used it before, it's a chance to practice my recently-acquired Go skills and there'll be a presentation on it later in the week. Fine, it's also the hottest thing right now...

I was expecting a large group of maintainers, I wasn't quite expecting this large. There's a set of videos for new contributors. There's even an agreement you have to sign before contributing - gives me the same feeling as signing an NDA to hear a startup idea.

Content: Be a chef

Following up the brief discussion on Jiro last week, Oz wrote this excellent piece on why you should use (the developers analogue of) a chef's knife and not a Thermomix.

https://blog.bradfieldcs.com/cutting-through-to-what-matters-48baf397806f

That summer at culinary school continues to pay dividends.

]]>
tag:payments.posthaven.com,2013:Post/1585064 2020-08-20T03:57:22Z 2020-09-20T16:59:54Z RC W2D3 - Economic empowerment

On writing

I'm very happy to have blogging be sustained as a daily practice, and amused how expectations contrast against reality. I expressed to a friend:

I started a blog to write about the stuff at RC. I'm a perfectionist when it comes to writing, so worried at how it comes across. Then I learned what I imagine a lot of startup founders and writes [sic] encounter - it's people caring too little rather than too much is the problem.

I was similarly worried about my first comment for an open source project, made available to the whole world. I guess it's a bit like going to a party and worried how people think of you, when in fact most are too worried what others think of them.

Elixir

The day kicked off early with an event with José Valim, the BDFL of Elixir. I came away thinking how Elixir was inspired by Clojure but built on top of the Erlang VM. What I know about Erlang is (1) the language was designed at Ericsson, and (2) WhatsApp's Erlang code supported ~500 million users with ~30 engineers and the company got acquired by Facebook for ~$20 billion. Clearly something got built right.

I asked José what he thought about using Go for concurrency at the time he started Elixir. He emphasized immutability - the guarantee that data not change under our feet (achieved via functional programming) helps developers write robust concurrent software. He also said that, at the time, Go marketed itself as a replacement to C/C++ (as opposed to Java). He shared the following article which I haven't had the chance to read, but the blog itself is a real find.

José also super nice - he set aside time at the end for people who didn't get a chance to ask questions.

Content: Jack Dorsey

Now going on a tangent, my first role in San Francisco was at Square. It was privilege being in a company led by Jack Dorsey. He genuinely believed Square's products helped small business owners put food on the table, and worked hard to ensure they had access to the same tools that big businesses had. I was based in Berlin prior to moving to the Bay Area; I specifically remember reading a New Yorker profile of him, in a copy of the magazine that an ex-flatmate left behind after moving out.

https://www.newyorker.com/magazine/2013/10/21/two-hit-wonder

It's funny how things work out.

]]>
tag:payments.posthaven.com,2013:Post/1585278 2020-08-21T01:00:16Z 2020-09-20T16:59:24Z RC W2D4 - The product-minded engineer

Open source

Today's open source event was on contributing to Kubernetes (hereafter, k8s). First, I should mention how open source contributors own the copyright over their contributions. If the maintainers want to change the type of licence, say, all contributors need to agree. Thus having a agreement to assign the copyright beforehand as a requirement is actually quite sensible (so not like signing an NDA).

Julian shared his experience on making open source contributions, and he's clearly into k8s. Given the number of different areas, he suggested choosing between them by first information-gathering - attending the meetings and following conversations on Slack to get a sense what the issues are. Plus k8s has lots of clients in different languages, so you can contribute even if you're less familiar with Go. Listening to his suggestions definitely makes contributing more approachable.

WebAssembly

I had planned to spend more time with urllib3, then realized I was hosting the Front End Hack and Tell. Conveniently getting WebAssembly to run in the browser had been elusive, thus something to hack on. It turns out the instructions missed out including the edition to the Cargo.toml file (source here). The package will compile with the change, and running it in the browser simply requires a web server be set up.

It's not clear to me why a web server is needed (since it's just importing a set of instructions), but repeating this for my rocket game from last week got it to run on repl.it - it's playable here (repl here)! Navigate the rocket with arrow keys and shoot with the space bar. The rocket game was featured in David Beazly's mind-blowing talk, where he livecodes a WebAssembly interpreter in Python from scratch.

Content: Product management

The extra content last week was on data science, this week we feature product management.

https://blog.pragmaticengineer.com/the-product-minded-engineer

At the end of the day, we use software to solve business problems. The better we understand the context of the problem, the more impact our solution will have.

]]>
tag:payments.posthaven.com,2013:Post/1585577 2020-08-22T00:59:16Z 2020-09-20T16:57:03Z RC W2D5 - My first open source contribution

Open source

I made my first open source contribution! I have the perfect gif to celebrate.

I used to think that you become a better developer primarily through work experience. I've since recognized a number of similarities with open source - reading through an existing (and potentially large) codebase, a collaborative review process, making the code production-grade (via suite of build, test and style checks). I imagine iteration cycles are broadly faster in a work setting, though this also varies greatly between companies.

While a professional role provides steady income, open source offers interesting compensation models. Andrey focuses on work where the client would agree to publishing the code as open source. He recently completed a project for Keybase, and the code can be found here.

Is open source accessible? There might be a gap going from generating Fibonacci numbers to contributing to a production codebase, but perhaps the point here is that the gap is smaller than what most people imagine. It's certainly smaller than what I initially imagined.

Content: The cordon bleu kid

Now for the weekend content. I very much enjoyed this FT Weekend article about a 6-year old culinary connoisseur (enclosed below).

Content: Ever Or Not

I love how you can stroll in to your neighborhood bar/cafe in Berlin and there would be a DJ playing chill techno. A different model to getting bottle service at a Vegas EDM club with star DJs. This is for the former.

Content: Dr. Prajak Arunthong

Thais make the best ads. Try not to cry.

Content: Shoe Dog

I started listening to audiobooks on Audible at 2.5x speed, thanks to Ali Abdaal, and timely given the lockdown. Try it! You'd be surprised how you're still able to pick up (and even enjoy) the content.

It's changed my life. I'm a much more open-minded reader now, since the bar to reading is much lower. These days I particularly enjoy listening to biographies, and for this genre I highly recommend Shoe Dog by Phil Knight on the early days of Nike. The startup struggle is real, and how he stays true to his principles despite that is admirable.

But my hope was that when I failed, if I failed, I'd fail quickly, so I'd have enough time, enough years, to implement all the hard-won lessons. I wasn't much for setting goals, but this goal kept flashing through my mind every day, until it became my internal chant: Fail fast.



]]>
tag:payments.posthaven.com,2013:Post/1586764 2020-08-25T01:15:14Z 2020-09-20T16:55:47Z RC W3D1 - Fake it till you make it

On faking it

According to my Github profile, I'm an Arctic Code Contributor. Github has decided that one of my repositories is worthy of preserving for future generations, alongside the illustrious source code for Python, Go, Rust, Linux and React. My code will live in a "very-long-term archive designed to last at least 1,000 years".

The repo in question is a set of notebooks created to help people get started with pandas and scikit-learn, i.e. Python libraries for data manipulation and machine learning. I've come across references to it in French, Chinese and Korean.

At this point you might think I'm bragging. The funny thing is it all started as a bit of a ruse.

I wanted to get a job in data science. I thought presenting at a conference would be a selling point. I created a Meetup group. I hosted a social to get members. I got the members to attend my presentations. I used the presentations to get a speaker's slot at PyCon UK.

Hence the title for today's blog post. We all had a start somewhere, I'm not sure how I feel that's what's being remembered. I guess I have to work even harder now...

Open source

A thought that did not sit well over the weekend was my previous claim that open source is not as inaccessible as I initially thought. This holds true, but incomplete. My reference to the gap between generating Fibonacci and production-grade code alludes to this, but I hesitated to publish what I initially drafted. I was worried what I said would be seen as a discouragement.

It helps having worked in a production environment; some may need a bit of hand-holding to feel more comfortable with, say, the build-test-style suite. That said, I think this hand-holding process can be a helpful how-to guide. I'll ponder on this in the coming weeks.

Content: External validation

In that same post I also mentioned my fear of exposure, when in reality people tend to care too little than too much. The content for today, a Tim Urban post titled Taming the Mammoth, illustrates this beautifully.

https://waitbutwhy.com/2014/06/taming-mammoth-let-peoples-opinions-run-life.html

Being approved of by one type of person means turning another off. So obsessing over fitting in with any one group is illogical, especially if that group isn’t really who you are. You’ll do all that work, and meanwhile, your actual favorite people are off being friends with each other somewhere else.
]]>
tag:payments.posthaven.com,2013:Post/1587213 2020-08-26T01:09:10Z 2020-09-20T16:54:07Z RC W3D2 - Choose boring technology

Rust

I've been spending the start of the week learning Rust. I opted for O'Reilly's Programming Rust initially as it closely follows UPenn's CIS198 (problem sets FTW), but has since switched to the Rust book as I'm finding the style a bit more fun.

Content: Innovation tokens

I knew Dan McKinley's Choose Boring Technology post would feature on my content list. I especially love the framing of innovation tokens, and how you have to choose your battles.

https://mcfunley.com/choose-boring-technology

What caught me by surprise re-reading it today is how it feels less clear what's considered as spending those tokens. NodeJS is widely used, and I found out recently Stripe uses MongoDB for core parts of its key-value infrastructure (cue "is your database web scale" jokes).

My experience with the supposedly battle-tested Airflow hasn't been positive. We employed a number of workarounds to get it to play nice for long-running (~8 hours) ML model training on containers. We ended up partly moving to a scheduler built in-house (for model training jobs), before moving wholesale (plus ETLs) to Argo. Sure Argo is built for k8s, but the sense with Airflow was "it shouldn't be this painful"...

It's hard to disagree with the principle, as per the post, that one should always consider cost-benefit trade-offs carefully. That said it does seem a lot simpler in the abstract. Is Rust sufficiently boring?

]]>
tag:payments.posthaven.com,2013:Post/1587562 2020-08-27T02:27:18Z 2020-09-20T16:52:53Z RC W3D3 - A tool for every trade

Python

I've been spending a fair bit of time learning new programming languages recently, and I'm quite happy to have the progression be Python to Go to Rust. When learning something new, your motivation gets a boost when you can do lots of things and do it fast. From this perspective, it's hard to beat an interpreted language like Python.

Python is the main language at my previous role, and this choice makes sense given how key ML models were to the business model. Having the data science and engineering share the same language helped reduce maintenance and tooling overheads, as well as provide better context in handoffs.

The drawbacks were speed and lack of types. For speed, we had bindings to C++ on the hot path - the need for speed in an auction setting is clear. For types, we gradually introduced type comments with mypy. Why types? It's easy to introduce bugs when refactoring a codebase with limited guard rails; types are like tests that you get for free.

Go

I had the chance to learn a bit of Go just before RC, motivated partly because it's the main language for Bradfield's CS Intensive course. I was pleasantly surprised to find a lot of tooling we used for Python comes built-in in Go (brief discussion here). Go also has first class support for concurrency; the language is a popular choice for servers given the need to support multiple clients simultaneously. The syntax was surprisingly easy to pick up coming from Python.

Rust

I wanted to know more about the front end at RC, but curiously got into WebAssembly in the first week. I then found out from Tom how Rust has the best from-scratch support for compiling to WebAssembly. Another reason Rust works better is the smaller runtime - the smallest achievable binary size uncompressed from Go is ~2 MB vs ~2 KB for Rust. I'm not as familiar with the finer details, perhaps a sizeable part of that can be attributed to garbage collection in Go.

In summary, Python for fast prototyping and 'glue code', Go for concurrency and Rust for the low level stuff. Next comes lots and lots of practice.

Content: Disruptive innovation

If you've come across the theory of disruptive innovation, Jill Lepore offers an interesting and persuasive take in the New Yorker.

https://www.newyorker.com/magazine/2014/06/23/the-disruption-machine

Love how there's a reference to HBO's Silicon Valley.

]]>
tag:payments.posthaven.com,2013:Post/1587765 2020-08-28T01:09:00Z 2020-09-03T04:10:57Z RC W3D4 - Enabling business models with technology

WebAssembly

Every Thursday there's a Front End Hack and Tell - we commit to working on something front end-related at the start of the session, and circle back at the end to share what we came up with. I've been learning Rust to get into WebAssembly, but so far still ramping up on the Rust part. I learned MIPS Assembly a while ago, and thought a refresher might help me approach WebAssembly from a different angle.

This didn't quite work out as planned. The notes I have from that time assumed I'd be revising the material, as opposed to picking it up practically from scratch. Plus WebAssembly is a stack machine, not a register-based one like MIPS.

C

I spent the rest of the hacking time on Rust, but my refresher reminded me of the story of how C came about. Assembly can be thought of a set of instructions that the processor understands. For example, `add $t1, $t2, $t3` means add the values in $t2 and $t3 then place it in $t1. The tricky bit is each processor has its own instruction set, so you'll need to compose one set of instructions for a MIPS processor and a different set for an Intel x86.

The idea behind C is a language that's one layer up from the processor (so it works across both), but also sufficiently low level so things run fast. What did the creators of C do once they're done? They created Unix.

Content: Design

Having featured data science and product management, let's talk about design. First, a preamble.

Square allowed every person who had a smartphone the ability to accept credit cards. The problem was, now every fraudster could use Square to cash out stolen credit cards. Square solved this problem with machine learning. By leveraging the improved ability of ML models to flag suspicious payments, ability to accept credit cards is made accessible.

If Square is an example of a business model that becomes viable (amongst other things) on the back of machine learning, can we think about the analogue for, say, WebAssembly? Here Figma comes to mind - WebAssembly allows the functionality of the Adobe design suite to be run in the browser, but with the performance of a native app.

https://kwokchain.com/2020/06/19/why-figma-wins

What I especially loved with the post is the framing of tighter iteration cycles. Before Figma, the design process involved back-and-forth between teams via e-mail. With Figma, all design and feedback are stored centrally in the cloud, allowing more context to be retained at handoffs (analogous to the same language across teams in a previous post). I must have overlooked the reference to other cool technologies deployed on the prior reading - WebGL and CRDTs.

In summary, I learned a lot working as a data scientist in a company where machine learning makes or breaks the business. I'm curious to see how new business models becomes viable with something like WebAssembly. Though first, one needs to understand WebAssembly...

]]>
tag:payments.posthaven.com,2013:Post/1590279 2020-08-29T01:17:00Z 2020-09-20T16:49:20Z RC W3D5 - Reflecting on experience

Go

I've been spending the week on reading and writing code. I needed a breather, and made it a touch lighter today with blog posts and Youtube videos.

I found this post by Discord describing how they moved one of their services from Go to Rust. The engineering team discovered latency spikes from garbage collection, how performance issues persisted after tuning, and then decided to make the switch. Jon Gjengset in this video described how in Go, "even though concurrency is very easy, that concurrency is very easy to shoot yourself in the foot with".

Rust

I'm a believer that there's a tool for every trade, and keen to develop the sense where one would choose one tool vs another. I didn't pick this up in my earlier readings, but found out that creating a doubly-linked list in Rust is non-trivial.

Content: Farouk al-Kasim

I re-read my favourite articles before sharing them on here, some really do make me pause to reflect. This is a story of Farouk al-Kasim, who left Iraq months before the Ba'ath party took power and then prevented Norway from squandering its new-found oil wealth (enclosed below).

Content: Tango pour Claude

I remember hearing this and being very, very happy I asked for the name of the piece.

Content: BBoy Cloud

A little random I know, but why not when you have this much style.

Content: Siddharta

Re: self-reflection, I have to include Hermann Hesse's Siddharta. I love how the book highlights the importance of experience. It's tricky choosing just a single quote, but this one ties in well with being at RC to learn (or perhaps, learning through the experience of what works and what doesn't).

Has any samana or any Brahmin ever feared that someone might come and grab him and rob him of his learning and his piety and his profundity? No, for they are his own, and he gives of them only what he wishes to give and to whom he wishes to give. It is the same, exactly the same, with Kamala, and with the joys of love. Red and beautiful are Kamala’s lips, but try to kiss them against Kamala’s will, and you will not get a drop of sweetness from the lips that know how to give so much sweetness! You learn easily, Siddhartha, then learn this too: One can get love by begging, by buying, by receiving it as a gift, by finding it in the street, but one cannot steal it.



]]>
tag:payments.posthaven.com,2013:Post/1589308 2020-09-01T01:01:07Z 2020-09-20T16:48:06Z RC W4D1 - Maximize your learning

On exposure

Every Friday I would look back at the past week, but would be too wiped out to articulate it clearly. This occurrence was especially annoying last week, as it marked a quarter into the batch.

I've covered a number of different areas in the first three weeks. At a coffee chat today I realized the time so far had not reinforced my interest in any particularly, but instead exposed me to a whole new world of things. Suppose I had three choices before, how strongly I feel about each of them hasn't really changed. However I now know there are seven choices.

Rust

I'm very much enjoying Rust. I haven't done it for long so I won't say too much, but it appears the compile times can take a while. That being said, a toy implementation of generating the 10,000th prime number averages at 0.25 seconds for Rust vs 3.88 seconds for Python (code here, inspired by post here).

Over the weekend I discovered RustPython, a Python interpreter in Rust. Since Rust can be compiled to WebAssembly, the interpreter can be made to run in the browser. The FOSDEM 2019 talk can be found here.

Content: Learning at startups

I've always believed in choosing a role that allows you to maximize your learning. In the context of startups, Paul Buchheit says it best.

https://triplebyte.com/blog/interview-with-gmail-creator-and-y-combinator-partner-paul-buchheit

I would suggest thinking about joining a startup as more like going to grad school to learn. Optimize around learning when choosing a job. That’s the best thing. Then if a startup fails, you can always go back to Google and probably get paid a lot more, because now you’re actually a much better engineer than you would have been if you had stayed there like everyone else.

]]>
tag:payments.posthaven.com,2013:Post/1589710 2020-09-02T01:09:37Z 2020-09-20T16:46:58Z RC W4D2 - Let's try something different On writing

It's September 1, let's try something different. Problem - I'm usually wiped out at the end of the day to be articulate (or at least, articulate as I'd like to be). Solution - write notes throughout the day on what I plan to write about.

As an aside, my blog posts are paying off already - I referred to a previous post on the simplest way to compile Rust to WebAssembly, instead of my notes.

WebAssembly

I know. I've been going on about WebAssembly for a while now. Part of it is accountability. It's an incentive for me to learn something I keep going on about to avoid embarrassment. I do believe the responsiveness that WebAssembly provides would accelerate the shift of native apps to be run in the browser. Yesterday I realized it could be even more groundbreaking.

Sara shared what's she's reading on her blog, it's a fantastic list. The post by Andreas Rossberg on Motoko had a link to a comprehensive discussion of WebAssembly in the Communications to the ACM (direct link here), as well as the following quote.

Wasm’s main difference compared to other virtual machines is that it is not optimized for any specific programming language but merely abstracts the underlying hardware, with a byte code directly corresponding to the instructions and memory model of modern CPUs. On top of that, Wasm supports sandboxing through strong modularity and a rigid mathematical specification that ensures that execution is safe, free of undefined behaviour, and (almost) entirely deterministic. Moreover, these properties actually have a machine-verified mathematical proof!

This is in addition to Solomon Hykes, the CTO of Docker, tweeting how had WebAssembly existed in 2008, there would have been no need for Docker. Now I'm puzzled. Why isn't there more hype?

What I can say is the learning resources seem sparse. Perhaps due to things changing quickly. I had been trying to tweak a number of Hello World examples without much success, along the way discovering the myriad of tools available. I gave up and decided to work on the Programming WebAssembly with Rust book instead. The book uses wasm-bindgen for Rust-JavaScript interoperability, but it's not immediately clear how using wasm-pack in addition would help.

I've decided I'm going to come up with my own resources. Watch this space.

The advantage of going through a book is comprehensiveness. In the book I found the answer to a previous question posed - why do you need a web server to run WebAssembly? It turns out cross-scripting rules in the browser blocks reads to the file system.

Re: portability, when I compile Rust on my laptop, the base target is stable-x86_64-apple-darwin, i.e. version-processor-OS. For WebAssembly, it's wasm32-unknown-unknown, i.e. it's designed to be compile once, run everywhere!

Java

Last week I briefly mentioned portability of C, let's complete that thread. C binaries would only work for a specific OS, so C when compiled for Linux would not work on Windows. Java, however, is compiled to Java bytecode that would run on any Java VM by design. Thus Java achieves portability across operating systems, which extends to all JVM-based languages - Clojure, Groovy, Kotlin, Scala. It's the original compile once, run everywhere.

Content: Python interpreters

Coming across RustPython made me look up Allison Kaptur's post on 500 lines or less: A Python interpreter written in Python.

http://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html

I then discovered this is something she worked on while at RC!

]]>
tag:payments.posthaven.com,2013:Post/1590183 2020-09-03T01:33:25Z 2020-09-03T15:29:09Z RC W4D3 - L'esprit de l'escalier

On perfect replies

Today RC hosted Remotehost, a virtual technical talk series (and the remote version of Localhost). The theme was virtual spaces, the demos were really cool. At the chat roulette session afterwards I was paired with Mai. I had shared some feedback with Mai earlier in the week, and I mentioned how my feedback was even better articulated when I described it to someone else after.

This is such a common occurrence that there's a term for it - l'esprit de l'escalier. As per Wikipedia, it's the predicament of thinking of the perfect reply too late. Curiously, the opposite of touché.

CSS

I was paired with Julia Evans next, who described a recent focus on CSS and new features like Flexbox and Grid (also shared on Twitter here). I brought this up at the Nix OS event later in the day, to discover the latest version of CSS is Turing complete. Mind blown!

Swift

I've my hands full on new languages, but somehow keep coming across Swift and Julia (no relation) over the past week. Fun fact: Rust came out of a personal project by Graydon Hoare when he was at Mozilla, he left the project and later on worked on Swift (both are LLVM-compiled).

Julia

I first came across Julia in 2015. There was optimism on how the language would take over Python for scientific computation. It's not clear to me how much this is the case, if anything Python has grown a lot and is even taking on Excel use cases. Julia is 1-indexed; this doesn't seem like a great choice to boost adoption (adds to context switching) but making note to self to look up why this decision was made.

Content: Jeff Dean and Sanjay Ghemawat

I thought I was past hero worship. It's hard not to when it's about these two.

https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge

Didn't think I'd see this in the New Yorker. Love the prose describing systems.

]]>
tag:payments.posthaven.com,2013:Post/1590621 2020-09-04T01:15:27Z 2020-09-04T06:14:42Z RC W4D4 - The only intro you'll need

WebAssembly

I was preparing slides on WebAssembly today when I came across Lin Clark's cartoon intros. It's spectacular. I wished it was the first thing I read on the topic; it appears l'esprit de l'escalier is a thing for content too.

The background articles also provide helpful context and an easy read.

It's amazing how Google, Mozilla, Apple and Microsoft actually got together and agreed on the specs. The project has now expanded beyond the browser, with wasmtime as an independent runtime and WASI as the unified interface. In addition to its own foundation, called the Bytecode Alliance.

I do wonder, more broadly, if the technology will further consolidate the dominance that large tech companies have, or will a thousand startups bloom? Will there be a lot of end users who like it but only few love? What will the killer app be (or will there actually be one)? I was late to notice iPhones and bitcoin as platforms. I'm ecstatic at being able to follow the WebAssembly life cycle from an early stage, and see where it goes from here.

Julia

I woke up in the middle of the night, had trouble going back to sleep and actually looked up why Julia is 1-indexed (or rather, why most languages are 0-indexed). I came across this post which had the following quote.

So: the technical reason we started counting arrays at zero is that in the mid-1960’s, you could shave a few cycles off of a program’s compilation time on an IBM 7094. The social reason is that we had to save every cycle we could, because if the job didn’t finish fast it might not finish at all and you never know when you’re getting bumped off the hardware...

Intuitively it sort of make sense - if you start from zero it's a no-op vs having to do an `add immediate`. Fascinating.

Content: Dev Ops

This week's feature is Increment's post on cloud migration; it fits in nicely with a friend joining Stripe this week. I enjoyed reading how Netflix introduced planned instance failures so the on-call team can to deal with it during business hours. What's particularly impressive is the decision to implement this workflow at a time of rapid growth, forcing adoption of industry best practice at the same time as battling other fires.

https://increment.com/cloud/case-studies-in-cloud-migration

A hat tip to the marketing team who coined the term 'chaos engineering' from 'chaos monkeys'.

]]>
tag:payments.posthaven.com,2013:Post/1590982 2020-09-05T01:56:41Z 2020-09-20T16:43:35Z RC W4D5 - The ride of a lifetime

Kubernetes

I had a coffee chat with Sophia today, we got talking about Kubernetes, and I shared this comic that actually explains pretty well what the 'open source container orchestration system'.

I find it interesting how polished Google's more recent open source efforts are, with serious marketing budgets. Another project that had a huge launch (though not as much fanfare these days) was Tensorflow. I wonder if this was the lesson from having come up with MapReduce, but see the technology popularized as Hadoop instead?

Content: International Committee of the Red Cross

This article came to the top of the list on what next to feature. It highlights the delicate balance between maintaining confidentiality to help those in need, against exposing the morally-corrupt but risking access in future missions (enclosed below).

What I didn't pick up as prominently on the first reading was how the founder of Médecins Sans Frontières came out of ICRC, with the goal of creating an organization that combined relief with advocacy.

Content: Life in Mono

I can't remember where I first heard this. How apt given the song sets a wistful mood.

Content: Yassin Falafel

OK I'm going to gush about Square again, though it's a timely refrain of the theme of adapting to an adopted homeland (Farouk al-Kasim of a previous post).

Seriously, though, I was blown away when I watched this.

Content: The Ride of a Lifetime

The first book I listened to on Audible was Bob Iger's biography. In general I've not been a fan of this genre; biographies I've read in the past have narratives that go on and on about how this person was destined to be successful, all the stars align. In this one, I recall he worked hard and treated people with respect. I remember an honest and candid retelling of his rise to the top, where in no way was the path assured.

The Ride of a Lifetime and Shoe Dog - I'd love to find more books like these. I recorded this exact quote on my phone so I could replay it again and again.

A company’s culture is shaped by a lot of things, but this is one of the most important - you have to convey your priorities clearly and repeatedly. In my experience, it’s what separates great managers from the rest. If leaders don’t articulate their priorities clearly, then the people around them don’t know what their own priorities should be. Time and energy and capital get wasted. People in your organization suffer unnecessary anxiety because they don’t know what they should be focused on. Inefficiency sets in, frustration builds up, morale sinks.

You can do a lot for the morale of the people around you (and therefore the people around them) just by taking the guesswork out of their day-to-day life.


]]>
tag:payments.posthaven.com,2013:Post/1592027 2020-09-08T01:44:17Z 2020-09-20T16:40:05Z RC W5D1 - Connecting the dots

WebAssembly

Following up on the 'watch this space' declaration in last week's post, I created a Github repo on minimal examples to compile and run WebAssembly. It's designed to help consider different options - whether it be Rust or .wat as a starting point, whether to run in the browser or with an independent runtime, whether to extend with Rust-JavaScript interoperability or even go full stack Rust.

In summary, a starting point to those new to WebAssembly to construct a mental model and build on top of.

Learning WebAssembly, I've gone down the path of reading up more on how the browser works. I had actually mentioned wanting to review this in my first week of RC. This time, however, feels a lot more engaging. There's a lot more concepts to make connections with. Most importantly it feels more fun this way; it's not something looked into simply to solve a problem.

Python

Vinayak recommended a PyCon talk by Russell Keith-Magee at our coffee chat last week. I had the chance to watch this talk over the weekend. The talk was illuminating.

First, in thinking about the future of Python, one needs to think about black swan events. A black swan event is an event that is a surprise to the observer with a major effect on the world, but can be easily in explained in hindsight. This being the case, the best way to avoid being on the wrong side of a black swan event is to actively challenge one's own assumptions. The example he used was America's Cup; adhering to this principle has injected innovation into the sailing competition, breathing new life and excitement for many years to come.

Next was the framing of WebAssembly as Python's (or for that matter, all programming language's) black swan. WebAssembly started life as a research project to identify the set of primitive JavaScript operations that will execute in modern browser engines. The result of this work is the ability to run languages other than JavaScript in the browser, and do so in a fast and secure way. He's essentially throwing down the gauntlet, galvanizing the community to embrace this new paradigm instead of simply continuing to do what Python is good at. In this regard, perhaps be more like... the Rust community?

The final point that hit home was Keith-Magee's experience of burnout as a maintainer in the open source community. It's very disheartening to hear some members he had to deal with, who receive a product at no cost but somehow feel a strong sense of entitlement. I felt a renewed sense of appreciation for the open source community, and a continued desire to contribute.

It turned out the talk Vinayak recommended was the talk at PyCon AU 2019! This was also very good, and is more practical re: Python and WebAssembly. The talk covers a bit of history of WebAssembly, tools to help compile Python to WebAssembly, and the future for Python on the web. In a previous post I described how WebAssembly reminded me of Java, it's curious hearing Keith-Magee describe how "wasm has delivered on the promise Java made".

OK one last note about previous posts - I mentioned how some open source projects may need a bit of hand holding. Keith-Magee's current project is called BeeWare and has a spectacular first-time contributors page.

Content: Climbing to the top

OK. Today I'm not just overloading with previous posts but also with content. Things are slowly coming together. I'm reminded of Rainer Maria Rilke in Letters to a Young Poet.

I would like to beg you dear Sir, as well as I can, to have patience with everything unresolved in your heart and try to love the questions themselves as if they were locked rooms or books written in a very foreign language. Don’t search for the answers, which could not be given to you now, because you would not be able to live them. And the point is to live everything. Live the questions now. Perhaps then, someday far in the future, you will gradually, without even noticing it, live your way into the answer.

I'm reminded of Steve Job's Stanford commencement speech on how you can't connect the dots moving forward, you can only connect them looking backwards, so you have to trust that the dots will somehow connect in the future.

That being said, I've only just gotten started. I'm reminded of Terence Tao who, despite all his achievements, speaks modestly of the journey still to come.

https://www.latimes.com/local/lanow/la-me-ln-ucla-math-prize-20140626-story.html

You want to get to the top of the cliff. But that’s not what you focus on immediately. You focus on the next ledge just beyond your reach, because you need to do one clever thing to get up there. And then once you get there, you do it again. A lot of this is rather boring and not very glamorous. But you can’t jump cliffs in a single bound.

]]>
tag:payments.posthaven.com,2013:Post/1592297 2020-09-09T01:34:45Z 2020-09-20T16:37:31Z RC W5D2 - Relentlessly resourceful

WebAssembly

I ran a demo on WebAssembly at Presentations last Friday. I had to gloss over a number of details given the 5-minute format, so I did an extended version today.

As per Lin Clark's post, WebAssembly is "taking code written in programming languages other than JavaScript and running that code in the browser". Today I added how a major project underway is a standalone runtime so .wasm binaries can be run independent of the browser.

Re: portability, I previously used the following image with C, C++ and Rust as starting points. These so-called system languages are particularly suitable for compiling to WebAssembly given the absence of a garbage collector and minimal language runtime. I'm often confused by the term runtime, more detailed explanation here.

Re: performance, I had mentioned how WebAssembly gets to skip some execution steps compared to JavaScript. The wrinkle is the JIT currently doesn't know how to deal with WebAssembly directly, limiting speed gains (see 'trampolining' here). In fact, the main example I've come across in practice is a Figma post focusing on speed ups from smaller binaries.

Re: security, I had skipped this entirely. I provided a high-level overview of the ArrayBuffer today.

In the demo, I compiled and ran WebAssembly. I spoke a bit more on future improvements on the roadmap (see 'post MVP features' here), in particular access to the DOM and direct loading of WebAssembly modules (hence no need for a web server).

Microbenchmarks

Reviewing the feedback on the 5-minute presentation, comparing the performance of WebAssembly against JavaScript was at the top of the list. What's amusing is I wanted to learn WebAssembly but ended up having newfound respect for the V8 JavaScript engine.

I started with prime number generation, and puzzled how WebAssembly ran slower against JavaScript. Then I realized how even the Rust implementation ran slower against JavaScript. Andrey found a post on this exact comparison. My sense was the execution involved one main loop, which provided a textbook example for JIT optimization.

Moving on, I found a post on Julia microbenchmarks and thought I can simply use the tests where JavaScript wasn't as fast. Running matrix multiply, I had LLVM issues and discovered I needed to install Fortran to use BLAS. Oh boy. Post-installation I might still have been missing some symlinks, so kept this on hold for the time being.

With quicksort, Rust completed in half the time of JavaScript but I didn't have time to set this up in the browser before the presentation. I did have the n-queens problem as an example where Rust (compiled to WebAssembly) ran in half the time of JavaScript, in the browser.

When running microbenchmarks in the past, it's always been about comparing two algorithms in the same language. Cross-language benchmarks are fascinating. Do you replicate step-by-step, or rewrite in the way the language performs best (hence needing to know best practices in both languages)? If the latter, would there be more subtlety when comparing imperative against functional languages?

The other issue I had was microbenchmarking in the browser. If you set up the start and end times in JavaScript, does this mean you can't time the parsing stage (since by that point the code is already parsed)?

Content: 15 startups in 21 months

In his essay, Paul Graham isolated the key quality needed in a founder - relentless resourceful(ness). The story that often gets told is of Airbnb, where the co-founders managed to extend their runway by selling cereal during the 2008 Presidential Elections. The story I quite like is actually this one.

https://medium.com/@mecolalu/how-we-did-15-startups-in-21-months-a7008c8f2c97

There's a happy ending; I won't spoil it more than that.

]]>
tag:payments.posthaven.com,2013:Post/1592780 2020-09-10T00:59:43Z 2020-09-17T23:06:10Z RC W5D3 - Why doctors hate their computers

WebAssembly

The primary use case for WebAssembly in recent discussions is to enable languages other than JavaScript to run in the browser. The .wasm format, however, could itself become the standard in portable binaries.

Suppose we wanted to speed up Python code with Rust bindings. This requires the Rust code to be compiled to a dynamic library, i.e. .dylib file on Mac, .so on Linux, or .dll on Windows, which can then be imported in Python with a standard Python import (discussion here).

Now suppose the Rust code was compiled to a .wasm file instead. We can similarly import the .wasm file into Python with wasmtime (example here). Since the .wasm format is OS-independent, I believe we now have a portable version of the dynamic library.

Neural networks

At Square, I ran workshops on machine learning and (separately) on neural networks. I presented on the latter today at RC.

Starting with the most basic representation of a neural network as matrix operations, we build it up in stages - reducing loss systematically, capturing non-linear behavior, and introducing regularization with dropout layers. We would train a convolutional neural network by the end of the session, highlighting the improved performance when the model architecture incorporates the 2-dimensional structure of image data.

The Github repo has been updated to Python 3 and the latest Keras API. Then and now, I couldn't resist re-iterating Andrej Karpathy's advice to use model training best practices i.e. "don't be a hero".

Content: Why doctors hate their computers

At the start of my coffee chat with SengMing, I told him I was choosing between New Yorker articles to feature and had just opened a browser tab on Atul Gawande's article. SengMing then shared how much he loved the article; this made the decision easy.

It was published in 2018 but I enjoyed reading it so much more this time around. The references to pain points in the user experience were all too familiar - too many clicks, too difficult to find relevant information, too complicated to use. The issues pertaining to software development are universal except in this case, to use Sengming's words, the quality "literally affects life and death". 

https://www.newyorker.com/magazine/2018/11/12/why-doctors-hate-their-computers

Consider that, in recent years, one of the fastest-growing occupations in health care has been medical-scribe work, a field that hardly existed before electronic medical records. Medical scribes are trained assistants who work alongside physicians to take computer-related tasks off their hands. This fix is, admittedly, a little ridiculous. We replaced paper with computers because paper was inefficient. Now computers have become inefficient, so we’re hiring more humans. And it sort of works.

]]>
tag:payments.posthaven.com,2013:Post/1593076 2020-09-11T01:59:21Z 2020-09-13T19:37:47Z RC W5D4 - Engineers shouldn’t write ETLs

Classification of audio data

At yesterday's workshop on neural networks, we trained a convolutional neural network (CNN) on the MNIST dataset. The MNIST dataset consists of hand-drawn digits from zero to nine, 28 pixels by 28 pixels in size. A traditional ML model would treat each of the 784 pixels as simply another feature (hence agnostic to column ordering). A CNN would take 'snapshots' of the image, retaining its 2-dimensional structure and (in line with intuition) outperforms the traditional ML model.

There's a team at RC participating in Kaggle's Birdcall Recognition competition. The competition involves identifying the name of the bird in a birdcall audio file. I learned that converting the audio format into an image and then training a CNN on the image is a common technique. The visual representation of the spectrum of frequencies over time is called a spectrogram.

The question that arose was how to deal with metadata. I won't go into too much detail since the competition is still ongoing; we explored a number of possibilities with multi-label models. The basic premise is we have a set of models that perform equally well on the main performance metric, and we use the other labels to select the best (or perhaps, the most robust) among them. Excited to see how this plays out!

Content: Data engineering

A common functional split in a company is between data producers and data consumers. Data producers tend to be engineering team(s) that create and maintain ETLs to move and transform data from one source to another. Data consumers tend to be data science team(s) that use the data for analysis and/or modeling.

The problem with this setup relates to handoffs. Data consumers have more context on the data. When there are data quality issues, data consumer will raise this with data producers. There's usually a bottleneck: data consumers care about the data but are blocked pending a fix, data producers don't have as much insight into use cases but have to prioritize inbound requests.

The following Stitch Fix post proposes a different model, reducing instances where the problem is passed "over the wall". In this model, data producers create tools to make it easy for consumers to create and maintain ETLs i.e. "design new Lego blocks". Data consumers owns the process end-to-end, i.e. "assemble [the Lego blocks] in creative ways to create new data science".

https://multithreaded.stitchfix.com/blog/2016/03/16/engineers-shouldnt-write-etl/

This way each team can take ownership of the things they care about, iterate autonomously and move faster together.

]]>
tag:payments.posthaven.com,2013:Post/1593324 2020-09-12T01:47:27Z 2020-09-20T16:35:22Z RC W5D5 - Speed without wizardry

WebAssembly

Nick Fitzgerald has a post on using Rust compiled to WebAssembly to replace performance-sensitive parts of the JavaScript library source-map, achieving a 6x speedup. Vyacheslav Egorov responded with his own post on matching the speedups with JavaScript alone. The profiling and optimization process is detailed and very cool to see. In the third and final post, Fitzgerald discussed the end result of an 11x speedup of the Rust and WebAssembly implementation by incorporating ideas from both sources.

What I find illuminating is the process in which these optimizations are at obtained (as per the title). The JavaScript version resulted in hard-to-maintain code in the name of performance, whereas in Rust one was able to get the best of both worlds - clear expression of interest and optimal runtime performance.

Excessive allocation rates make any garbage collector (or malloc and free implementation) a bottleneck. Monomorphization and inlining are crucial to eking out performance in both Rust and JavaScript. Algorithms transcend programming languages. But a distinction between JavaScript and Rust+WebAssembly emerges when we consider the effort required to attain inlining and monomorphization, or to avoid allocations.

Rust lets us explicitly state our desires to the compiler, we can rely on the optimizations occurring. Rust's natural idioms guide us towards fast code, so we don’t have to be performance wizards to get fast code. In JavaScript, on the other hand, we must communicate with oblique incantations to match each JavaScript engine’s JIT’s heuristics.

Content: Custodians of the custard

Antiga Confeitaria de Belém is a cafe/bakery in the Lisbon suburb of Belém that's been making Portuguese egg tarts since 1837. The secret recipe of the filling is entrusted to three pastry chefs, the most recent one after 20 years in the kitchen! The quest for the perfect tart, and resisting the temptation to move to the mass market, makes for a charming story (enclosed below).

Content: Somewhere Inside

I love Tiësto, and I especially love how the track comes together with Julie Thompson's energetic vocals.

Content: POP/STARS

I've always been fascinated by new mediums that inspire new business models. Defense of the Ancients (more commonly-known by its acronym DotA) started as a fan-made modification of the computer game Warcraft 3. The game developer Valve then hired DotA's lead designer to develop a sequel to the highly popular 'mod'. DotA 2 was released for free, but monetized through sales of cosmetic enhancements for the game characters (referred to as 'skins').

To promote the shift to DotA 2, Valve organized a gaming competition for top teams from all over the world called The International. The International started in 2011 with a $1.6mm prize pool. In 2013, Valve started crowdfunding the prize pool through sales of an in-game battle pass. The prize pool grew to $3mm and was already the largest prize pool for any e-sports competition. By 2020 the prize pool ballooned to $34mm.

The featured video is actually from League of Legends, DotA's main competitor. League has Worlds, their own version of The International, as well as a talented team of composers, songwriters and producers to orchestrate cinematic music for the opening ceremony. The musical score for Worlds 2018 was performed by a virtual K-pop group called K/DA, created especially for the occasion. The song POP/STARS went viral, receiving 5 million views within 24 hours.

How did this start? To promote sales of skins.

Content: Startup

I read Jerry Kaplan's Startup from time to time, and always amazed how his struggles as a founder in the late 1980s are ever familiar today - raising money, hiring talent, finding product-market fit, dealing with partners and competitors (while constantly assessing which is which). I particularly enjoy the framing of the venture as a game.

It begins with an aspiring entrepreneur who is willing to step right up and be tested. As in many other games, the player starts with an artificial currency - in this case the stock of a new venture. The goal is simple: increase the value of the entrepreneurs' shares, because when the game is over, these can be cashed in for real money. The trick is to swap some of the stock for three resources - ideas, money and people - then use these resources to increase the value of the remaining stock.

I know. It's become a cliché. I'm still a believer.

It is comforting to know that the human impulse to make the world a better place is not today confined to the young or the foolish. It is alive and well among the people that live and work in Silicon Valley.


]]>
tag:payments.posthaven.com,2013:Post/1594299 2020-09-15T01:07:27Z 2020-09-20T16:29:46Z RC W6D1 - Grow the puzzle around you

Python

I've been a little distracted today, moving between browsers, V8 and JIT. Given the success of JIT, I'm a little surprised it's not more widely adopted by other languages, or perhaps, I just haven't noticed it before.

I also switched back to Python after time spent learning Go and Rust, in light of algorithm interview prep in the coming weeks. It took me a bit of time to adjust, but it felt liberating once I got started. It's like speaking a language without having to search for the words, allowing you to focus on the conversation itself.

Content: Grow the puzzle around you

I know I'm not in the Bay Area anymore when I have to explain what Y Combinator is. YC is a three-month startup school where founders receive coaching on how to refine their product and sell their ideas to investors. Its head-turning record of success has inspired hundreds of other accelerators worldwide, keen to replicate YC's investment and training philosophy (source: The Economist).

I admire how YC has an emphasis on nice people. Founders are assessed as to "whether they're good people or not", consciously avoiding "jerks but who seemed likely to succeed". YC open sources a lot of its material, for example the Startup School online course, and promotes founder-friendly investment terms.

It's been noted how the close-knit feeling might be diluted as the program grows; the 116 startups per batch in 2015 is now 197. What we can perhaps agree on is the wonderful content made available. I'll share my favorites over the next few days, the following by Jessica Livingston.

http://foundersatwork.posthaven.com/grow-the-puzzle-around-you
You are a jigsaw puzzle piece of a certain shape. You could change your shape to fit an existing hole in the world. That was the traditional plan. But there’s another way that can often be better for you and for the world: to grow a new puzzle around you. That’s what I did, and I was a pretty weird-shaped piece. So if I can do it, there’s more hope for you than you probably realize.
]]>
tag:payments.posthaven.com,2013:Post/1594721 2020-09-16T01:34:06Z 2020-09-17T02:43:10Z RC W6D2 - How the browser works

Compilers

I felt a little out of depth trying to follow along more closely JavaScript optimizations from last week; I started taking a look at compilers to develop a bit more background.

Compilers was the first class I signed up for at Bradfield. I remember Oz described how fortunate we were as developers to have the ability to work at a higher level (libraries, frameworks) as well as at a lower levels (compilers). In light of that, the syllabus started with the following quote by Ras Bodik.

Take historical note of textile and steel industries: do you want to build machines and tools, or do you want to operate those machines?

Alas I discovered on Day 1 how it's more helpful to cover computer architecture first; I dropped compilers for that course instead. I went on to do all the core CS classes at Bradfield... except compilers. The class at the time had the Dragon book as the main text. This may have switched to Crafting Interpreters by Bob Nystrom (available for free online), which has an excerpt I find particularly endearing.

It’s the book I wish I had when I first started getting into languages, and it’s the book I’ve been writing in my head for nearly a decade.

The book itself is filled with quotes, and why not, let's inspire ourselves with this one by Donald Knuth.
If you find that you’re spending almost all your time on theory, start turning some attention to practical things; it will improve your theories. If you find that you’re spending almost all your time on practice, start turning some attention to theoretical things; it will improve your practice.

How the browser works

Running microbenchmarks led me down the path of JavaScript engines but also browsers in general. The mental model of the browser that I found helpful separates the browser UI, called the chrome, from the browser engine.

Let's split the browser engine into two parts. The first part 'talks to the internet' - starts with the URL, finds the remote server, and gets the desired HTML payload i.e. HTML/CSS/JS. The second part converts the HTML/CSS/JS into what you see and interact with in the browser.

I followed along in Python the series by Matt Brubeck on building a toy HTML/CSS rendering engine. This involves parsing the HTML/CSS text into tree-like objects that the computer understands, which are then processed and rendered visually.

I also came across a post describing how Google created V8 because Google Maps had been running really slowly, and getting Google Maps to run fast helps Google sell more ads. Perhaps. On the flip side, Google Maps is a fantastic product, V8 led to Node, and the need for speed led to network innovations like SPDY and QUIC.

Content: The Refragmentation

No discussion of YC is complete without Paul Graham. My favorite PG essay is a little tangential to the topic of startups; the essay here attempts to explain the increasing fragmentation of society.

http://www.paulgraham.com/re.html

As controversial but perhaps easier to dispute is my favorite PG tweet.
]]>
tag:payments.posthaven.com,2013:Post/1595059 2020-09-17T02:06:48Z 2020-09-17T23:06:50Z RC W6D3 - Finding a success metric

Compilers

In yesterday's post, I described taking a closer look at how a browser works (in particular, HTML/CSS rendering) as well as compilers, but left out discussing the missing piece connecting the two - executing JavaScript.

We can think about JavaScript execution as translating source code to machine code (which the computer understands). This step could be done through the use of an interpreter, which translates and executes line-by-line. This allows for a fast startup time, but can be slower overall since the same translation may be done over and over again. The other option is to use a compiler, which translates all the source code at once prior to execution. This allows for more optimizations but is more complex and thus slower to start.

Modern JavaScript engines like Chrome's V8 combines the 'best of both worlds'. It starts by running the source code through the interpreter, but also has a profiler that identifies parts of the code that are run repeatedly. These are then recompiled into highly-optimized machine code, allowing for impressive speed ups over time. This process is known as just-in-time (JIT) compilation.

When running microbenchmarks, I was surprised (and impressed!) to find JavaScript performance times to be comparable to Rust. What I didn't compare was memory usage, though perhaps you're already familiar with this from using Chrome. Writing high performance JavaScript is very much tied to keeping the JIT happy, which got me looking at compilers.

A discussion of how V8 makes trade-offs - running a single line of code vs iterating through a loop, memory usage in laptops vs mobile - can be found in the Google I/O talk here.

Startups

Andrey and I talked about startups over a fun coffee chat today. We have a tendency as developers to build something cool that we think will translate well into a startup, but in doing so overlook two key skills.

The first is the skill of 'making money'. This involves being mindful about the commercial aspects of the product (potential user base, how to monetize, pricing) as well as the business in general (accounting, payroll, AWS bill). Naturally the idea here is to have money in exceed money out, or at least, be able to pitch VCs that you'll end up in this state.

The second is sales. While it's easy to think of sales as a part of the first skill, it's clearer as a separate skill when you think about how you can sell something that's free. Sales more broadly involves growing the adoption of your product; a large user base helps create a large paying user base.

A useful analogy is to think about being a good developer and being good at interviews. The two skills reinforce each other but involve different training regimes. Keeping the two distinct helps us break down real-life examples into 'case studies' and assess how well they do in each dimension.

What's very interesting is how Andrey uses this framing for open source software - he leans towards building something that's cool but also something easy to explain and easy to demo.

Content: Sam Altman

I enjoyed the New Yorker profile of Sam Altman so much, I still keep the physical copy. I know, I should have kept the one on Jack Dorsey too.

https://www.newyorker.com/magazine/2016/10/10/sam-altmans-manifest-destiny

The article has a brief history of YC and how it's changed under Altman, including this great excerpt.
Launching a startup in 2016 is akin to assembling an alt-rock band in 1996 or protesting the Vietnam War in 1971 - an act of youthful rebellion gone conformist. Since 2005, the year Y Combinator began, accelerators have sprung up everywhere to help transform startups from a skein of code into a bona-fide company.
Altman has since moved to leading OpenAI. He's true to form on gambling on the next moonshot, as per the advice from his post. The question for myself is, what's my success metric?
It’s useful to focus on adding another zero to whatever you define as your success metric - money, status, impact on the world, or whatever. I am willing to take as much time as needed between projects to find my next thing. But I always want it to be a project that, if successful, will make the rest of my career look like a footnote.
]]>
tag:payments.posthaven.com,2013:Post/1595274 2020-09-18T01:43:46Z 2020-09-18T18:37:33Z RC W6D4 - The engineer's guide to career growth

Compilers

Learning about compilers has been fun. We started with a stack-based virtual machine that executes bytecode, just completed the scanner (converts source code into tokens), and now getting into the compiler (converts tokens into bytecode).

Right now things still feel a little removed from the Fitzgerald vs Egorov post. The optimization that stood out to me was inlining, where the compilation process replaces a function call with the body of the function itself (since you don't have functions in machine code). Egorov achieved this in JavaScript by stringifying a function to get its source text; Fitzgerald noted in Rust this simply involves annotating the function with #[inline].

Stack-based VMs are simple yet can elegantly do a lot! Register-based VMs, in contrast, are more complex but can achieve better performance. I amuse myself thinking about the time I reviewed my notes on MIPS (register) thinking it could help me understand WebAssembly (stack). Bob Nystrom's all-time favourite CS paper is actually on this topic, on Lua moving from a stack-based to a register-based instruction set.

Professional services

Paul Graham's essay described how the 1980s saw a shift from large corporations being the most desirable employers, to professional services. I think of this topic fondly. My very first job was in finance, which was the default of sorts for college graduates then.

The progression in most professional services roles has junior employees executing what the client asks for, and senior employees managing client relationships. I liked the execution part, and always wondered, "What if I'm not into golf?" (cue Mad Men episode). It's curious how for some cases this model is flipped - Google ICs goes all the way up to Senior Fellow i.e. Level 11.

Content: Engineering management

We've covered data science, product management, design, dev ops and data engineering so far. I've saved this one for last - engineering management. I love Julia Evans' zine on the topic, as well as this excellent post by Raylene Yung.

https://firstround.com/review/the-engineers-guide-to-career-growth-advice-from-my-time-at-stripe-and-facebook

I wouldn't say I have a burning desire to be a manager. That said, I do feel (1) there are lots of soft skills that get honed when you're responsible for your team's success, and (2) having that experience helps you empathize with your own manager. Plus think of all of the books that now become more interesting...

]]>
tag:payments.posthaven.com,2013:Post/1595615 2020-09-19T02:57:10Z 2020-09-20T16:21:41Z RC W6D5 - Change is the only constant

Halftime

It's the end of my half batch at RC. I had extended my stay from 6 weeks to 12, so today marks the halfway point.

We had an end-of-batch ceremony, but true to RC's philosophy of Never Graduate, it merely marks the start of a new phase. I was touched by the kind words to those making the transition. The nicest words have to go to the RC faculty; I'm amazed at how well they've been keeping the program going despite the lockdown. I wished I could give all of them a hug, or given the new world we now live in, an elbow bump.

I started RC planning to develop my front end skills. I thought this would involve JavaScript and frameworks; it appears I've gone a bit of a detour. That said I'm still on the path of thinking of the browser as the platform, as initially intended.

  • Week 1 - Getting started
  • Week 2 - Open source
  • Week 3 - Rust
  • Week 4 - WebAssembly
  • Week 5 - Microbenchmarks
  • Week 6 - Compilers

I had the chance to answer questions from the incoming batch this week, and excited to be vicariously infused with a healthy dose of enthusiasm next week! RC faculty are fantastic at getting the most interesting and intellectually curious people to join. I mentioned to the incoming batch how I'm a little jealous at my batchmates with interests in domains with well-defined boundaries, it appears they're better able to concentrate their collective efforts and get a lot done that way.

The varied interests on my part continue irrespective. In the morning, I polished up a bit more code from my Python implementation of lox.

I'm not sure what got me started looking at algebraic data types (ADTs), but I spent some time between events translating a Rust example to Python. The PEP 484 change on forward references seems to have made all the difference here. I haven't yet been able to fully wrap my head around "Why bother?", but did discover a thoughtful post by Mark Seemann. Instead of thinking about these more sophisticated types as 'stronger' tests, the better framing is to consider how ADTs make illegal states unrepresentable.

I discovered the RC publication Code Words along the way, with a post on ADTs and one on compilers. I'm reminded of Legal Affairs, an excellent general interest magazine about the law by Yale Law School students. Like Code Words, the publication sadly only lasted a few years.

Re: frameworks, I recently found out Vue has surpassed React in the number of Github stars. I mentioned this amusingly at the Rust learning group, and Vinayak responded by sharing this cool documentary. Since I do use the blog as an accountability tool, my plan is to try out Vue in addition to reading this Evan You interview in Increment.

On writing

To become a better developer, there's no way around writing lots of code. Making the effort to write daily has definitely made me feel a lot more comfortable about sharing what I've learned. As per a previous post, the problem I feared was that people might care too much when in reality it's the opposite.

From now on I'll shift to a weekly cadence. I'll try to keep the length reasonable. *wink*

Content: E lucevan le stelle

I also use the blog to embarrass my younger self. I previously claimed a love for opera, thinking I'll emerge as a more cultured version of myself. It's not clear that has happened, but I did come out of this phase with a few favorites. Here's the aria from Tosca, performed by Luciano Pavarotti.

Content: The rise of human-computer cooperation

I know, it's a TED talk (and not Brené Brown either). When I first picked up programming, I was fascinated by the idea how humans and computers excel at different skills. The best teams are usually not the smartest humans or fastest computers working individually, but composite teams that can assess who's better where and have a 'streamlined' human-computer interface. This idea was touched on briefly in the featured article of a previous post, and it's put across really well by Shyam Sankar.

Content: Change is the only constant

When I was making the career transition to software, I constantly wondered if I was making the right move. A part of me wanted to return to professional services; it felt familiar not just to myself but also to my family and friends. It felt safe.

I feel extremely fortunate to have made the shift, not for any sector specifically, but for taking the step towards lifelong learning. If I could do it once, perhaps I can do it again. Not an unlikely proposition as the world changes ever more rapidly.

This FT Weekend article by John Lanchester captures this sentiment perfectly (enclosed below).

The moral of the story is that even if you think you understand the impact economic forces can have, they can still strike dangerously close to home. It helps to have a compass, and mine is based on two principles, both of them learnt from my banker father: anxiety is freedom, and the way you are living will have been your life.

Content: Designing Data-Intensive Applications

This last section of my Friday posts usually feature a book excerpt. Designing Data-Intensive Applications by Martin Kleppmann is not one that I've completed, or at least, not cover-to-cover (conveniently the reading group starts next week). The excerpt I'd like to feature is its excellent dedication.

Technology is a powerful force in our society. Data, software, and communication can be used for bad: to entrench unfair power structures, to undermine human rights, and to protect vested interests. But they can also be used for good: to make underrepresented people’s voices heard, to create opportunities for everyone, and to avert disasters. This book is dedicated to everyone working toward the good.


]]>