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.

33 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
    3. Re:Nothing about Facbook is private by tlambert · · Score: 2

      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.

      This strategy seems to be working for military and police agencies not hiring white hats who were formerly grey hats or black hats.

      Oh wait. The government keeps getting their computers successfully attacked... guess it's not a great strategy after all. Never mind.

    4. Re:Nothing about Facbook is private by KGIII · · Score: 2

      I have no room for Muslims in my basement. That is where I keep my small Lithuanian boys and an elderly man of indeterminate (Hispanic?) ethnicity. The boys carry my packets to and from the ISP's network. The elderly man whistles a mean modem. I call them Team Server Room II. They replaced Team Server Room after the infamous 'Halon Incident.'

      --
      "So long and thanks for all the fish."
  2. "Sometimes the best tool for the job is the oldest by Anonymous Coward · · Score: 2, Funny

    one in the toolshed."

    So, what, it's written in Lisp with some Fortran libraries?

  3. Re:unauditable code, nice by xxxJonBoyxxx · · Score: 2

    >> modern certification mills

    If you try to put someone who doesn't already understand a half-dozen languages (and can pick up others in days) in an "auditing" position, you pretty much deserve what you're about to get.

  4. Re:unauditable code, nice by Minwee · · Score: 2

    With modern certification mills cranking out millions of Java and .Net and Framework and Node.js and Shiny chimps, they've essentially guaranteed that it's unauditable by anyone not on a short list. +1 to you, Facebook.

    Agreed. People on the short bus shouldn't be doing code audits. Leave the real programming to grown-ups.

  5. 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.
    2. Re:Never underestimate by Jamu · · Score: 2

      No matter how good your tools, sometimes you need duct tape.

      --
      Who ordered that?
  6. Not compatible with my Nexus 5 (Lollipop 5.1) by MurukeshM · · Score: 2

    ... Oddly enough. At least, that's what the Play Store says. Maybe some other restriction in place.

    1. Re:Not compatible with my Nexus 5 (Lollipop 5.1) by sunderland56 · · Score: 2

      C++ for Android is an interesting challenge, because there are multiple processor types out there.

      Remember when Apple was shipping MacOS for both Intel and PPC processors? C++ programs worked just fine. There's not much in computer science that hasn't already been solved.

    2. Re:Not compatible with my Nexus 5 (Lollipop 5.1) by NecroPuppy · · Score: 2

      The NP problem sets would like to have a word with you.

      --
      I like you, Stuart. You're not like everyone else, here, at Slashdot.
  7. 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.

  8. 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.

  9. 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
  10. Awesome, where do I start? by Anonymous Coward · · Score: 2, Interesting

    I'm completely ignoring the "Facebook" part of this announcement. What's news to me is that (most of) an app on any mobile platform can actually be written in C++ instead of Java or Swift. I quite seriously had no idea this could be done. The few times I've dabbled in Android development, for example, absolutely everything centered around Java. I've never played with iOS development because I don't have a suitable device, but I assumed you had to go with Objective C or Swift.

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

    1. Re:Awesome, where do I start? by mariox19 · · Score: 2

      There has never been any problem with integrating C code in Mac OS X or iOS.

      --

      quiquid id est, timeo puellas et oscula dantes.

  11. Re:C++ by bhcompy · · Score: 2

    They don't claim best tool, you did. They made something based on the skillset they possess and the requirements in front of them. The fact that C++, a powerful, flexible language, has the tools available isn't a bad thing. I'm not sure why you would think it was

  12. Re:C++ by halivar · · Score: 2

    An ideal solution solution would be to have a cross platform higher level language, and to just use C++ for it's intended use on these platforms which is primarily just computation or providing access to an existing library, not driving the actual logic of the overall app.

    In software development, you never get to use the "ideal solution" because it invariably, as exemplified by this case, doesn't exist. The "best tool for the job" is always a local optimum.

  13. 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.

  14. 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.

  15. 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.

    1. Re:On Planet Millenial by halivar · · Score: 2

      Today, the inmates run the asylum.

  16. 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.
  17. The most cross-platform is C by GuB-42 · · Score: 2

    Seriously, if you want to write something that works in any platform, write it in C, C++ is a second but still valid choice.
    When people design a platform, one of the first thing they do make it run code written in C. It is also the language of choice for everything UNIX : Linux, BSD, GNU, etc... It is well standardized too : sure, it is easy to shoot yourself in the foot but if you code properly, it should work on any platform. And as an added bonus, good C code is also valid C++ and ObjC.

  18. 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.

  19. Re:unauditable code, nice by DrVxD · · Score: 2

    In fact, that 'certain amount' is so large that you actually need a KoolAidFactoryManagerHelperFactoryBuilder.

    --
    Not everything that can be measured matters; Not everything that matters can be measured.
  20. Re:C and family = optimal by KGIII · · Score: 2

    Venerable is not a bad thing.

    --
    "So long and thanks for all the fish."