Slashdot Mirror


Facebook Has a New Private Mobile Photo-Sharing App, and They Built It In C++

jfruh writes: Facebook [on Monday] announced Moments, a new mobile app that uses Facebook's facial recognition technology to let you sync up photos only with friends who are in those photos with you. Somewhat unusually for a new app, the bulk of it is built in the venerable C++ language, which turned out to be easier for building a cross-platform mobile app than other more "modern" languages.

2 of 173 comments (clear)

  1. The details are interesting by SirJorgelOfBorgel · · Score: 4, Informative

    As probably many others, I've been looking into this exact problem for a while, comparing a lot of available options. Ultimately, I want something to run on Android, iOS, Windows (+ Phone), Linux, and OS X. The very complex core logic should be a write-once affair, while not having a single shared UI is not such a major issue, nor is writing some platform-specific utility classes. I have also come to the conclusion that C++11 for that core is the most viable option.

    Some interesting tidbits not mentioned in the summary is that they used DropBox's djinni to generate C++, ObjC and Java bindings; and they used the Flux unidirectional data flow architecture. Both of these things are worth reading about, more so than any thing that is actually mentioned in the summary.

  2. Re:Never underestimate by Dutch+Gun · · Score: 4, Informative

    Generally, you'd hide that sort of code behind some abstract interfaces. You don't need an #ifdef if you replace an entire .cpp file per OS target. My entire game engine, written in cross-platform C++, uses very few #ifdefs to divide between platforms (Windows/Mac/Linux).

    It's also clear the author doesn't really understand what modern C++ actually looks like because of this statement:

    It is less widely used, however, for mobile platforms, given that it can be a challenge to program in because it forces the developer to deal with memory management and other subtle nuances in abstraction.

    This simply isn't true any more for code written using modern (i.e. C++ 11/14) techniques. Using smart pointers (automatic reference counting) and proper RAII techniques means that you never really have to worry about explicitly managing your memory - you simply need to manage your object lifetime, and when all references are released, the memory goes away as well. In fact, while managed memory may be slightly superior in terms of ease of use, I've found smart pointers + RAII to be arguably *superior* for managing *other* types of system resources, because you can guarantee exactly when they'll be released (via a destructor).

    Also, I'm a bit confused about this:

    From Dropbox, the company borrowed a piece of software called Djinni, which converts C++ data models into Java code, the runtime language for Android.

    You can compile C++ natively for Android, so I suspect they're talking about using Djinni to automatically create an interop layer between their C++ code and Java, which would be handy for accessing a large portion of the SDK via Java. They also talked about how it's fairly easy to create an interop bridge between C++ and Objective-C, something I've also done with my own code.

    --
    Irony: Agile development has too much intertia to be abandoned now.