Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building cross-platform without sacrificing per...

Building cross-platform without sacrificing performance

If you're building a competitive product, mobile is crucial and you need to build for Web, Android and iOS. Many startups hire a separate team for each platform and re-implement features in different technologies. Learn how to harness a single team and a modern tech stack to ship product across all three platforms without sacrificing user experience or performance.

Simon Sturmer

August 09, 2017
Tweet

More Decks by Simon Sturmer

Other Decks in Technology

Transcript

  1. STARTING FRESH CHOICES ▸ Desktop, mobile, web.. or all of

    the above? ▸ Which technology stack to choose? ▸ How to recruit and build a team? ▸ Which features/platform to get to market first?
  2. MOBILE IS KING If you expect to compete you MUST

    prioritize mobile. ▸ Mobile is the primary interface for most users ▸ Vast majority of time is spent on mobile devices ▸ Online revenue and commerce is rapidly moving toward mobile
  3. MOBILE WEB VS MOBILE APP THE WEB IS A COMPELLING

    PLATFORM ▸ Open Standards ▸ Cross-platform ▸ URLs are awesome for usability ▸ Your site is just a Google search away ▸ No installation required ▸ We’ve become good at navigating the web’s limitations
  4. THE WEB PLATFORM 20 YEARS OF INFLUENCE A lot of

    the really exciting application design paradigms originated from the web. In many ways, this is a product of the innovation required to leverage the web for delivering applications.
  5. FOR EXAMPLE ▸ Rich gestures and interactions ▸ Natural-feeling animations

    at 60fps ▸ Gyro, accelerometer ▸ Location services ▸ Push notifications ▸ Microphone, Music, Camera ▸ Bluetooth, NFC, Biometrics ▸ Offline Experiences ▸ Background services ▸ Native APIs such as contacts and sharing THE MOBILE EXPERIENCE
  6. TOP MOBILE APPS IF YOU’RE IN A HIGHLY COMPETITIVE SPACE

    Delivering a mobile app is NOT optional.
  7. IN MOST CASES You’ll need to deliver on ▸ Android

    ▸ iPhone ▸ Web … at the minimum.
  8. DELIVERING A PRODUCT LET’S DO THIS: 1. Hire a dedicated

    Android team that understands Java and Android Studio 2. Hire a rockstar iOS team that understands Swift and Xcode and Native SDKs 3. Hire a web team to do the HTML, CSS, JavaScript (and one of the 387 JS frameworks available today) (Protip: You’ll need a backend too)
  9. DELIVERING A PRODUCT SOME COMPANIES CAN AFFORD THREE TEAMS But

    there are still challenges to this approach… ▸ The teams tend to be somewhat siloed ▸ Keeping feature parity between platforms is challenging ▸ It’s difficult to manage all those engineers ▸ Customer support for three different products
  10. SHIP IT IDEALLY… We just want to build our App

    once and deliver it to all our awesome users. Even if they’re using Android. or iPhone. (or worse, Windows Phone)
  11. CROSS-PLATFORM TECHNOLOGIES TWO APPROACHES TO CROSS-PLATFORM ▸ HTML5 Hybrid Approach

    (sometimes called a webview)
 - for example Cordova or Ionic ▸ A framework that abstracts each platform’s native view components
 - such as Xamarin, NativeScript and React Native Both approaches need to expose features from the underlying SDK such as access to camera or GPS.
  12. HTML5 BACK IN 2009, WE GOT
 A HOT NEW THING

    CALLED HTML5 ▸ Flash wasn’t winning on mobile ▸ HTML5 was riding a wave of excitement ▸ Everyone thought HTML5 was the answer to cross-platform ▸ PhoneGap and friends made some strong promises for mobile
  13. WHY? The HTML5 Hybrid approach essentially augments the normal web

    technologies with access to hardware features such as camera/ location/bluetooth. Everyone was already familiar with web technologies. HTML5
  14. THE FACEBOOK HYBRID APP ▸ Around that time, Facebook did

    not have a successful mobile app. ▸ They decided to build on HTML5 hybrid technology ▸ Their hybrid app was released in 2010 for both iPhone and Android
  15. “OUR BIGGEST MISTAKE WAS BETTING TOO MUCH ON HTML5“ Mark

    Zuckerberg - 2012 THE FACEBOOK HYBRID APP
  16. THE FACEBOOK HYBRID APP FACEBOOK WENT BACK AND FORMED A

    NATIVE TEAM FOR IOS
 
 AND ANOTHER FOR ANDROID
  17. IS NOT AN OPTION IF YOU'RE IN THE TOP 100


    OR YOU COMPETE IN THAT LEAGUE,
 SACRIFICING THE USER EXPERIENCE
  18. WEB-BASED TECHNOLOGY HAS IMPROVED A LOT But ultimately, it can’t

    compete with native on user experience or performance. ▸ Animations ▸ Gestures ▸ Response time ▸ Physics ▸ Memory consumption HTML5
  19. THE CROSS PLATFORM HOLY GRAIL WE WANT ALL OF THE

    FOLLOWING ▸ One expressive language/framework across iOS, Android (and ideally Web too) ▸ Native level performance ▸ Reasonable amount of code re-use while maintaining the native look and feel for each platform ▸ Excellent user experience ▸ 60fps animations
  20. REACT FOR THE WEB REACT Just a year or so

    after their Hybrid App situation,
 Facebook dreamed up a new thing called React. ▸ React was new and controversial ▸ Angular was the dominant web framework ▸ The early adopters of React were fueling some incredible innovation in the front- end space. ▸ A lot of these ideas were very unpopular
  21. “REACT IS PACKED WITH IDEAS THAT WERE RADICAL AT THE

    TIME OF ITS INTRODUCTION.” Dan Abramov REACT FOR THE WEB
  22. REACT FOR THE WEB We could spend a whole talk

    on how transformational React was at the time. ▸ Declarative UI ▸ View as a function of state ▸ Immutability ▸ Composable UI components ▸ Batched, asynchronous rendering
  23. VIEW LOGIC IT TELLS YOU VERY LITTLE ABOUT THE UNDERLYING

    DISPLAY MEDIUM If you look at that piece of code …
  24. REACT In theory, React views could target any display medium,

    not just a web browser. In fact, several teams started trying it: ▸ Flipboard -> HTML5 Canvas ▸ Netflix -> “Gibbon” for Smart TVs ▸ (Some brave people) -> Terminal Interface ▸ … even a PDF renderer
  25. REACT NATIVE ▸ The same ideas powering React ▸ Truly

    native view components ▸ No HTML, CSS or Webviews ▸ Emphasis on performance ▸ Modern JavaScript ▸ iOS, Android and even Windows!
  26. REACT NATIVE CODE RE-USE ‣ Reasonable amount of code re-use

    while maintaining the native look and feel for each platform. ‣ Android should feel like Android; iOS like iOS. ‣ You CAN maximize for code re-use and brand your app with a similar look/feel across platforms if you choose.
  27. REACT NATIVE CODE RE-USE ‣ Your views, styling and business

    logic is 100% JavaScript ‣ You can even get some code re-use with React for web (especially business logic)
  28. REACT NATIVE PERFORMANCE ▸ Async, batched Rendering ▸ UI on

    a separate thread ▸ Take advantage of multi-core architectures
  29. REACT NATIVE STYLING & LAYOUT ▸ Styling and Layout is

    done 100% in JavaScript ▸ Some ideas are borrowed from CSS, specifically Flexbox ▸ Flexbox provides a powerful way to describe your layout.
  30. REACT NATIVE ANIMATIONS ▸ React Native provides powerful, declarative animation

    constructs. ▸ The animations run fully in native, so the performance is smooth. ▸ Once you learn the API, it’s fairly intuitive. ▸ You get access to gestures such as swipes and scroll-based animations.
  31. ONE OF THE REALLY GREAT THINGS ABOUT THE WEB… The

    Developer Experience is top notch.
  32. DEVELOPER EXPERIENCE BRINGING THE BEST OF THE WEB TO NATIVE

    ▸ Almost zero compile time ▸ Hot Reloading ▸ Develop on multiple devices simultaneously ▸ Dev tools make debugging painless ▸ Powerful layout using Flexbox
  33. JAVASCRIPT FOR REAL? ▸ JS is not as bad as

    it used to be! ▸ React Native is built on modern JS or “ES Next” ▸ We get powerful constructs such as async/await and Promises ▸ Optional Typing and strong compile-time guarantees
  34. JAVASCRIPT ALTERNATIVES THERE ARE LANGUAGES THAT WILL COMPILE TO JS

    ▸ TypeScript (from Microsoft) ▸ Scala ▸ ClojureScript ▸ Reason — New from the creators of React! ▸ Sound type system. Fully supported React Bindings. ▸ Used already in production by Facebook
  35. JAVASCRIPT ALTERNATIVES THE COMMUNITY AROUND REACT NATIVE IS GREAT ▸

    Open Source UI kits, Navigation ▸ Dev Tooling ▸ Bindings to third-party SDKs (such as Voip or Analytics) ▸ Community Support ▸ Learning Resources
  36. INSTANTLY GET STARTED EXPO ROCKS ▸ Go to the website

    ▸ Scan the QR code with your phone ▸ Edit code and instantly see the results on your device!
  37. FUTURE OF NATIVE CODE CAN REACT NATIVE REPLACE JAVA/SWIFT? ▸

    Not Really ▸ React Native is written in those native languages ▸ All the components that you use in your RN app are native components built in native languages ▸ However, we’re seeing a shift where native languages are used by library/ component authors and React Native is used by app developers.
  38. REACT NATIVE FRONT-END ENGINEERING IS GOING THROUGH A SORT OF

    RENAISSANCE ▸ Languages are evolving. ▸ Developer experience is improving. ▸ Barriers are coming down.
  39. THANK YOU @sstur_ I’m Simon. I run a software agency:

    
 We build and consult React Native.