Sometimes an older staple of computing can become the ideal choice for modern application development. Looking for code portability and performance, Dropbox has leveraged C++ for native mobile development of its Carousel photo gallery and Mailbox email application.
Officials from Dropbox on Monday described an architecture partnering C++ application logic with a language bridge leveraging JNI (Java Native Interface) or Objective-C. Also in the mix is UI platform code based on Java, for Google's Android platform, and Objective-C, for Apple's iOS. The company even devised its own tool to link C++, which was first developed in 1979, to Java or Objective-C, called Djinni. The tool is offered via open source.
"There is no other language that you can compile natively to both Android and iOS," said Andrew Twyman, platforms and libraries engineer at Dropbox, during the @Scale 2014 technical conference. Dropbox started the project with the C language because it was the most compatible, but decided C was not up to the challenge of "real" application development, Twyman said. Mailbox had been written as a pure iOS application in Objective-C but Dropbox developers moved to C++ when they wanted to do an Android port. Carousel was built from the ground up via the company's C++ architecture.
Dropbox has followed a Model-View-ViewModel architecture with C++, Alex Allain, platforms and libraries lead at Dropbox, said. C++ has been around since 1979. But was been improved lately, in version 11, with capabilities such as lambda functions, Allain explained. C++ 14 recently was unveiled, featuring improvements to lambdas. Previously, Embarcadero Technologies cited C++ as a fit for cross-platform business applications running on devices.
The Djinni tool arose out of Dropbox's need to deal with the complexities of JNI (Java Notation). But then developers found they wanted to have it available to work with all languages. Djinni, according to the tool's GitHub page, generates parallel C++, Java, and Objective-C type definitions from an interface description file.