Sapan Bhuta

medical student, code in my free time

Read this first

Uber and Land Wars in Asia

You fell victim to one of the classic blunders! The most famous of which is “Never get involved in a land war in Asia,” but only slightly less well-known is this: “Never go against a Sicilian when death is on the line!” - Vizzini in The Princess Bride (1987)

Uber is selling it’s China business to Didi Chuxing, the ride sharing leader in China, after investing over $2B in a subsidy war over the last three years to gain marketshare. Pending regulatory approval, Didi will be acquiring Uber China in exchange for 20% equity in Didi (with Didi now valued at $35B). Before the acquisition, Uber China was valued at $7B, and Didi was valued at $28B. Note that Uber China was a standalone business and it’s investors included Uber and Baidu among others, so Uber specifically will receive 17.7% of Didi equity. In addition, Travis Kalanick of Uber and Cheng Wei of Didi will sit on each others boards.

Continue reading →

Allo, goodbye


Google introduced a new messaging app today called Allo. The app is fine by itself. It even has some thoughtful features around privacy and AI that were neat to see, but the issue is that none of these features are compelling enough to make anybody (and their network) switch over from Facebook Messenger, WhatsApp, WeChat, Line, Kakao, or Telegram.

It’s really liberating to start from scratch sometimes -Erik Kay, director of engineering, communications products (source)

Apparently the focus inside Google, was to do a hard reset and try again with messaging. But in my mind Google went the wrong direction with their reset. They should have taken a page from Apple’s rollout strategy with iMessage.

Allo should have been a blazing fast, seamless, backend system built into the default SMS app of every Android phone, which handled messages between Allo capable devices. And just like with

Continue reading →

Bots & WeChat of the West

Recently, a lot of companies are jumping on the bot bandwagon as they hope to catch the next big wave in tech and to realize the massive success WeChat has had in China (i.e. become the “WeChat of the West”).

The truth is that it wasn’t the chat interface that made WeChat successful, rather it was the potent combination of:

  1. ubiquitous installs with high frequency use
  2. logged in users with saved payment information
  3. lightweight interactions (don’t need to download a new app for every service)

What most people don’t realize is that WeChat actually uses web views to handle a large majority of activities. Rather than a chat app, WeChat is more accurately characterized as a web browser with proprietary JavaScript APIs for login & payment. The chat functionality is just a feature that happens to provide the incentive for users to install the app, login and use it frequently. (This maybe a

Continue reading →

Swift vs Go

In many respects Swift and Go both feel like they are motivated by the same desires of having a modern, succinct, simple, safe, and fast programming language for everyday use. So here is a superficial comparison (the differences are bolded):

1 Inferred static structural typing
2 Structs and interfaces
3 Fast compilation
4 Native binary & scripting mode
5 Concurrency: channels
6 Garbage collection
7 Large standard library
8 Large corporate backer (Google)
9 Open source
10 OS level access
11 C interoperability

1 Inferred static nominal typing
2 Structs and protocols
3 Compilation speed TBD
4 Native binary & scripting mode
5 Concurrency TBD: native/green threads/async-await/channels/actors
6 Automatic refrence counting
7 Large standard library
8 Large corporate backer (Apple)
9 Open source
10 OS level access
11 C interoperability
12 Generics
13 Enums
14 OOP fallback
15 Optionals

Continue reading →

The Yahoo Problem

In 2012, with her appointment as CEO, Marissa Mayer had an ambitious plan to bring Yahoo back to its glory days and it was a theoretically sound one.

The majority of online users spend their time on smartphones engaged in activities like reading email, checking sports scores, getting weather and news updates, watching videos, chatting with friends, and connecting on social media. Most of these activities are traditional strong holds of Yahoo on the desktop. But Yahoo had not made the transition to mobile with its users.

So Mayer had a plan to bolster Yahoo’s mobile offerings and once again make it a top internet destination. However, a plan like this has three drawbacks: 1) Developing desirable well-trafficked mobile properties requires lots of hard-to-hire-for mobile design, engineering, and product talent. So Mayer chose to acquihire promising mobile startups instead. 2) It takes

Continue reading →

On Open Source Swift

Apple is open sourcing Swift in late 2015 and is going to provide a compiler + libraries for iOS/OSX and Linux!!!

This brings some interesting implications, given that Swift is:

  1. safe via static type inference and use of optionals
  2. fast and is compiled to LLVM bytecode for deployment
  3. scriptable b/c it can also run in an interpreted mode for development
  4. multi-paradigm and borrows heavily from modern developments in Object Oriented Programming, Functional Programming, and Generic Programming
  5. interactive and fun using Playgrounds
  6. concise via a modern, expressive syntax

This means in the very near future using Swift one could:

  1. Develop a native iOS app
  2. Develop a backend on Linux (though unclear concurrency paradigm)
  3. Develop for Android which runs Linux underneath (though Android APIs would have to be bridged)
  4. Develop a web front-end (once somebody inevitably creates a Swift to

Continue reading →

Stripe iOS Integration with Swift & Apple Pay (Updated 10/03/2015)

A Swift supplement to Stripe’s iOS Integration tutorial, including ApplePay.

Note: There are three ways to collect card information:

  1. Use Apple Pay framework to access stored payment information
  2. Use Stripe’s pre-built form components, to collect credit card details
  3. Build your own credit card form from scratch

 Step 1: Install Stripe Cocapod

CocoaPods is a common library dependency management tool for iOS development. To use the Stripe CocoaPods, simply add the following to your Podfile and run pod install:

pod 'Stripe'

Note: be sure to use the .xcworkspace to open your project in Xcode instead of the .xcproject.

 Step 2: Create Objective-C to Swift Bridging Header

  1. In the menu click File > New > File > (iOS or OSX) > Source > Header File
  2. Click Next
  3. Name the file “bridge”
  4. Click Create
  5. Select the Project folder and navigate to Build Settings. Then use the search field to locate to

Continue reading →

Thoughts on Public & Private Market Investing

The grand unified theory of putting money to work

While I love trying to beat the market as a theoretical challenge, you’re better off putting your money in Wealthfront. -Brad

During a recent conversation on software development and programming languages with the awesome people at Capstory, I mentioned that I was spending my free time learning more Python in order to leverage into some interesting algorithmic trading strategies.

That was when Brad, astutely pointed out that unless you are James Simons (Ph.D. mathematics by 23, former code breaker for the NSA, and head of the world’s most secretive/profitable quant hedge fund Renaissance Technologies), you are better off investing in Wealthfront, a great variant of the low cost diversified portfolio.

I want to dissect this statement a little more and the assumptions behind it for my own benefit and hopefully for that of my readers:

Continue reading →

The Future of Programming

It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection. -Paul Graham

I have done a lot of introspection recently on programming language design as I’ve learned Swift and become familiar with other languages including Objective-C, Javascript, Java, Ruby, Python, Go, Haskell, Clojure, Elixir and Elm. When I read the above quote by PG in his paper “The Roots of Lisp” my introspection finally gave way to some clarity

Continue reading →

ssl yes