Facebook turns to c++ for "New Photo Sharing" application

Sometimes the most effective tool for the work is that the oldest one within the toolshed.

For its new Moments photo-sharing application, Facebook eschewed the crop of presently trendy mobile development platforms in favor of writing within the venerable C++ artificial language.

As a result, the corporate is ready to keep up one code base for abundant of the app, that runs on each iOS and mechanical man devices.

“It is somewhat of a shocking alternative,” admitted Ashwin Bharambe, one in all the Facebook developers World Health Organization created Moments, regarding the employment of C++. “There square measure additional and additional folks making an attempt to try to to this so as to share code across completely different platforms.”

Launched weekday, Moments is intended to gather and show photos taken by a gaggle of individuals, like a gaggle of friends hanging out at a barbecue, so that they may be viewed in an exceedingly single location.

Today one in all the foremost difficult problems mobile development groups should face in building such apps is that they need to run on multiple, incompatible platforms. Maintaining separate code bases for mechanical man, Windows and iOS may be notably long once new options got to be accessorial, only if all 3 code bases can got to be updated severally.

A number of firms, like Xamarin and Microsoft itself, provide platforms that enable developers to keep up one code-base for a cross-platform application, tho' the developer gets fastened into wishing on the platform, and may solely use the functionalities the platform itself provides. Another approach is to use the HTML5 set of open standards, tho' performance will suffer from this approach.

Instead, the Facebook development team went with C++.

Initially developed within the late Nineteen Seventies, C++ may be a powerful general artificial language, and continues to be wide used for writing mission crucial and performance-sensitive applications. it's less wide used, however, for mobile platforms, only if it may be a challenge to program in as a result of it forces the developer to traumatize memory management and different refined nuances in abstraction.

The Facebook team found the additional burden to be well worth the effort. With C++, “a ton of our additional difficult logic may be written once and run on each iOS and mechanical man,” Bharambe aforesaid. one code base permits the cluster to often update the app, similarly as provide high performance.

Facebook relied on variety of external technologies to assist with the implementation.

From Dropbox, the corporate borrowed a bit of software package referred to as genie, that converts C++ knowledge models into Java code, the runtime language for mechanical man.

For iOS apps, Facebook took advantage of the similarities between C++ and Objective-C, that is Apple’s most popular language for building iPhone and iPad apps. The team was able to use light-weight wrappers to urge the C++ code to figure within the Objective-C surroundings.

The team conjointly used useful programming methodologies to create the ensuing code easier to know by others. useful programming eliminates the employment of variables by treating the code as a series of mathematical functions instead.

The Facebook engineers behind Moments mentioned a number of the opposite technology

Post a Comment

0 Comments