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.

123 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 Anonymous Coward · · Score: 1

      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.

      Hire H1-Bs from India.

    4. Re:Nothing about Facbook is private by ic3m4n1 · · Score: 1

      They will hire people who are more willing or even ready to sell their privacy. There is no shortage of such people who have more important needs to meet than their privacy or freedom.
      And then there are those who dont care. There is never shortage of ignorance in this world.

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

    6. Re:Nothing about Facbook is private by __aaclcg7560 · · Score: 1

      Meh. I had a government background check for my current IT job. The investigator and I spent four hours for a two-hour interview discussing every contracting job that I ever had in the last seven years. The security wonks find it strange that a person might actually have more than one employer at a time. We never discussed my Internet activities. I'm sure the Chinese will find my case file interesting.

    7. Re:Nothing about Facbook is private by Anonymous Coward · · Score: 1

      Easy. What companies did in the Gilded Age did. Import cheap labor from abroad, then watch the immigrants and the existing citizens fight each other for the scraps.

    8. Re:Nothing about Facbook is private by StikyPad · · Score: 1

      This is a case of selection bias. We see people posting ridiculous things, so we think everyone does, but believe me, there are plenty of people who don't post stupid shit to Facebook, and are -- not surprisingly -- very competent and responsible people, or who are at least competent enough to appear to responsible. There's no shortage of competition for jobs in sensitive industries, whether it's finance, government, or law, and yes, they pass on people who post stupid shit on Facebook.

    9. Re:Nothing about Facbook is private by DarkSage · · Score: 1

      As an MM, I am not sure I would really want to work for someone who finds the pictures of me holding a tray of shots or chilling with my cross-dressing friends offensive. If I did, I wouldn't post that stuff online, ever. I guess there are the ignorant, but not to be confused with the willfully disregarding.

    10. 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."
    11. Re:Nothing about Facbook is private by OrangeTide · · Score: 1

      They already hire H1-Bs, not because of behavior but because guest workers generally accept lower pay than a domestic new college grad.

      --
      “Common sense is not so common.” — Voltaire
    12. Re:Nothing about Facbook is private by OrangeTide · · Score: 1

      So this weeding out of objectionable individuals will mainly be applied to non-whites.
      I'm starting to see the problem here. :(

      --
      “Common sense is not so common.” — Voltaire
    13. Re:Nothing about Facbook is private by OrangeTide · · Score: 1

      Whew, I thought it was just every one of my friend's teenagers and most of the interns at work. But thanks for sharing, I'm glad it's only occurring among people that I interact with and is not a broader issue.

      --
      “Common sense is not so common.” — Voltaire
    14. Re:Nothing about Facbook is private by geoskd · · Score: 1

      As an MM, I am not sure I would really want to work for someone who finds the pictures of me holding a tray of shots or chilling with my cross-dressing friends offensive.

      Like most reasonably progressive people, your employer doesn't really care one way or another about anything you do on your own time except under a narrow set of circumstances where it negatively affects the company. The point of view from which they approach the problem is: What happens if someone from the general public finds these pictures and the association with our company is made. Capable business people are risk averse. If they have two candidates that are more or less equal in all other respects, the one that brings baggage like this will be rejected out of hand because they pose a higher risk. As such, any marginally competent HR department will work to weed out these kinds of risks as an early elimination criteria for weeding out resumes. For them its a matter of personal risk. If they let something like that through and the hiring manager finds out, there will be some fall out for the HR manager. Except in a CYA sort of way, no one actually cares one way or another about the individual, the only thing they care about is the impact on the company (leading to impact on their own careers).

      --
      I wish I had a good sig, but all the good ones are copyrighted
    15. Re:Nothing about Facbook is private by mrchaotica · · Score: 1

      The security wonks find it strange that a person might actually have more than one employer at a time.

      That's because it is strange (at least for IT jobs, not McJobs). Having multiple clients at a time, however, is not.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    16. Re:Nothing about Facbook is private by mrchaotica · · Score: 1

      As an MM...

      A chocolate candy? A cartoon Martian? Two-thirds of an adhesives company? Massively Multiplayer? WTF are you talking about?

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    17. Re:Nothing about Facbook is private by __aaclcg7560 · · Score: 1

      I worked for three IT jobs in 2011. A Monday through Friday PC refresh job at one Fortune 500 company, a weekend job as a PC disconnect/reconnect technician for a moving company with multiple Fortune 500 clients, and a month-long job at a Fortune 500 data center when the other two jobs went on break for the holidays. I typically worked 12 days straight before I got day off.

    18. Re:Nothing about Facbook is private by NostalgiaForInfinity · · Score: 1

      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.

      Nobody is forcing you to be a wage slave; you can run your own small business.

      And what I find disturbing is that younger folks, who grew up with facebook and other crap like that, think nothing of...

      What I find disturbing is that so many people, old and young alike, subscribe to the idea that the only way of surviving in the world is to become a wage slave.

      Even worse is that the very same people (you likely included) then advocate policies that make it harder for others to start their own businesses.

    19. Re: Nothing about Facbook is private by mattwarden · · Score: 1

      Unless you are an hourly employee, you are not being paid for 40 hours. Common thinking, but wishful thinking.

    20. Re:Nothing about Facbook is private by strikethree · · Score: 1

      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.

      Ummm... you already know the answer to this since you work in Silly Valley currently: They will bring in more H1Bs since there will not be enough "qualified" workers locally. Heheh.

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
    21. Re:Nothing about Facbook is private by OrangeTide · · Score: 1

      I don't agree that the newest generation's behavior on social networks is a uniquely American problem. I think kids in India, Romania, etc are going to get hit with the stored forever nature of social networks. I've seen things that make me cringe a bit already from old coworkers who happen to be on an H1B on my Linkedin, Facebook and Google+. Maybe the things I've seen aren't likely to impact a person's job prospects in most of Silicon Valley, but it may matter if a person is going to a more straight-laced industry like investment banking or military contracting.

      ps - Silicon Valley has been great, the money we print spends just like the real thing. ;-)

      --
      “Common sense is not so common.” — Voltaire
  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. surprising??? by Anonymous Coward · · Score: 1

    Only to people who don't know what the fuck they're talking about ;-)

    C++ is all over the place. Yes, it's a complex language. But it gives a hell of a lot more control over all the tradeoffs in software implementation than all the other "popular" languages, with pretty high-level abstractions at the same time.

    1. Re:surprising??? by halivar · · Score: 1

      Only to people who don't know what the fuck they're talking about ;-)

      I believe that was exactly the implication the GP was making.

  6. Never underestimate by new_01 · · Score: 5, Funny

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

    1. Re:Never underestimate by alex67500 · · Score: 1

      Of course, because the compiler leaves *all* those #ifdefs in the binary. You know, all those the preprocessor didn't catch.

    2. Re:Never underestimate by Anonymous Coward · · Score: 1

      If you have tons of ifdefs in your cross platform C++ code, you are doing it... well, not wrong.... but certainly in a boneheaded way.

    3. Re:Never underestimate by halivar · · Score: 1

      Ah, I remember fondly the old days of MUD code in C, written to support 15 flavors of UNIX, MacOS, and 3 flavors of DOS. The #ifdef's on the socket code could go on for miles.

    4. Re:Never underestimate by Viol8 · · Score: 1

      Not if it does a lot of low level systems calls. Unless you think win32 is going to work on Linux for example or Xlib will have no problem working on Windows.

    5. Re:Never underestimate by __aaclcg7560 · · Score: 1

      Especially if the station wagon gone to plaid.

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

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

      --
      Who ordered that?
    8. Re:Never underestimate by swillden · · Score: 1

      Not if it does a lot of low level systems calls. Unless you think win32 is going to work on Linux for example or Xlib will have no problem working on Windows.

      Even then #ifdefs are the wrong way to do it. Create a system abstraction layer (or use one of the several excellent ones that exist) and call that. Then for each platform build and link the appropriate implementation of the abstraction layer.

      The C++ committee has been aggressively removing all need for the preprocessor. Function-style macros should be inline functions. Macro-based code generation should be replaced with templates. Constants should be actual constants. About the only valid need left is for header inclusion (including guards) and C++ modules will eliminate the need for both of those (assuming they arrive in C++17).

      I doubt that C++ will ever be able to actually deprecate the C preprocessor, but we're moving towards not needing it any more.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    9. Re:Never underestimate by Rob+Riggs · · Score: 1

      Ah, I remember fondly the old days of MUD code in C, written to support 15 flavors of UNIX, MacOS, and 3 flavors of DOS. The #ifdef's on the socket code could go on for miles.

      Yes, and today we have POSIX and we code for that. And we use Boost ASIO to hide the Windows/POSIX differences from the application developer.

      --
      the growth in cynicism and rebellion has not been without cause
    10. Re:Never underestimate by halivar · · Score: 1

      Oh yeah! I forgot; we had #ifdef __posix, too!

      Absolutely non-obligatory XKCD: https://xkcd.com/927/

      But yeah, I was ripping out a lot of legacy code and replacing it with POSIX; this was the late 90's, so it was already well-established.

    11. Re:Never underestimate by phantomfive · · Score: 1

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

      For some features, the trick of using an "if" statement can keep the code readable. The compiler will optimize it out if it's not needed. For example:

      #define COOL_FEATURE_INSTALLED 1 .
      .
      .
      if( COOL_FEATURE_INSTALLED) { .
      .
      }

      That's something I learned from the Linux kernel.

      --
      "First they came for the slanderers and i said nothing."
    12. Re:Never underestimate by Dutch+Gun · · Score: 1

      Why not just use the standard:


      #ifdef COOL_FEATURE_INSTALLED
      #endif

      In debug mode, that runtime check is not guaranteed to be optimized out, even if it's not executed, but in my version it certainly would, because it's performed by the preprocessor. All a normal if() check with a constant is doing is obscuring the fact that you're removing code at compile time. It's also likely to generate a compiler warning of "unreachable code" as well. Just because it's in the Linux kernel doesn't mean it's necessarily a good practice, I'm sorry to say.

      Anyhow, I'm not saying #ifdef'd code isn't useful or has no place. I use it myself to switch diagnostic code on and off, or to completely remove profiling code in a release build, for instance. And it's great for wrapping new features so they can be instantly compiled out of the code for test purposes if needed. But for the most part, if you're scattering platform-specific #ifdefs throughout your code, that's generally not considered a very clean way to approach the problem - at least in my opinion.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    13. Re:Never underestimate by Viol8 · · Score: 1

      "Even then #ifdefs are the wrong way to do it. Create a system abstraction layer (or use one of the several excellent ones that exist) and call that. Then for each platform build and link the appropriate implementation of the abstraction layer. "

      Sorry, I disagree. Abstraction layers are inefficient and add to bloat especially if the code only differentiates in a few places between platforms. I'm sure they look nice on a whiteboard design but in the real world they're rarely the best solution for home grown code.

    14. Re:Never underestimate by Viol8 · · Score: 1

      >Because that's ugly when integrated with normal code.

      Is it? Seems cleaner to me. HYMMV.

      >These are really dumb reasons.

      They seem like good reasons to me. I think you're the one trying to argue your prefered method without any decent reasons to back it up other than you prefer it aesthetically.

    15. Re:Never underestimate by swillden · · Score: 1

      "Even then #ifdefs are the wrong way to do it. Create a system abstraction layer (or use one of the several excellent ones that exist) and call that. Then for each platform build and link the appropriate implementation of the abstraction layer. "

      Sorry, I disagree. Abstraction layers are inefficient and add to bloat especially if the code only differentiates in a few places between platforms. I'm sure they look nice on a whiteboard design but in the real world they're rarely the best solution for home grown code.

      Bah. Well-designed abstraction layers have no significant overhead. I've designed and built many of them.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    16. Re:Never underestimate by Viol8 · · Score: 1

      Zero overhead? And how pray do you manage that then genius? Any extra call adds overhead.

  7. 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 ClayDowling · · Score: 1

      C++ for Android is an interesting challenge, because there are multiple processor types out there. Although a Nexus 5 is pretty close to a reference platform.

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

      Doesn't seem to be directly C++ on Android, rather it's converted. It's just that the tools exist to convert C++ to Java and allow them to manage a single codebase.

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

      According to the Play Store, it allows me to install it on all my Lollipop devices:

      My T-Mobile LG G2, my Sony Xperia Z Ultra, and my Nexus 9.

      May be, they're doing a staged rollout thing. Staged rollouts are a good idea from a technical perspective. The marketing department hates them, but on a popular app they can avoid you thousands of negative ratings/reviews because there is always someone, whether it's an impatient higher up or an impatient developer, that tries to make one tiny little change to the final build that doesn't have the time to go through proper testing.

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

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

      Google's own documentation suggests that running native code isn't really a problem, and just use JNI to handle the interface.

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

  9. Re:"Sometimes the best tool for the job is the old by JustAnotherOldGuy · · Score: 1

    Shouldn't it be written in assembly then, or maybe on punch cards? :)

    --
    Just cruising through this digital world at 33 1/3 rpm...
  10. Translation by quantaman · · Score: 1

    Somewhat unusually for a new app, the bulk of it is built in the venerable C++ language, because the main guys on the team were big C++ fans who found a way to justify their preference.

    Not saying it was the wrong choice, particularly for the team in question, but I'm betting if you hand the project to another team you come up with a different language.

    Also interesting is it sounds like they're using an automatic code generator to translate some of the stuff from C++ to Java to run on android, maybe it will work seamlessly but that extra layer always makes me nervous.

    --
    I stole this Sig
    1. Re:Translation by halivar · · Score: 1

      I suspect it is more likely that they are using a critical library that is easier to code around than to reimplement in another language.

    2. Re:Translation by ic3m4n1 · · Score: 1

      I suspect it is more likely that they are using a critical library that is easier to code around than to reimplement in another language.

      That library could be their face recognition stuff written by some research team.
      Which "app" developers have no idea how to figure out in corresponding platform language.

    3. Re:Translation by Dutch+Gun · · Score: 1

      Maybe so, but C++ is actually a smart way to go if you need to write cross-platform code, especially now that C++ 11/14 has fixed a lot of the most troublesome and problem-prone aspects of the language. Other than C#/Xamarin, I can't think of another language that would be easily portable across all platforms, and C++ certainly has a performance edge for any sort of heavy lifting that has to be done on the client.

      C++ compiles natively on Android, so I *suspect* they're using that translation to automatically create an interop layer at the SDK bounaries. I don't know why they'd write in C++ only to translate the entire thing to Java. There might have been something subtle there lost in translation when talking to the media about this. Otherwise, yeah, I'd agree that this would make me nervous as well. I tend to avoid auto-generated code myself for exactly this reason - any bugs in it would be maddeningly difficult to find and fix.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    4. Re:Translation by Dutch+Gun · · Score: 1

      What's your opinion of C#/Xamarin for cross-platform apps that don't require a lot of client-side heavy lifting?

      I have no experience with it specifically (so take my advice with a grain of salt), but I do have quite a bit of C# experience. I think it's a pretty clean, readable language for the most part, so I certainly wouldn't be opposed to going that direction if I had a project that could make use of it. My feeling is that programmers are more likely to be more productive writing C# than C++. Personally, (I'm a videogame developer) I write all my game development tools in C#, while my game and engine code are C++, if that tells you anything. Many professional videogame development houses do the same.

      To be honest, a big part of it is also what the project developers are comfortable with as well. If they're all C++ experts, it might not be worth switching to C#. If you've already got some C# experience (or even Java), Xamarin/C# might not be a bad way to go. C# is shaping up to be a very portable language (at least the core language and libraries) thanks not only to Xamarin, but also Microsoft's recent efforts at making it all open source.

      --
      Irony: Agile development has too much intertia to be abandoned now.
  11. You've been given a facial by MrKaos · · Score: 1, Insightful
    Bye bye freedom to walk anywhere and not be geolocated by a fucking computer with some exif data. They must be licking their lips for the amount of association data they can mine with people using this technology.

    We could call it 'getting facefucked' and the cameras could now squirt semen in people's face to complete the experience.

    --
    My ism, it's full of beliefs.
    1. Re:You've been given a facial by drinkypoo · · Score: 1

      We could call it 'getting facefucked'

      Imagine the fun that you'd have googling for that!

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  12. 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.

  13. 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
    3. Re:LOL by __aaclcg7560 · · Score: 1

      Especially in a colorless, squeaky voice.

    4. Re:LOL by Actually,+I+do+RTFA · · Score: 1

      Yeah, I'd imagine most software on Neptune is written in plain old C. Maybe Assembler, given how long it takes a probe to get there.

      --
      Your ad here. Ask me how!
    5. Re:LOL by Threni · · Score: 1

      In the exciting world of html hairdressers, where this week's javascript framework and version control tool is far more important than writing code that's going to be stable, fast and be around in more than 2 months.

    6. Re:LOL by Bite+The+Pillow · · Score: 1

      Mobile code, you idiot, which is what we are talking about here. There's a thing called "context" which is important when talking with anyone who is not yourself, and you should learn all about it.

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

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

      Google "Android NDK". That should point you in he right direction. However, I am not sure how much of the "app" is C++ versus the back end, which is the more likely place for the image processing to occur and C++ is an excellent tool for image processing.

      --
      If you are not allowed to question your government then the government has answered your question.
    3. Re:Awesome, where do I start? by Anonymous Coward · · Score: 1

      The Android technology that allows this is called the NDK (https://developer.android.com/tools/sdk/ndk/index.html). Unfortunately, this is not a magic bullet that takes your existing C++ code and turns it into an Android app. In general, you should think of this as defining some classes/methods in Java but then the implementation of those methods is in C/C++. This can create some big headaches with having to access Java classes/methods/properties from the C++ layer.

    4. Re:Awesome, where do I start? by Anonymous Coward · · Score: 1

      As others indicate. Qt5. You can build, test, and debug on desktop, then build APK for deployment - some minor issues - all C++ and Qt APIs - and sensor support.

    5. Re:Awesome, where do I start? by KGIII · · Score: 1

      how lazy can you be. sheesh.

      I don't know. Can you Google "what or who is lazier than KGIII" for me?

      --
      "So long and thanks for all the fish."
    6. Re:Awesome, where do I start? by Bite+The+Pillow · · Score: 1

      Did you mean C++, which is what GP was talking about, or stating a completely unrelated fact? Because Wikipedia supports either interpretation - I'm just concerned that you might be having a stroke and need help.

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

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

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

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

  19. "Venerable"? by T.E.D. · · Score: 1

    C++ is "Venerable"? Based on its first standard version, it is 17 years old. Seriously, we set the bar of language decrepitude at only 17 years?

    I might might let it slide if you used that adjective for C or something even older. But C++ has only just now gone through enough revisions to start getting halfway decent. You wanna just chuck it in the retirement home right when they are starting to get some of the kinks worked out? One or two more revisions and they were going to get it up to the capabilities of Ada. :-)

    Brutal.

    1. Re:"Venerable"? by putaro · · Score: 1

      I learned C++ in 1987. The original Stroustrup book came out in 1985, so more like 30 years old.

    2. Re:"Venerable"? by art123 · · Score: 1

      "17 years old" is only a damnation of the C++ Standards Committee and the slow pace of standards bodies in general. C++ has been used in commercial applications since before 1990 putting it at 25+ years old.

    3. Re:"Venerable"? by MightyYar · · Score: 1

      "Venerable" does not quite mean "decrepit". The meaning is more like respect for an elder. "Official standard" or not, it has been around as a real language since the early 90s (Borland?), which definitely makes it an elder in computer land. I mean, Windows is written in C++ and it definitely gets the "venerable" title by now.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    4. Re:"Venerable"? by JMZero · · Score: 1

      You realize venerable is a positive word, right? It implies age, sure, but the point of it is "respected" not "decrepit" or "ready to retire".

      --
      Let's not stir that bag of worms...
    5. Re:"Venerable"? by T.E.D. · · Score: 1

      The original start date is quite debatable. Some argue back even further (like '79!). Its complicated because C++ had an unusually long development period. Personally I don't really consider anything prior to C++ "2.0" (1991) to be anything more than an experimental waypoint in the development of the language. After that you can start making arguments, but I still don't put it before the first true compilers (not precompilers) became widely available and a lot of people starting using it for serious projects. The 1998 ISO standardization is a very convenient milepost for that time.

    6. Re:"Venerable"? by david_thornley · · Score: 1

      Yeah. I worked with pre-standard C++ and standard C++. Even if we're just talking about C++98, I vastly prefer the standard version. Push that forward to 2011 and 2014 and the language is far better yet.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    7. Re:"Venerable"? by putaro · · Score: 1

      1998 may be a "convenient" mile post but it doesn't reflect reality. There was a lot of large scale development going on in C++ in the early & mid-90's. By your measurement, C++ is younger than Java!

  20. Select the best tool for the job by grogovich · · Score: 1

    Please note the following quotes from the article:

    With C++, “a lot of our more complicated logic can be written once and run on both iOS and Android,”

    Due to the complexity and the performance required, HTML / Cordova were not viable options ( see http://magenic.com/Blog/Post/4... Test 4: Prime Number Calculation, where cordova takes 12 - 23 times longer to run than native / xamarin). This performance is not an issue for most applications, but for something like face detection you bet this has an impact.

    In regards to Xamarin, it could have been a viable solution. The main issue here though is that doing work on images is a lot harder to do performant without pointers in c# (ignoring unsafe code), and in a portable class library so it can be shared (limited support for images).

    The best performance wise (ignoring memory, Xamarin seems to manage memory better in most instances) would be to go native. But doing this means that you would have to write the complex calculations twice, once in swift/objc and java.

    So this leaves doing it in c++. This is indeed possible, but you would only do this when you have very complex and performance dependant code that you do not want to write twice (for example, image manipulation). If you pick c++ for any other reason, you are most likely picking the wrong technology as it is more difficult to write mobile applications in c++ than the other languages (yes, the other languages have abstractions, that is because most applications have no need to care about low level operations).

    So Facebook, look at their business problem and solves it using the best tool available. This does not mean that c++ is the correct technology for all cases.

    1. Re:Select the best tool for the job by david_thornley · · Score: 1

      If you write C++, you may find it worthwhile to write the abstractions yourself, and not worry too much about low level operations once you've done that. Of course, writing the abstractions requires a lot more knowledge, skill, and time than just using them.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  21. 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 narcc · · Score: 1

      The smart ones only know java

      Years ago, Slashdot used to disparage the kiddies who used Java.

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

      Today, the inmates run the asylum.

    3. Re:On Planet Millenial by mrchaotica · · Score: 1

      Today, Slashdot disparages narcc for not understanding "damning with faint praise" when he reads it.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  22. 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.
  23. Re:unauditable code, nice by stephanruby · · Score: 1

    ...they've essentially guaranteed that it's unauditable by anyone not on a short list. +1 to you, Facebook.

    There must be some confusion on your part.

    This is not an open source project and this is not a web site. Any app they make that takes advantage of the native functionality of the camera is most likely going to be in a black box, whatever language they choose.

    And one would think that Facebook hired enough developers that can program in C++ to have proper code reviews.

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

    1. Re:The most cross-platform is C by maugle · · Score: 1
      Because

      When people design a platform, one of the first thing they do is make it run code written in C.

      Only a limited subset of platforms can run Java, but everything can run C.

    2. Re:The most cross-platform is C by strikethree · · Score: 1

      Actually, C is indeed awesome for cross-platform compilability; however, try using libraries cross-platform. Nastiness.

      For example, the crypt() function. Call it under Linux and call it under OpenBSD and see how that works out for you. Yes, it is possible. I am not even sure that is available in Windows.

      Pure, ANSI standard C will compile under any platform. It is the details (libs) that kill you.

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
    3. Re:The most cross-platform is C by david_thornley · · Score: 1

      If you have a C or C++ compiler, it will compile to native code on whatever system you're using. You do need to be able to compile to that, but the array of systems that C and C++ compilers address is vast (particularly C). Languages called "cross-platform" typically require their own platform, often a virtual machine. This isn't necessarily obvious. You can compile a Python program to a .pyc file, but it isn't native code.

      The platform in question may be available on all the systems you're considering developing for, and you may well have confidence that it will continue to be that way, and that's fine. However, if you're going to have to port the platform yourself or have somebody else do it, it's easier to just get your own program (in C or C++) working on it.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  25. 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.

  26. C and family = optimal by Teunis · · Score: 1

    If you want fast applications, write them in C or one of the C family (C++, Objective C). If you want fast to write code, don't then,
    There's yet to be a single language that can compete with that language group for speed, capability and power of the resulting code (providing it's relatively bug-free) It's a higher cost of production for a better quality result.

    While occasionally a really well-tuned script language can match it for capability (perl succeeded there) - usually they cannot.

    And anyone who calls these "Venerable" has to realize they're being arrogant in a way they can't back up, because they're linguistically implying obsolescence.

    1. Re:C and family = optimal by firewrought · · Score: 1

      If you want fast applications, write them in C or one of the C family (C++, Objective C).... There's yet to be a single language that can compete with that language group for speed, capability and power of the resulting code.

      A lot of the speed is due to hardware, operating systems, and compilers all converging on C and C++ at a critical juncture in computing history. They've had the benefit of shitloads of academic and industry research into optimization (of which other languages have only recently started to benefit in the past decade as JVM, LLVM, and V8 started receiving lots of attention). That's not to poo-poo the speed advantage--C is definitely the gold standard there--just to contextualize it from a language design standpoint. In 20/30 years it could easily be the case that Go, D, or some ML/Haskell variant is the fastest due to compilers being able to better reason about how programs in those languages behave.

      --
      -1, Too Many Layers Of Abstraction
    2. Re:C and family = optimal by KGIII · · Score: 2

      Venerable is not a bad thing.

      --
      "So long and thanks for all the fish."
  27. Re:As polite as I can be... by CaptainDork · · Score: 1

    This.

    But, politely of course and stuff.

    --
    It little behooves the best of us to comment on the rest of us.
  28. Re:C++ by Palinchron · · Score: 1

    While C++ happens to be useful for cross platform mobile development, that's not because of C++ itself is better at cross platform development.

    Yes it is. Well-written C++ code will run on any platform, whereas even the best java code only runs on the java platform. This makes C++ much more suitable for cross platform development than java.

    Is this sophistry? I don't think so. Java is not a cross-platform system, java *is* a platform. And I think that no matter what the initial intentions may have been, time has shown that languages that compile to any platform, while less convenient than languages that bring their own platform, are actually the more flexible and practical for cross platform development of the two designs.

    --
    The lesson here is that a sufficiently large corporation is indistinguishable from government. --ultranova
  29. c++ across all platforms by MakerOfBattle · · Score: 1

    I make apps, using Qt, for Desktop (Win, Mac & Linux), Android and iOS. Having the same source code (which happens to be c++) across all platforms allows me to master one tool kit and spend time make more apps instead of learning a new language every time Apply or Google feels like it.

  30. Re:C++ by LynnwoodRooster · · Score: 1

    So what you're saying is we need to create a new language, one that could be "write once, run everywhere" capable...

    --
    Browsing at +1 - no ACs, I ignore their posts. So refreshing!
  31. 2 kinds of languages by ColdCat · · Score: 1

    "There are only two kinds of languages: the ones people complain about and the ones nobody uses"
    Bjarne Stroustrup

  32. 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.
  33. Re:C++ by phantomfive · · Score: 1

    Yes it is. Well-written C++ code will run on any platform, whereas even the best java code only runs on the java platform. This makes C++ much more suitable for cross platform development than java.

    I have another way of looking at the same point........C is the most portable language, because if you write a library in C, it can be used from any language. Java, Python, TCL, Perl, Pascal, Fortran, C#, R, Javascript, D, Go, Ocaml, PHP, etc can all call into a C library (and a lot of the interfaces can be built automatically). If you write in Java, you're stuck building on top of it in Java.

    --
    "First they came for the slanderers and i said nothing."
  34. 1970s? by Fnord666 · · Score: 1

    Initially developed in the late 1970s, C++ is a powerful general-purpose programming language, and is still widely used for writing mission critical and performance-sensitive applications.

    Hardly. Stroustrup first introduced C with classes at Bell Labs in 1979. It wouldn't be known as C++ until at least 1983.

    --
    'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
    1. Re:1970s? by Firethorn · · Score: 1

      Hardly. Stroustrup first introduced C with classes at Bell Labs in 1979. It wouldn't be known as C++ until at least 1983.

      While related and mostly compatible, C and C++ are different languages.

      --
      I don't read AC A human right
  35. Re:C++ by LWATCDR · · Score: 1

    Now such thing as an ideal solution.
    As you point out c/c++ is often the best for the job.
    People forget about things like IDEs, compilers, debuggers, and libraries.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  36. I dumped Objective-C and haven't looked back. by EmperorOfCanada · · Score: 1

    I learned Objective-C so that I could deploy on iOS and otherwise wouldn't have given the language a second look. Then I discovered Cocos-2d which makes C++ on iOS, Android, etc very easy so boom I happily made the leap back to C++ and haven't looked back. There is pretty much zero chance that I will write more than a few dozen lines of Objective-C again in my life. There is also pretty much zero posibility that I will write any swift and I certainly have dodged the Java bullet for Android.

    About the only problems that I have encountered are some artificial ones where some API features are cut off from me without a tiny bit of Objective-C or Java. But those tiny bits get wrapped in a C++ class and forgotten.

  37. C++ vs paper and pencil by DrYak · · Score: 1

    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.

    Sometime, "pencil and paper" *are* the best tool for the job, because they work everywhere.

    Same for C++:
    It's maybe not Dart (for Google Chrome), nor Rust (for Firefox), nor Swift (latest gen iOS), nor whatever is the latest cool thing (scala ?) to run on a Java machine (for Android), nor Ruby (is that the lastest hipster thingy on servers ?)
    But it works everywhere. Thus there *are* legitimate solution were using the older or simpler tool is better than all the modern hyped bells and whistles.

    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
  38. Re:unauditable code, nice by KGIII · · Score: 1

    Nah, they hired one guy named Larry and he is really a Python developer with some PHP experience.

    --
    "So long and thanks for all the fish."
  39. Re:C++ by KGIII · · Score: 1

    For me it was the co-owner with the large(ish) revenue. If you are the co-owner you are probably not going to be a code monkey. This is not always true but it is likely more true with increased revenue. I have been the sole proprietor of a very profitable company and, alas, once we reached the level of reasonable prosperity I was too busy to code or even help build hardware. To be honest, I much preferred having my hands in the pot over managing. It was far more effective and efficient to have dedicated staff due to distractions, important business, and lapsed skills. There could be, and likely are, exceptions but this one seems a bit sketchy though their revenue is not all that high but high enough to the point where they should likely be doing more productive things.

    --
    "So long and thanks for all the fish."
  40. "the best we can do" by foreverdisillusioned · · Score: 1

    He didn't say C++ was worthless. He said it would be a pretty bad thing if it was "the best tool" or "the best we can do", and going by the rest of your comment I'm not sure if you'd completely disagree.

    Take away its heritage advantages (libraries and compilers-- "it's popular for being popular"), and you are left with what exactly?

    Let's see, you have almost-foolproof C compatibility... except most other languages can link to C code. Annnnnd... hmm. I can't really think of anything else. High performance OO maybe, but other languages can do that in more powerful ways (including Objective C).

    1. Re:"the best we can do" by david_thornley · · Score: 1

      What do you have left? An immensely expressive language that can be compiled to be screamingly fast. It's pretty easy to learn to use (although a lot harder to reliably understand older code). Many libraries depend heavily on C++ templates and overloading to present themselves in an easy-to-use manner. You don't want just anybody working on code like that, but you can have just anybody using it once written. Use it with a disciplined style and you avoid all sorts of problems C is prone to, at little or no cost in performance.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    2. Re:"the best we can do" by foreverdisillusioned · · Score: 1

      An immensely expressive language

      I just have to say that speaking as a Common Lisp fan, this sort of thing makes me choke a bit. C++ templates are a very hobbled, messy version of what you can do with a Lisp macro and/or a CLOS generic function. While it's true that optimized C will be 2x-3x faster than fully optimized Common Lisp (most people think it's orders of magnitudes, but it's not. CL is a very mature, fully compiled language with plenty of ways to optimize, including turning on static typing), I very much question whether the messy, verbose, and quite limited 'expressiveness' of C++ is worth it.

      C++ and its bastard child Java are responsible for infecting the minds of countless computer programmers with all manner of horrible square-peg-round-hole paradigms, which are triumphantly proclaimed as "design patterns" instead of "hacky verbosity that makes self-documenting code much more difficult to write".

  41. Re:"Sometimes the best tool for the job is the old by mrchaotica · · Score: 1

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

    Why is that modded funny? It's not a half-bad idea!

    (Of course, these days when you want half-Lisp, half-Fortran, you use a different syntax and call it Matlab (or GNU Octave). It's better than using C++, at any rate!)

    --

    "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  42. Mobile apps since before iOS and Android by tepples · · Score: 1

    What's news to me is that (most of) an app on any mobile platform can actually be written in C++

    What do you think games for Nintendo DS, PlayStation Portable, Nintendo 3DS, and PlayStation Vita are written in?