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.

15 of 173 comments (clear)

  1. Nothing about Facbook is private by sinij · · Score: 4, Insightful

    >>>Facebook 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, advertisers who are unlikely in these photos, law enforcement agents who are probably not in these photos, APT hackers that are no in these photos, and that dude who specializes in recovering data from used electronics that always presents at the conference.

    Fixed that for you.

    1. Re:Nothing about Facbook is private by Anonymous Coward · · Score: 5, Interesting

      I'd like to add that with employers intruding more and more on our personal lives - we are on the clock 24/7 these days even though we're only paid for 40 hours. They are starting to scrutinize every aspect of our lives.

      And what I find disturbing is that younger folks, who grew up with facebook and other crap like that, think nothing of posting pictures of parties or other gatherings where one might be doing something that your current or future employer may find objectionable.

      I am more paranoid about what a backgroundcheck would turn up than even government persecution - I haven't started hiding Mulsims from stormtroopers yet in my basement. But being denied employment because someone put a photo of me holding a tray of shots and hanging out with some cross dressing friends frightens me. The job is too capricious and managing ones image is extremely important - and it is a sucky World that we live in - thanks corporate America for having privatized Stasi!

    2. Re:Nothing about Facbook is private by OrangeTide · · Score: 4, Interesting

      If the vast majority of the new generation manage to piss off future employers, what are these businesses going to do, not hire anyone at all? Because they certainly aren't going to start hiring 50 year olds.

      --
      “Common sense is not so common.” — Voltaire
  2. Never underestimate by new_01 · · Score: 5, Funny

    a station wagon full of #ifdefs hurtling down the information superhighway.

    1. 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.
  3. Re:C++ by halivar · · Score: 5, Insightful

    If C++ is "the best tool" for cross-platform mobile app development, then the state of mobile app development is in a sorry state indeed.

    Seriously if C++ is the best we can do for *anything*, then we need to just throw in the towel and go back to pencil and paper right now.

    Taking such a strident and dogmatically absolutist stance on the usefulness of any language indicates a lack of experience in the field and a narrowness of understanding of the field. It sounds like someone told you it was really, really bad, and, knowing nothing else, you simply repeat what they said.

    C++ is, syntactically, not my favorite language. It's not even my second favorite language. But for its breadth of application, the ubiquity of compilers on any platform, and the sheer volume of useable libraries, it is up there on my list.

  4. C++ makes sense here by allquixotic · · Score: 3, Interesting

    C++ is so flexible that you can write all your nasty "legwork" code (performance-sensitive stuff, like the actual facial recognition, image data manipulation, etc.) *once* and call it from whatever UI layer you write.

    Granted, it's probably somewhere between hard and impossible to write a mobile platform-agnostic UI layer that actually looks good on both Android and iOS, since iOS and Android are so different in that regard; but even if they didn't bother doing that and just wrote two entirely separate view layers, they still can separate out all the heavy lifting and "write once, compile in two places". Both Android and iOS have decent to good C++ support, so if you make it platform-independent, you can have an optimized core library that works on the two major mobile platforms with no modifications.

    Not sure I would go with C++ for something that was less performance-sensitive, but in this case, they can probably peg the CPU of a modern smartphone for at least a good fraction of a second with some of their heavier code.

    Unless of course they are simply taking the image and uploading it to "the cloud" to do the facial recognition, in which case it's kind of a head-scratcher, since you don't need C++ to make HTTP requests.

  5. LOL by tylersoze · · Score: 4, Insightful

    On what planet is C++ an unusual choice?

    1. Re:LOL by Anonymous Coward · · Score: 3, Funny

      Planet script-kiddy.

    2. Re:LOL by Wraithlyn · · Score: 5, Funny

      Neptune. Software written in C++ on Neptune would be very unusual.

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
  6. C++ is best choice for many applications by Anonymous Coward · · Score: 3, Interesting

    Anything that has to be shipped outside your own organisation really has to be written in C++.
    Look at the alternatives for commercial development of retail applications:
    - Java - no good gui toolkits, resource hungry and bad latency. It is _possible_ to use, but never seems to be as performant as a native choice. Requires JVM. Contaminated and effectively dead as a platform as a result of Oracle's extremely, extremely, extremely extreme view on API copyrights, so not an option in my company any more sadly. Oracle really scared our lawyers, however crazy us technical people consider Oracle management to be, and however unlikely they are to prevail. SWT was the best toolkit I used for java GUIs. Definitely shippable.
    - C#/.NET - no portable choices for GUI toolkits. Shipping a binary mono that works everywhere is tricky on Linux due to dependencies on GTK. No acceptable portable UI toolkit. Winforms kind of works, but it actually rather clunky and nasty. My impression is that it performs better than java, I guess because we ahead of time compiled everything we built with it mostly.
    - C++ - Qt, GTK, wxWidgets all work as commercially supportable toolkits. I have shipped Qt apps. The best GUI toolkit I have used on any platform, when used properly. Dependencies in C++ are simple and easy to manage. C++14 also offers a never nice improvement over C++98 - almost like a whole new language. The traditional reasons for avoiding C++ are gone. Sure, it may be a mental burden to less competent developers to learn properly, but do you want to employ incompetents anyway?

    Of course, developing internal software, that doesn't need to be packaged and shipped on all customer's Linux and Windows is a completely different world.
    In this world, I would probably go with a mixture of C++ and C#, depending on project requirements.

  7. Qt for Android by mx+b · · Score: 4, Interesting

    Where do I get started building Android apps in C++? Inquiring minds suddenly want to know.

    The latest versions of Qt5 support building Qt/C++ apps for Android and iOS. I've never tried it for more than running a few examples, but it seems pretty nice and easy, and I've really enjoyed Qt development for years now.

  8. On Planet Millenial by Viol8 · · Score: 4, Funny

    The smart ones only know java , the rest think HTML +CSS are programming languages and javascript is the domain of almost omnipotent god like beings whose radiance they can only begin to emulate.

  9. And the news is? by gweihir · · Score: 3, Interesting

    Facebook has some actually competent coders that do not need to be coddled and do not start to cry if the language they use requires some actual understanding?

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  10. 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.