Facebook engineers: Going mobile-first is not as easy as it looks

Going mobile-first is not as easy as making such a declaration to the world. It requires a lot of organizational changes (and money), according to Facebook engineers.

SAN FRANCISCO----If developers are given tools that are frustrating and difficult to use, they'll make software that is just as frustrating and hard to use, suggested Facebook senior engineer Adam Wolff.

"Making software work the way exactly we want it to work, we can make the company work the way we want it to work," said Wolff while speaking during a whiteboard session about the social network's product infrastructure on Wednesday.

Making software run better in order to make an entire organization successful was one of the mantras behind Facebook's major shift toward operating as a mobile-first platform a few years ago.

Although it has proven to be Facebook's strongest revenue stream (and arguably the saving grace following a disastrous IPO), going mobile-first wasn't as easy as CEO Mark Zuckerberg declaring that direction to the world.

Such a plan required going back to the drafting board for every major product line from Photos to Events, requiring new code and massive organizational structures so that each product team would build for both desktop and mobile platforms alike.

"I think everyone would say it was worth it, but it was extremely painful," Wolff admitted, explaining each sub-team was building in their own ways because there was no one to crossover with necessary knowledge.

Facebook engineering manager Tom Occhino added it was equally hard to find engineers with the mindshare that could address these problems initially.

"The scale of the product was not what these tools were originally built for," Occhino reflected.

Farther down the mobile rabbit hole, problems compounded. Wolff highlighted the diversity of the Android platform as well as higher expectations upon delivery among iOS users.

"Most of the time you're doing tedious crap," Wolff said frankly. "Developers never want to admit that, but it's true."

Even when doing "more fun stuff" like animation, the amount of time and effort put in can be "painful" for developers, Wolff lamented.

"If you want to make it so you can move faster and easier to develop, you're going to have to use more resources to do that," Wolff explained. But those resources on mobile devices - such as CPU, memory and battery power - are precious, he stipulated.

One initiative Facebook has produced to mitigate those costs is React, an open source JavaScript library for building user interfaces, followed up by React Native, designed to help Web developers build fully-native mobile apps with JavaScript and React.

"Building the user interface is really hard to do," Occhino stressed, insisting React makes building UIs easier for Web and mobile because essentially makes the code "dumb" by optimizing input data and removing the logic.

Occhino compared React to Legos building blocks, explaining if you want to alter a component, you only have to change one piece rather than the entire structure.

"The framework figures it out for you instead of you figuring it out as an engineer," Occhino summarized.

Looking back, Occhino said React made it so that developers and engineers could act a lot faster on mobile, hinting that propelled Facebook's own mobile-first strategy simultaneously.

"Facebook went mobile-first but our advertisers had to use desktop to build their ads," Occhino remarked. But unfortunately, in order to build good standalone iOS and Android apps, Occhino pointed out they needed to find native engineers.

Facebook's answer here was a mobile version of Ads Manager, which thanks to React Native, which powered an iOS version that was pushed out in five months versus the original projection of 18 months. An Android version followed a few months later.

React is already being deployed by a number of high-profile tech brands building increasingly for mobile devices, including Flipboard, Netflix, Airbnb and cloud collaboration platform Asana.

The bottom line here, according to Occhino, is that the engineer building for the Web now uses the same technologies, ideas and building models for mobile, saving everyone time and money while boosting performance.

"We're going to keep investing in this as we go," Occhino promised.