HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I"

CppCon · Youtube · 181 HN points · 7 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention CppCon's video "CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I"".
Youtube Summary
http://www.cppcon.org

Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/CppCon/CppCon2014
--
"How Microsoft Uses C++ to Deliver Office (and More) Across iOS, Android, Windows, and Mac, Part I"
--
What does it take to target multiple major mobile devices (as well as traditional environments) with portable, efficient, single-source code? This talk demonstrates architectures, techniques, and lessons learned rooted in actual experience with using C++ to deliver several major cross-platform projects across iOS, Android, Windows, and Mac: Microsoft Office (Word, Excel, PowerPoint, OneNote) and the SQL Server PowerBI. Each presents a different case study: For example, Office already used C++, whereas PowerBI was originally written in Silverlight and then rewritten in C++; Office is a set of user-facing apps, whereas PowerBI is a system component. Although some of these are demanding first-tier “Cadillac” applications, we expect this experience to be a model for the future as more and more apps fall into this category and use C++ to target many popular platforms from (mostly) a single source base. This talk will cover the following key topics and tradeoffs: Rich vs. reach, including access to latest OS features (e.g., iOS 8 additions) and hardware features (e.g., vector units, GPUs). Consistency of functionality. Client code vs. server/service web code. Sharing vs. quality, including dialing appropriately between more shared code and high quality code. Drawing the line between the bulk of C++ code and interfacing with non-C++ for UX and PALs (platform adaptation/abstraction layers) for target-specific user interface and system services. Architecting PALs, including why “mini-PALs” rather than an “über-PAL.” Forces “doing the right thing” and good architecture with composable components. How C++ enables things not feasible using other technologies. Velocity and enabling faster cross-platform development and deployment. Cost of maintenance, including time, size, and complexity (both breadth and depth). And, last but not least, developing in a single modern C++ source base built with different evolving C++ compilers, including VC++ and Clang/LLVM.
--
Igor Zaika is the Development Manager for the Office Core Experience team at Microsoft, responsible for shared UX components and application framework used by Office applications. Before that, Igor worked in various areas related to Office client applications, ranging from building Word Object Model and integrating VBA (Visual Basic for Applications) with Office, to shipping first version of OneNote for the WinRT platform. Before joining Microsoft, Igor worked on 3D CAD application and contributed to the Kronos project .
--
Tony Antoun is Director of Development for APEX, focusing on delivering Office on all Apple platforms and form factors (iPhone, iPad, Mac), as well as aligning the Office experience on other major platforms (Win32, WinRT, Android). Before that, Dev Manager for SQL PowerBI – a cross-platform interactive client data visualization solution (iOS, WinRT, Web) connected to the SQL Reporting cloud service. Before that, Dev Manager for HD-DVD, cross-plat client solution for High Definition interactivity of media experiences (Win32, WinCE, Linux, Xbox).
--
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Yes, C++ with native views.

How do you think Microsoft does Office on Android and iOS?

As for verification, they have plenty of talks at CppCon and BUILD about how they do it.

EDIT: to save you some work.

CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I"

https://www.youtube.com/watch?v=3HROqnw-nf4

CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part II"

https://www.youtube.com/watch?v=MGMoRu5yrVc

Reacting to Dropbox: another take on cross-platform C++ development

https://dev.to/tanker/reacting-to-dropbox-another-take-on-cr...

Ashampoo Systems GmbH

https://www.boden.io/

adev_
Thanks for the link, I did not know boden.io

https://www.boden.io/

Looks cool on paper. Anybody around has experience with it ?

I did provide the information for it, Dropbox and Microsoft talks at CppCon, easy with some Google fu.

CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part I"

https://www.youtube.com/watch?v=3HROqnw-nf4

CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms, Part II"

https://www.youtube.com/watch?v=MGMoRu5yrVc

CppCon 2015: Jacob Potter & Andrew Twyman “Bridging Languages Cross-Platform..."

https://www.youtube.com/watch?v=K-k-axW2utc

CppCon 2017: Stephen Spann “Cross-Platform Apps with Dropbox’s Djinni...”

https://www.youtube.com/watch?v=ssqhz_1pPI4

CppCon 2014: T. Grue & S. Kabbes "A Deep Dive into 2 Cross-Platform Mobile Apps Written in C++"

https://www.youtube.com/watch?v=5AZMEm3rZ2Y

Naturally the native UI has to be used.

Are we talking about having a good user experience here, or having the easy lazy path for the developer?

Since 2014 not anymore.

The Office team did a couple of session at CppCon about how they refactored the code.

"CppCon 2014: Zaika Antoun "Microsoft w/ C++ to Deliver Office Across Different Platforms"

https://www.youtube.com/watch?v=3HROqnw-nf4

https://www.youtube.com/watch?v=MGMoRu5yrVc

I wonder, not long ago there was a c++ conference were two Microsoft employees were talking about the Office mobile apps and how they developed it [1]. They said that they developed the main part in c++ and the ui part in the respective ui platform (cocoa/android ui framework).

Would be interesting why they moved from this approach to React native.

[1] https://m.youtube.com/watch?v=3HROqnw-nf4

Word for Windows and Word for Mac are much closer together than you may realize. Pretty interesting talk about cross platform Office.

Part 1: https://www.youtube.com/watch?v=3HROqnw-nf4 Part 2:https://www.youtube.com/watch?v=MGMoRu5yrVc

Analemma_
Ah, interesting. I always just took it for granted that the old Office codebases were huge beasts, but maybe not. Thanks for the info!

Still, no matter how nice that codebase is, I assume they can't beat Electron for ease of X-platform compatibility.

No. They actually share >95% of the desktop code-base: https://www.youtube.com/watch?v=3HROqnw-nf4
darkr
I'm not sure which is better
DiabloD3
Of all the comments so far on this, this is maybe the coolest. You can really see how Office on OSX has shaped up (if you follow the beta; identical Windows and OSX support on launch day instead of OSX getting it 2 years later like it's been for the past decade), but I'm surprised Android also shares a significant amount of the code base.

It cuts down on bugs, and also makes sure the bugs that are on the desktop are also the same ones on my phone (principal of least surprise at work).

There's a pretty interesting video of how the Office team uses C++ for their cross-platform efforts from CppCon 2014: https://www.youtube.com/watch?v=3HROqnw-nf4
Dec 01, 2014 · 181 points, 56 comments · submitted by wslh
jdswain
We do this as well, targeting Mac, Windows, Linux, iOS and Android with the same C++ core libs. It seemed to be the only way to target multiple platforms without a huge team. It's not all easy though, the work of maintaining the JNI bridge is large, even with most of the code being generated automatically, With the woeful state of native debugging on Android it may have been almost as easy to recode in Java, but maintaining two code bases would have been a real hassle, its hard enough keeping all the UI's in sync.
pjmlp
I just do Android and WP as hobby.

SDL was ok for games, but now with a real app, I tried the Qt way, only to discover there are still lots of issues.

So I figured out, better use JNI and C++/CX directly and save the pain of figuring out bugs in Qt.

In the end, the JNI pain is bigger than figuring out Qt bugs and helping those guys.

For small devshops there is a lot of time to be saved by letting third parties like Digia and Xamarin have to go through the pain of writing platform specific wrappers.

If I was doing mobile OSs for work, I would gladly pay for them.

ryandrake
Same here, C++ for the business logic, maths, engine, etc., OpenGL for the graphics, and then a relatively thin platform-specific layer of Obj-C,Java/JNI,Qt just for the UI. Saved a lot in terms of not having to have multiple teams basically writing the same stuff in different languages.

One of the weirdest things we had to overcome was actually the cultural aspect. For the Linux client, nobody had any problem with the architecture: Get the Qt client working and hook it up to the plumbing. Done. For the iOS guys, still no problem, but let's make sure we separate the C++ cleanly from the Objective-C through a solid, well-understood interface so our food doesn't mix. The Java guys basically threw a hissy fit, objecting to all of this C++ nonsense infecting the purity of their Java. Every time the app crashed: they blamed the C++ code. Every performance problem was because C++. Grandma got sick? C++. When tracking down a bug, they'd step through their Java layer, and as soon as it hit the JNI, they'd just stop and file a bug to the core team rather than dirty themselves stepping through C++. They culturally wouldn't accept C++, and wanted to instead have a separate parallel tree with Java business logic, Java math, Java graphics, etc. The hard reality, however, was that the Android client wasn't bringing in enough revenue to justify a full parallel team and code base. Despite all the grumbling, going the C++ route was a huge success, letting us support multiple platforms with mostly the same code base.

I'm curious as to whether this borderline religious anti-C++ attitude is common in the Java/Android ecosystem, or an outlier? I found it really bizarre.

pjmlp
C++ is unsafe thanks to its C compatibility, unless Modern C++ idioms are being used.

So it is natural in a world full of out of bounds exploits, hazardous pointers and use after free/delete, to complain about them.

As for Android, it comes even from the Google team, given the little support they give to the NDK.

maxlybbert
It's a common article of faith among Java guys, who will tell you that there is no way you can write a safe program in a native language, although they can't really say why (it's effectively hearsay) other than pointers are involved. If Gosling said to use Java, who are they to question it?
None
None
maxlybbert
For fun, mention that OpenJDK has over a million lines of native code (C and C++: https://gist.github.com/shipilev/2fddb1d2943a4cbb6080 ). Looking at the numbers for the hotspot directory, more than 2/3 of the code in the JVM itself is native code. I realize that this is caused by bootstrapping issues. But if someone believes it is truly impossible to write safe and secure native code, ask how they can trust the JVM to correctly run their safe program, given that it has so much native code.

I know the old argument was that it was easier to audit the (small) amount of native code in the JVM than the code in your specific project. But half a million lines isn't small by any definition I'm aware of. It's larger than any native projects I've worked on.

the_why_of_y
It's quite likely that the skill and experience level of the average OpenJDK Hotspot committer is a couple notches above the average... and to them things like the manual resource management you have to put up with in C/C++ are not a pointless distraction from their business problem, they are a core part of it.

Besides there are JVMs implemented in Java too, just not with as high performance as Hotspot... search for Maxine or Jikes RVM.

maxlybbert
So is it possible to write safe software in a native/unsafe/unmanaged language if you know what you're doing? Wow, that's exactly what I tell people, but it isn't what you read on the first page of any number of Java programming books (of course, those books tell you that you must do manual resource management in C or C++ which is not, in fact, true ( e.g., http://www.apachetutor.org/dev/pools and http://www.artima.com/intv/modern3.html )).

And, really, who wants to use a language designed for people who don't know what they're doing?

I'm not saying that it's impossible to write a JVM in a managed language. Just that it's funny to hear people talk about native languages with a hint of fear, and then run their "safe" programs on a VM that is implemented with a half million lines of C and C++.

pnathan
> I'm curious as to whether this borderline religious anti-C++ attitude is common in the Java/Android ecosystem, or an outlier? I found it really bizarre.

It's a well known result of theory and practice among people who start delving into more provably safe languages.

mmastrac
Second part is here: https://www.youtube.com/watch?v=MGMoRu5yrVc
gambiting
There is another area where this approach is common - games programming. I work on a project which is written entirely in C++, and compiles from the same codebase(and from within the same IDE - VS2012) on Wii/WiiU/X360/XOne/PS3/PS4. It's interesting because every one of them uses a different compiler and builds for entirely different architectures and yet the same code builds on all.
rebootthesystem
Have you considered writting about your experiences? It would be very interesting to learn more about the good, bad and ugly of developing code for such a range of platforms.
corysama
Not quite what you are looking for, but here's something:

http://www.reddit.com/r/gamedev/comments/xddlp/describe_what...

gambiting
Quite possibly :-)

At the moment I can definitely share an Ugly part - the code has thousands of #defines everywhere, and you will find parts with C++11 code(for PS4/X1) and parts which use some hardcore custom methods for everything since they don't have access to STL(for WII....which is a horrible console to write for). So within one file you can see code which uses autos and for each(C++11 parts) and then bits which can't even use Vectors. It's bizarre. And then you have gigabytes of ram on next gen console, but everything you do also needs to fit in the tiny, 128MB ram of WII. It makes you really aware how you write code - which I think is good.

twen_ty
Great stuff!

The biggest takeaway for me is that investing in c/c++ paid off immensely for Microsoft. For a massive codebase that's 30+ years old this is a huge win. No other programming language could have and still give that level of ubiquity.

It also highlights how important it was for C++ to have stayed backwards compatible with C, despite the pain.

c++ (and c) is here to stay.

w8rbt
Yes, absolutely. C++ is the silent workhorse that is used almost everywhere. It's especially huge in embedded and systems programming. There'll be a significant number of programmers paid to maintain and enhance C++ programs for at least the next 50 to 100 years, probably longer.
justintocci
tl;dr they use a client-server model, then use the ui frameworks that are provided by the vendor. Really excellent talk, highly recommend it if you're interested in this sort of stuff.
D_Guidi
looks similar to this old submission: https://news.ycombinator.com/item?id=8486627
bztzt
It's a technically deeper version of the talk in that link.
D_Guidi
thanks for the clarification
tkubacki
hmm if Linux could get something like Android runtime - this could bring Office to Linux desktop ?
frozenport
Android is almost Linux. I believe it has been done, although I am not sure about the user experience or the compatibility with native applications, you are still running an x86 computer...

http://www.sabayon.org/article/sabayon-runs-android-market-g...

dmacvicar
April 1st post?
izacus
There is a huge difference between your run of the mill desktop distribution and Android - all they have in common is a Linux kernel and that's about it, Android replaces pretty much all user space.

(Also kernel is patched and GPU drivers don't use X compatible interface for acceleration.)

frozenport
Seriously? If I build my Gentoo differently it won't be Linux, because I used a different userland? Take a look at the link, there is the store running native.
ori_b
If you replace glibc, coreutils, bash, Xorg, and just about any other part that you as either a developer or user interact with, then no, it's not recognizably linux, any more than the BSDs are Linux. In fact, as far as I know, the BSDs will be easier to port to, because Bionic libc is really a stub, with lots of Posix bits left out.
jmnicolas
On the principle I agree with you, but I find it funny that when you take out the GNU in "GNU/Linux" it's not Linux anymore.
frozenport
>>If you replace glibc, coreutils, bash, Xorg, and just about any other part that you as either a developer or user interact with, then no, it's not recognizably linux, any more than the BSDs are Linux

I had to add a driver for a USB device and it was Linux to me. I could not have done the same for BSD (never used it) or Windows using code from Kernel.org . I have personally used an Android kernel to boot one of those arm `mini-netbooks` into xfce.

Indeed you would find that glibc has iterated through different ABIs but we don't call these different operating systems, and we can fix them by simply installing the appropriate binaries.

antimagic
If I go and get a book on "Linux Programming", it'll tell me a whole lot about file descriptors, mmap, signals, forking processes, threading and so on. Pretty much none of that is available to someone writing applications for Android.
pjmlp
There is hardly anything from a traditional GNU/Linux on Android.

You have a 100% Java based userland, and only a very limited set of C and C++ libraries available to native applications. There isn't even a full POSIX support.

Google could change Linux kernel with e.g. QNX, and hardly anyone would notice.

digi_owl
Its reasons like these that RMS insist on GNU/Linux.
cwyers
No, it really isn't. One of the stated goals of the GNU project is to develop an entirely free (as in libre) operating system. Calling Linux "GNU/Linux" allows them to say they've completed that goal, despite little details like their continual failure to deliver a finished Hurd kernel. Linux's userland isn't even primarily GNU software, and I think GNU may not even be the single-largest contributor to the core userland anymore.
the_why_of_y
AIUI the primary reason why the HURD kernel is not finished is that when GNU/Linux became generally usable, it was de-prioritized and essentially turned into a research project.
josteink
> Seriously? If I build my Gentoo differently it won't be Linux, because I used a different userland?

You're misunderstanding. It's not criticism, but a statement of facts that the only thing Android has in common with most desktop Linux-distros is the kernel. Apart from that they share literally nothing.

Tweaking your Gentoo installation still makes is a Gentoo-installation, and thus a normal GNU/Linux environment.

But if you change the init-system, remove all userspace tools, lock it down so users can't have root, ditch X for something else and only run apps designed for your non-X graphical environment, with each user-facing app running as their own Linux user-account...

Would you call that a "normal" Linux desktop? Probably not. And that's the point. Android isn't conventional Linux. (Which is probably why it's so successful, but that's flamebait for another discussion)

digi_owl
It is also sold off the shelf in big stores where Joe Averages congregate. Get a desktop distro preinstalled on hardware with all the drivers in place and working, and lets see how well it does over the long term (5+ years).
Htsthbjig
Is very interesting how people on Microsoft got to the same conclusions that we got: get rid of Java and any other exotic language in the sharing code and use only c++.

Use other languages in the interface for different platforms,or in the testbench code.

We got to this conclusion after years of painful practical problems, but it is hard because it goes against the common philosophy of theoretical people that write best practice books(but not code too much) and natural inclinations of programmers(to use the new shiny thing).

therockhead
You can not share Java on all platforms (such as iOS). Unfortunately if you want to share code on Windows/OSX/Android/iOS C/C++ are you only options.
raverbashing
Wow, but wasn't Java supposed to be "write once, run everywhere?!!?"

Yeah.

pjmlp
It is, as long as anyone bothers to write a compiler.
67726e
It's kind of hard to be "Write Once, Run Anywhere" when someone with control over the platform only allows specific runtimes. Of course there are tools that would allow you to write Java for an iOS app and transpile to Obj-C, but you can't directly run Java bytecode for an iOS app.
nly
I want to know why the EU hasn't come down on Apple over this. They're shutting out Flash and Java and yet Google get nailed to the floor despite supporting a pretty liberal, almost completely open source mobile OS.
S_A_P
You are conflating 2 different issues. Apple is a walled garden platform, but while initially it seemed they had a monopoly, google has a much more popular platform in terms of users. However, Google does have a search monopoly, which is why the EU is taking an interest.
nikbackm
Because Apple is not close to having a monopoly like Google?
coldtea
>I want to know why the EU hasn't come down on Apple over this.

Because it's their platform, and they are not a monopoly in the mobile market (more like 20-30% in EU).

>* They're shutting out Flash and Java*

Yes, amen to that (though it's: Flash and Java applets).

>and yet Google get nailed to the floor despite supporting a pretty liberal, almost completely open source mobile OS.

Well, "almost" is the key word. The main value proposition behind Android is in the Google apps integration, and Google is very adamant about who and how gets that in a MS circa 1995 way.

Besides, the reasons they "nail" Google to the floor has nothing to do with Android, but about it's monopoly on search and the abuses of it.

pjmlp
There are native Java compilers for iOS.

Java the language specification != JVM bytecode.

67726e
Did I not make that clear? I specified you can write Java the language but you're not running Java the bytecode...
pjmlp
Except compilers like Codename One and RoboVM take bytecode as input and generate native code.

There isn't any transpilation to Objective-C involved.

raverbashing
True for iOS, certainly

And for good reasons. Reminds me of the initial complaint about "no flash in iPhone", then someone managed to put it in an Android tablet and then they realised what a bad idea it is.

pjmlp
You can!

http://www.codenameone.com/

http://www.robovm.com/

Dewie
> and natural inclinations of programmers(to use the new shiny thing).

It seems like C++ keeps getting shinier. Though organizations might try to stick to a limited subset of C++ anyway.

adenner
For the parts that are still missing I have found the Boost library to help round it out in a cross platform sort of way. (http://www.boost.org/)
raverbashing
> It seems like C++ keeps getting shinier. Though organizations might try to stick to a limited subset of C++ anyway.

I agree with both points. And I'm glad the shiny new parts of C++ are very usable

pjmlp
Java is not the problem.

Oracle ignoring the mobile OS eco-sytems and not providing either JVM or AOT compilers is the problem.

nly
Java had a mobile VM before Android even existed. They even bragged about how much better it was than Dalvik when Android started taking off.
pjmlp
And now Android looks just like the return of J2ME fragmentation hell. With each version and device having its own set of device specific APIs, bugs and quirks.

Why keep people mixing languages with implementations?!!

The mobile VM you speak about, were the J2ME VMs, usually done by the device manufacturers themselves, not by Sun.

Java, The Programming Language Specification does not require the Java Virtual Machine Specification to run. Any implementer is free to take any approach to turn Java code into executable code.

stinos
We started like this, sort of a gamble, and until now it never gave us major problems. So it's indeed a sort of relief to see other companies use this road as well.

The core of our software is grabbing data from an external device and signal processing. On top of that we've built a plain C API, an plain C RPC lib over TCP with the same interface as the main C API, and a C++/CLI dll for interfacing with .Net. On top of that we've built the main C# ui and a lot of custom applications in C/C++/Labview/Matlab/Python. And it all just works which makes me wonder wether there even were other choices than C++ for this particular job.

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.