Lorenzo Villani

(╯°□°)╯︵ ┻━┻

Spotify Is Better than Apple Music

Nov 6, 2017

I’m trying to like Apple Music but I can’t.

I’ve been using Apple Music on and off ever since it first launched at the end of June 2015. It made sense at the time. I was, and still am, all-in into the Apple ecosystem. Apple Music promised to be better integrated with my hardware and software than anything else on the market. Also, one less app to install and one less account to log into. Hooray!

Initially, there were problems. Many of them. Apple Music had just been launched, so they were expected. iTunes on the Mac and the Music app on the iPhone would often skip songs, stop playing out of the blue, or take a long time to change tracks (even on a fast and stable WiFi connection). Music on the iPhone would often tell me that something was wrong, inviting me to retry with a tap. Except that said tap would never work, only killing the app from the task switcher would “fix” it. I kept telling myself that it would get better.

After a while, I decided to sell most of my Apple stuff and go back to Android, to see what’s the world like over there. Let’s call it my mid-life crisis of the Information Age.

Along the ride came the switch from Apple Music to Spotify, which I suddenly could use everywhere: my Mac, my Nexus 5X, and my GNU/Linux workstation at work. It was pure bliss.

Fast forward two years and I’m fully back to the Apple camp, so here I am, trying Apple Music, again. Here I am, canceling my Apple Music subscription in favour of Spotify, again.

Why, though?

There are many reasons. The first, and most important, is that the “portals” through which I access Apple Music (iTunes on the Mac and the Music app on iOS) feel slow and bloated. Search is slow and only seems to respond to exact queries. Spotify is more lenient and always seems to find the artist I’m looking for even when I’m misspelling its name. I’m also still experiencing some of the problems that plagued the service at launch. Spotify is zippy and always amazes me how well it works.

Siri integration works fine, except when it doesn’t. More often than not, it won’t understand an artist’s name and starts playing random stuff instead. No Siri for me.

The “For You” section is… well… passable. The AI-generated “My Chill Mix” was always impressively on point. “My New Music Mix” was just terrible, full of music I would never listen to. No amount of “loving”, adding, and following artists or tracks seemed to improve the situation. Again, Spotify’s programmatic suggestions (its “Discover Weekly” playlist) are consistently better.

The dealbreaker for me is that there Is no way to use Apple Music on my work machine. It’s a powerful Linux workstation with lots of cores and RAM. The kind of work I do can’t be done on macOS. It can’t be done on Windows, either. A Linux desktop for work is fine and I like it. It’s just lacking a native iTunes client 1. Given that all competitors can be used from Linux in a way or another (usually via a Web interface) I fail to understand why Apple doesn’t have one. Spotify even went the extra mile and shipped has a native client for Ubuntu!

Apple Music, at this stage, is kind of a “meh” product, bleeding from tens of paper cuts. It’s only advantage is that it comes built-in with all Macs and iPhones, is better integrated in the Apple ecosystem, and requires one less app to install and one less login to remember. I would probably switch back to it if my primary work machines becomes a Mac or Windows workstation where iTunes is available.

Until then, in the sea of 9,90€ music streaming services, I feel like I’m better served by Spotify.

  1. I tried installing the Windows version under Wine, it didn’t work. 

Android, Treble and the Updates Situation

Jul 23, 2017

I’ve been using Android mobile phones since Eclair (2.1). While the operating system visibly improved at each iteration, updates were, and still are, a major pain point.

Most non-Nexus and non-Pixel phones don’t get prompt security fixes for the increasingly long security bulletins that Google publishes every month.

Users are also missing out on performance and battery improvements that appear in new Android releases. Most flagship phones released in 2017 had Android 7.1 at a time when 7.1.2 was readily available, a six month old release. Lots of budget phones sold in 2017 come out with Android 6.0, a version that’s more than 18 months old at the time of writing.

Most devices are sold on carrier contracts. Chances are that updates have to go through several gatekeepers. The first one is Google, then hardware vendors, then phone makers and finally the carrier itself. Each step requires validation, testing, then more validation, and then more testing.

There’s simply no economic incentive for anyone in this chain (except for Google) to support a phone after it has been sold. This means that major updates get hugely delayed 1. More often than not, this also means that devices are not getting quick security updates, which is worse. The latest round of security vulnerabilities means that receiving the wrong SMS/MMS or being near the wrong Wi-Fi or Bluetooth radio could result in a compromised device. People have no control nor defense against this, besides patching security holes.

In this race to the bottom some manufacturers clearly state that it costs too much to push security updates on a monthly basis. They prefer to roll them up with major platform updates, but this means that they are leaving their users unprotected for long stretches of time.

Quoting an article from Ars Technica:

Motorola understands that keeping phones up to date with Android security patches is important to our customers. We strive to push security patches as quickly as possible. However, because of the amount of testing and approvals that are necessary to deploy them, it’s difficult to do this on a monthly basis for all our devices. It is often most efficient for us to bundle security updates in a scheduled Maintenance Release (MR) or OS upgrade.

The problem, however, is: how do you sell security to users? How do you get them to vote with their money, the only weapon they have to force vendors to change their attitude? Most people don’t want to spend 800€ on an iPhone 2, which is probably the most secure consumer mobile phone available today. The layperson doesn’t really have a concept of “software updates” and “security”. Even fellow software engineers don’t seem to grasp or fully appreciate the concept! Most people just want a cheap smartphone to use SnapChat and WhatsApp, they probably won’t demand security unless they get hacked en-masse and experience direct economic damage from hacking attempts.

Which means that the burden of keeping users secure lies entirely on Google’s shoulders.

Google recently announced Project Treble, an initiative to decouple generic parts of the Android operating system from vendor-supplied support code by, essentially, creating an HAL.

With this change, vendors will only need to customize the hardware support layer, assuming the HAL is well defined and well separated from the rest of the system. This is a nice improvement since, before Treble, hardware customization usually needed changes spread across the entire operating system.

However, I’m not confident that this will solve anything at all. With this model, SoC and phone manufacturers are still responsible for shipping updates and, as we said before, there’s just no economic incentive for them to update phones. These companies live on razor-thin margins and any cent saved can be spent surviving in this highly-competitive market.

Even on the high-end (i.e. phones that cost more than 600€) things aren’t that rosier. While manufacturers may have an easier time updating the low level guts of the operating system let’s not forget that most players in this space still rely on heavily skinned Android versions such as TouchWiz, Sense, EMUI, etc. Skins slow down updates as much as adding hardware support and Google doesn’t have an answer to make that easier, yet.

I strongly believe that the situation won’t improve at all until Google either:

  • Starts updating the operating system by itself, bypassing manufacturers and carriers, and letting them only manage hardware integration and the baseband processor.
  • Starts exerting more control over partners (especially phone manufacturers) using access to Google Play Services as leverage against vendors who don’t, for example, promise to push monthly security updates to users for at least three years since a phone’s release date. Those failing to do so, should see access to the Play Store and proprietary Google apps revoked.

I don’t think Google will choose the former, since it goes directly against the very reason that made Android popular in the first place, and would risk Google’s relationship with hardware partners (e.g. Samsung) and carriers.

I am more confident that Google will try the latter. We’ll see how this one pans out.

  1. Which is, arguably, a minor loss if you are not interested in features or efficiency gains. 

  2. Since Google killed Nexus phones (which were affordable at around 250-300€ for a base model), the only alternative is a Pixel, which often costs more than an iPhone and is supported for only three years. Apple devices are usually supported for at least five years. By choosing a Pixel you are getting less value than an iPhone. By choosing anything else you are getting even less. 

Rust and Clippy

Apr 25, 2017

I’ve been dipping my toes in Rust lately and I’m finding it a competent programming language. It’s a nice middle ground between C/C++ and a programming language that requires you to know Category Theory in order to start using it (cough… Haskell cough…).

When you start using Rust you quickly find out that it’s a good idea to something called Clippy. It is a fantastic tool that helps you write better and more idiomatic Rust code. I’m sure its name is a reference to this guy on the right, just a little less obnoxious.

Having Clippy on your side is like having an experienced Rust developer telling you that the code you are writing is of questionable quality, even though it compiles just fine.

There’s one catch though, you can’t use it on stable Rust releases. 1

Clippy, in fact, is implemented as a compiler plugin and, as such, it depends on unstable rustc APIs that are available only on nightly releases of the Rust toolchain.

I don’t like to run nightly or beta releases as my daily driver for a couple of reasons:

  1. I don’t want to risk depending on features that will ever be available only on nightly Rust or that will change wildly between snapshots. 2
  2. Being a beginner, I want to judge Rust on the merit of what’s available in stable releases right now, not on the prospect of what will be available later, if at all. In a project I decided to use serde’s codegen before “macros 1.1” were stabilized in Rust 1.15.

Installing Clippy

Sometimes Clippy fails to build even with the latest nightly compiler, so the first thing I usually do is to browse its CHANGELOG file and find out which release has been compiled with which compiler and use that.

For example, given this excerpt:

0.0.124 — 2017-04-16

  • Update to rustc 1.18.0-nightly (d5cf1cb64 2017-04-15)

0.0.123 — 2017-04-07

  • Fix various false positives


I would pick Clippy version 0.0.124 and build it with the 2017-04-23 nightly compiler.

Starting with a working rustup I would then run:

rustup toolchain add nightly-2017-04-15
rustup run nightly-2017-04-15 cargo install --force --vers 0.0.124

If the selected version still fails to compile, I just pick the previous one until I find one that works.

Using Clippy

Since I always keep the stable toolchain as default, running cargo clippy as-is will result in an error:

0 19:40:53 lvillani@oculus ~/D/borg-hive (master=)
$ cargo clippy
dyld: Library not loaded: @rpath/librustc_driver-8dacd42830809d58.dylib
  Referenced from: /Users/lvillani/.cargo/bin/cargo-clippy
  Reason: image not found
error: An unknown error occurred

To learn more, run the command again with --verbose.

Since we have rustup, running Clippy with the nightly toolchain we installed before is easy:

rustup run nightly-2017-04-15 cargo clippy

If, for some reason, running cargo build with the stable toolchain after Clippy ends up recompiling all dependencies, just tell Cargo to put its output files in a separate directory like so:

env CARGO_TARGET_DIR=./target/clippy rustup run nightly-2017-04-15 cargo clippy

This is especially useful if you then want to remove only the output files generated by a Clippy run.

  1. There are plans to make it available as a rustup component as soon as they release their first stable version though. See here for details. 

  2. Most nightly features are behind a feature-gate, which means that you won’t accidentally use them. sometimes, though, rustc may change behavior without you noticing. For example, struct field reordering has been recently enabled, breaking programs that relied on previous behavior (I’m just making an example, excluding the fact that Rust doesn’t specify an ABI and people shouldn’t rely on the compiler’s behavior in this case). I prefer to know about behavior changes by reading release notes published with each new stable release instead of having to wade through commit logs.