Viva la vida - Issue #6

Revue
 
Revue

Viva la vida

October 8 · Issue #6 · View online
A theme-free newsletter where I shape all my thoughts every Sunday. You can expect it to be techie, but I might surprise you with non-techie topics such as life or how to recover from a workout drinking beer.

Javascript
Sunday evening, Berlin darkness is back, and it comes with a shitty weather. It’s perfect to catch up with the series that you stopped watching a while ago and watch some movies. I just came from watching Blade Runner 2049. With no spoilers, I have to say I liked the movie a lot. If you haven’t watched it yet, I’d recommend you to do so, but don’t forget to watch the first part, otherwise, you will be lost the majority of the movie. A few days ago I spoke at Mobiconf, a mobile-focused conference that takes place in Krakow. I enjoyed a lot sharing our experience at SoundCloud building features in a modular-fashion. People seemed to like it and I could chat with some that were running through similar issues in their projects. Moreover, I could meet up with some friends that I hadn’t met for quite a long time.
In today’s issue, I’ll talk about Javascript. You might think that I got crazy, or I’m under drugs but no, I’m sane. Javascript, the so beloved language across the web community and somehow hated by other communities. The language that has found its place on almost every platform, the language whose flexibility makes it powerful but at the same time scary.
There’s nothing that you can’t do with Javascript. 
It was born to complement the web but it’s widely used nowadays. With tons of libraries, and communities pushing the language beyond the limits it’s a good option to consider for your future projects. However, it seems to be a very polemical language when it comes to using it outside the web ecosystem. Yes, I’m talking about building desktop apps with Electron, or mobile apps with React Native.
In my experience, both frameworks are as polemical as the language outside the web. The native developers are usually against them, using performance and Javascript as arguments. Are they that bad as to rule them out from your options? Is Javascript that evil nowadays compared to a few years ago? There was something that I was missing because companies like Facebook, Airbnb, Instagram, Todoist, Trello, Spotify or Artsy are building their apps (or part of them) using them.
The performance of apps built with Electron or React Native is not comparable to native apps. Javascript is single-thread, and that sets up some constraints that we have to deal with. Many applications though are very far from reaching those constraints. They don’t contain very complex animations, the data synchronization model is simple, just requesting data as the user navigates, and persisting it for a better offline experience. If your apps require some expensive work to be done that might create a bottleneck in your project, but you can always move it to native. That’s the beauty, in my opinion, of those frameworks. They are just a layer, and you can move down to native only the things that really need to be native. 
Javascript has no types, and that’s scary when you are used to strongly-typed compiled languages like Swift or Kotlin. Fortunately, things have changed a lot, and nowadays, we can use super-sets of Javascript, like Typescript, or Flow, to introduce a type-system and prevent that errors with types cause some runtime exceptions. I’ve tried Typescript, and it feels like writing Swift code. There are interfaces, enums, generics and even more powerful features that Swift doesn’t provide. The code is transpiled in a matter of seconds, and you get your apps live-reloaded automatically. It’s magic, isn’t it? Microsoft is behind Typescript, and you can find great tools, like Visual Studio Code, that perfectly integrates with Typescript, and allow you to do things that by writing native code wouldn’t be possible, like TDD.
In my experience working on a large native code base, tools for building apps are not optimized for big apps. Apple and Google prefer to optimize their tools for the average size of the apps in the market, which is not the size of a Facebook, a Twitter, or a SoundCloud. In that position, you can:
  • Fight the tools every day, and see your productivity getting slowed down.
  • Invest some resources in coming up with better tooling. Like Facebook does with Buck. Unfortunately, only companies with enough resources can do that.
  • Bring some dynamism with Javascript.
Another aspect of Javascript that I find very powerful is reusability. While only business logic is more suitable for reusing in React Native, in Electron you can reuse almost everything (from the UI layer to the data one). That makes things really easy to maintain. Imagine all the development time that you save. Very recently, GitHub decided to drop the previous GitHub client for macOS and Linux, and come up with a new version built using Electron. Their main reason was that they were writing and maintaining the same features for multiple platforms, and it didn’t make sense to them. GitHub desktop app is a simple app, nothing fancy, just a simple UI to work with your git repositories. And GitHub is not the only one. Todoist app is also built with Electron, Visual Studio Code, Trello…
Javascript might not be as performant as native languages but it deserves, in my opinion, some respect. It’s more flexible than any other language out there, and it has made its way through some constraints that Google and Apple established to prevent that it reaches its full potential. If I had to build an app from scratch nowadays, I’d definitively put React Native or Electron in the options, implementing in native, only the things that really need to be native. I hope Apple and Google introduce some improvements in their tools and build systems, and that maybe in a few years, we can see a real incremental build system that works for small and big apps.

Have you used Javascript in your projects? What’s your experience? 
I hope you have a great week and see you in the next issue. Ping me on twitter, @pepibumur, or send me an email pepibumur@gmail.com if you want to chat about anything.


The song of the week
Classical John Williams- Schindler's List Theme (violin solo by itzhak perlman) by gharacheh2000 | reza gh | Free Listening on SoundCloud
Some reading
The Path to Becoming a Software Architect – Nikolay Ashanin – Medium
Liza Donnelly – Noteworthy
Modular Xcode projects – Caramba Stories
Did you enjoy this issue?
Thumbs up 1ae5a7bdfcd3220e2b376aa0c1607bc5edaba758e5dd83b482d03965219a220b Thumbs down e13779fa29e2935b47488fb8f82977fedcf689a0cc0cc3c19fa3c6bb14d1493b
Carefully curated by Viva la vida with Revue.
If you were forwarded this newsletter and you like it, you can subscribe here.
If you don't want these updates anymore, please unsubscribe here.