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.
>>>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.
one in the toolshed."
So, what, it's written in Lisp with some Fortran libraries?
>> 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.
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.
a station wagon full of #ifdefs hurtling down the information superhighway.
... Oddly enough. At least, that's what the Play Store says. Maybe some other restriction in place.
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.
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.
On what planet is C++ an unusual choice?
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
Venerable is not a bad thing.
"So long and thanks for all the fish."