Bytes #68 - What's easy to get into, but hard to get out of?

What's easy to get into, but hard to get out of?

Issue #68.October 4, 2021.2 Minute read.

This week, we've got a behind-the-scenes look at the rise of TypeScript, Cloudflare giving away bandwidth like its the Tootsie Rolls in your Halloween candy bag, and the #1 most important interview question for Vue developers. Welcome to #68.


Princess Leia and R2D2 meme

Where's that free, unlimited bandwidth button?

Cloudflare's R2 has Big Bandwidth Energy

Last week, Cloudflare somehow made a boring cloud service seem interesting again when they released R2 Object Storage.

How we got here: AWS S3 has been the #1 provider of file storage on the internet since 2006. Similar to what my High school girlfriend thought of me – it's cheap, it's durable, and it's easy to use. In fact, it's so good that most of the other cloud storage providers have ~~copied~~ been inspired by its API and name.

Riddle break: What's easy to get into, but hard to get out of?

Trouble, and also your data from typical cloud providers. This is just how it's always worked. Most cloud providers allow you to put data into the cloud for free, but when you need to get that data out, $$$. This even has a cool and totally confusing name, "data egress".

So what does R2 have to offer in such a saturated market? An undying allegiance to the Bandwidth Alliance (this story is writing itself) - "providing zero-cost egress for stored objects — no matter your request rate".

And that's not all. Cloudflare has another trick up its sleeve for helping developers escape the belly of the AWS beast - dead simple migrations.

For S3-compatible services, on the first request for an object, R2 will serve the request from the original storage bucket, copy the data over to R2, then serve all subsequent requests from R2. Eventually, all your data will be on R2 and you only have to pay the egress fee once per object - nice.

Bottom Line: I'm no economist, but I did put the Harvard Business School logo in my LinkedIn bio after I paid $5,000 to attend one of their 3-day executive seminars. So you can trust me when I say that if you run the numbers, R2 is yet another Cloudflare product that'll give AWS a run for its money.


Sentry meme

The hero we need [sponsored]

Sentry is hooking us up with freebies

Let's cut to the chase. Sentry's web dev outreach team had to go and ~~beg the suits~~ get special management approval -- but they were able to hook us up with our own unique discount code. The only catch is that the code only works through the end of the week.

So if you care about app monitoring (and you should) -- go create an account, use BYTES as the promo code, and you'll get a whole month of their fancy-shmancy Business Plan for free.

Once you sign up, you won't have to worry about getting woken up at 2:00 am by 17 Slack notifications like these:

Prod crashed again.

Different bug this time.

Can't find it.

Could you hop online for a bit?

💀💀💀

Sentry is by far the easiest way to monitor errors and performance -- they've got individual SDK's for every technology, advanced analytics, and an insights dashboard that pretty much just tells you exactly what you need to do to improve performance.

Try one month of Sentry's Business Plan for free with the promo code BYTES -- before the deal expires later this week.


Bill Gates reading

So how much are we charging for this TypeScript thing?

The (Brief) TypeScript Story

9 years ago last week... TypeScript was born into the wide world of OSS. And since our little statically-typed bundle of joy has been with us for almost a decade now (and the TS 4.5 Beta was announced last week), we wanted to zoom out and answer a few TypeScript questions that – at this point – you might be too afraid to ask.

Why TypeScript?

In ~2010, JavaScript...wasn't what it is today. After years of work, ECMAScript 4 had just failed to reach a consensus amongst the TC39 committee - in no small part to Microsoft's own objections.

The problem was Microsoft still saw JavaScript as what it was initially intended for, ~~a way to capture browser market share~~ a simple scripting language that was designed to be easy to use by both designers and developers, not a full blown application platform.

So what did Microsoft do? Well, they did what any engineer at a big tech company would do if they could – they built their own language. However, unlike other options at the time, Microsoft made one critically important decision – they decided to build on top of JavaScript. This allowed them to create the ideal development platform they desired, while still benefitting from the JavaScript ecosystem.

Fast forward now to 2021. Yes, TypeScript is popular – but most of Microsoft's original objections about JavaScript have been added to the language. So then what makes TypeScript great in 2021? Let's take a look -

TypeScript the language

First and foremost, TypeScript is a language based on JavaScript. This seems small, but it's critical to TypeScript's success. Because it's based on JavaScript, any JavaScript program is also a valid TypeScript program. This not only means that you can import any JavaScript module and use it in your TypeScript code, but it also means you can gradually adopt TypeScript into your codebase.

Obviously, this language lets you define what type a variable should be when you declare it -- so you can avoid common bugs that arise when you think a variable is one type and it's actually another. (Fr*ck you, 'undefined' is not an object.)

TypeScript the developer tool

It may be surprising, but this is probably its most valuable feature. You can think of it like Prettier, ESLint, or even a nice, empathetic friend sitting by your side - its job is to make your life as a developer a little bit easier.

The goal of any kind of validation tool is to increase your confidence that the program you are writing behaves the way it is supposed to and doesn't have unexpected bugs. Since TypeScript understands the relationships between the types in your codebase, using it well can eliminate entire classes of errors and issues. TypeScript doesn’t replace ESLint or automated tests, but it can give you more confidence that your code is working correctly without having to execute it.

TypeScript the Compiler

TypeScript is also a compiler. Like Babel, it can transform TypeScript and JavaScript code to support different features for older JavaScript engines. If you need to support an older browser like IE11, you can configure TypeScript to transform your modern JavaScript code so it will work correctly. If you only need to support newer JavaScript engines, the compiler will only strip out the type data, leaving you with valid, modern JavaScript.

TypeScript the Communication Tool

Finally, TypeScript is a great way to document your code and communicate with the rest of your team. Like joining a new swinger group, coming into a brand new codebase can be daunting, especially if you don't know how all the pieces connect together. Type annotations remove the guess work in figuring out how a program works and serve as a guide for anyone trying to work in your codebase.

Bottom line:

It's easy to think that TypeScript is simply a way to add types to JavaScript – and though that's true, it's so much more.

In 2007 Jeff Atwood famously said "Any application that can be written in JavaScript, will eventually be written in JavaScript." An updated version of this quote would probably be "Any application that can be written in JavaScript, will first be written in TypeScript, and then compiled to JavaScript".


Jobs

Full Stack Engineer at Chromatic — TS, React, Next.js, GraphQL | 100% Remote

Join the team behind Storybook and Chromatic—tools used by hundreds of thousands of developers. You’ll work on the backend to the frontend and from the ideation stage to shipping. Along the way, you’ll collaborate with folks across the globe and build your reputation as a leader in the frontend community.


One Question Interview

What will building for the web look like in 5 years?

"It will be a strong evolution of what Svelte looks like -- optimizable, template-based development, with turn-key support for serverless."

Adam Rackis Adam Rackis is a Senior Web Engineer at Spotify. He'll be giving a members-only talk this Wednesday entitled, "Scaffolding a GraphQL Endpoint: Do's, Don'ts and Why's". Want to attend? Start a free trial.

Cool Bits

  1. React Native 0.66 came out last week, and it has successfully encoded the NUMßÊR ôf THÊ Béàst on all your cross-platform mobile apps. Thanks Zuck.

  2. Everyone loves spending hours replicating, diagnosing, and resolving errors. But since everyone actually hates doing that, maybe it's time to try using Raygun, instead of old-school support tickets and janky log files. It's what error monitoring should look like in 2021. [Sponsored]

  3. The VSCode Team wrote about how they made bracket pair colorization 10,000x faster. We didn't check their math, because we use the Theranos Investor Approach™ to due diligence: if it seems fairly legit, we'll probably just take your word for it.

  4. Oleksii Trekhleb wrote about how he trained a car to self-park with only 500 lines of code. That narrowly beats my app where I used 500 lines of code to add, remove, and edit items in a Todo list.

  5. Michael Hoffman wrote a list of his Top Vue.js Interview Questions. Unfortunately he didn't specify if these interview questions allow you to use jQuery.

  6. Cassidy Williams wrote a genuinely helpful article on Getting your first software developer job. This beats our usual advice of "be born to wealthy parents who pay for you to get into USC's CS program by pretending you row crew".

  7. Fireship made a great video on How to Over-Engineer a Website. It's very informative, but now I need to choose another title for the book I'm writing on GraphQL 😔.

  8. Ryan Carniato wrote about The State of Solid.js, which includes Netlify becoming an official deployment partner, lots of love from tech influencers, and an expanding Solid ecosystem. The craziest part is where he writes about the brand partnership the just launched with the Metal Gear Solid franchise -- which will see Ryan will play Snake in the upcoming MGS mini-series on HBO.

Join Bytes

Delivered to 105,434 developers every Monday