Cross-platform mobile development with Visual C++ 2015 Sasha Goldshtein @goldshtn CTO, Sela Group blog.sashag.net
App Targeting Spectrum Developer pain exponential jump in complexity, but not in user experience Hosted web app (Cordova et al.) App for each platform Shared native code (Xamarin/C++) Adaptive mobile website Redirect to m.example.com User experience
The JavaScript Struggle Second-class platform support (need plugins) Subpar performance Subpar development tools (debugging, profiling) Subpar 3 rd party library support (need plugins) Are we ready to sacrifice all of the above for code sharing? there must be a better way
The GC Effect, Part 1 We feel so strongly about ARC being the right approach to memory management that we have decided to deprecate Garbage Collection in OSX. Apple, WWDC, 2012 Hmm. Apple, what do they know about GC, right?
The GC Effect, Part 2 [ ] when garbage collection has five times as much memory as required, its runtime performance matches or slightly exceeds that of explicit memory management. However, [ ] performance degrades substantially when it must use smaller heaps. With three times as much memory, it runs 17% slower on average, and with twice as much memory, it runs 70% slower. Garbage collection also is more susceptible to paging when physical memory is scarce. Quantifying the performance of garbage collection vs. explicit memory management, Hertz & Berger
Trivia (/by Ankit Ashtana) Is the Android Facebook app using C++? How about Spotify? Twitter? Angry Birds? How many of the top 50 apps on Google Play (US) leverage C++ code?
Silos Swift/Objective-C Xcode Mac Cocoa Touch Objective-C runtime Darwin Java Android Studio Mac/Linux/Windows Android Framework Dalvik Linux kernel C#/C++/JavaScript Visual Studio Windows UWP Windows Runtime NT kernel
Shared C++ Core Swift/Objective-C Xcode Mac Java Android Studio Mac/Linux/Windows shared C++ core C#/C++/JavaScript Visual Studio Windows.a.a or.so.lib or.dll Cocoa Touch Objective-C runtime Darwin Android Framework Dalvik Linux kernel UWP Windows Runtime NT kernel
Not Your Father s C++ Modern C++ is safer, more productive, and more maintainable There s a library for everything, and many of them are cross-platform (std, boost, cpprest, soci, ) auto http = http_client{ "http://example.com" }; auto resp = await http.request(methods::get); auto body = await resp.extract_json(); auto name = body.at("name").as_string(); session db(sqlite3, "mydb.sqlite"); db << "insert into table ", use(name);
Visual C++ Support Obj-C and C++ VC++ Windows* clang ios Simulator Java and C++ VC++ Windows clang VS Android Emulator C# and C++ VC++ Windows C2 VS Emulator *Mac build agent required
App Architecture UIView UIViewController Swift > Obj-C bridge View Activity JNI bridge Control Page P/Invoke or C++/CX shared C++ core
App Structure in Visual Studio ios packaging project ios static library project Android app project Android library project shared project C++ core
Visual Studio Android Emulator Hyper-V based x86/x64 emulator with first-class performance, accelerometer support, multitouch emulation, and more
Demo Hello World apps for Android and ios in Visual Studio
Demo Shared C++ core
Demo OpenGL ES template
Limitations and Future Directions No code completion, IntelliSense, syntax highlighting for Java and Objective-C (yet) No Swift support for ios No built-in UI designer (Xamarin Business) Partial debugging and profiling support It s Beta-quality, really but a very promising start
Summary You don t have to compromise on performance, productivity, and code sharing, or sell your soul to a garbage collector Visual C++ brings together the worlds of ios, Android, and Windows app development Free with Visual Studio 2015 Community edition
Thank you! Sasha Goldshtein @goldshtn CTO, Sela Group blog.sashag.net