Cross-Platform Entwicklung mit Xamarin: Erfahrungen eines Software-Ingenieurs Thomas Charrière Community Leiter Mobile Software Engineer bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 1
Mobiles sind überall bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 2
2008-12 2009-06 2009-12 2010-06 2010-12 2011-06 2011-12 2012-06 2012-12 2013-06 2013-12 2014-06 2014-12 2015-06 Marktanteile von 2008 bis 2015 (Weltweit) 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% Android ios Windows SymbianOS BlackBerry OS Series 40 Other bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 3
Über den Referenten Thomas Charrière (BSc Software Engineer) Software Ingenieur Community Leiter Mobile bei bbv Software Services AG Xamarin Certified Mobile Developer Microsoft Technology Ambassador Leiter der Xamarin User Group Zürich (www.xamzueri.ch) bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 4
Wie Apps entstehen Meistens wird das Bedürfnis einer App nicht von der IT definiert Oft ist der Umfang einer App nicht bekannt Firmen möchten Apps vermehrt intern entwickeln We should build an app. Entwicklung einer App ist oft eine strategische Entscheidung bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 5
bbv Software Services AG Kennzahlen Branchen bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 6
Erfolgreich seit über 20 Jahren bbv gehört zu den führenden Schweizer Software- und Beratungsunternehmen. Wir stehen für Top-Qualität im Software Engineering und für viel Erfahrung in der Umsetzung. Kennzahlen Gründung: 1995; Aktiengesellschaft ca. 200 Mitarbeiter über 1 600 Projekte bei mehr als 180 Kunden Büros in Luzern (Firmensitz), Zug, Zürich, Bern, München und Vietnam bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 7
Erfahren in verschiedenen Branchen Industrie Versicherungen Banken, Finanzdienstleister Öffentliche Verwaltung, bundesnahe Betriebe Handel, Dienstleistungen, Softwarehersteller Schindler, Siemens, Roche, Ypsomed, ACS, Ascom, BKW FMB Energie, Bystronic, Diebold, eao, Esec, Frama, Garaventa, Komax, Leister, maxon motor, Oerlikon CSS Versicherung, Swiss Re, Swiss Life, Mobiliar, SUVA, Concordia, Visana Postfinance, UBS, SIX Swiss Exchange, derivative partners, Quartal Financial Solutions AG, Bank for International Settlements, Oerlikon, Curabill Swisscom, SBB, Institut für Gestiges Eigentum, Hochschule Rapperswil, HTA Luzern, Stadt Zürich Polizeidepartement, Stadt Zürich OIZ, BIT Ex Libris, ARP Gruppe, Jelmoli, Multimedia Solutions, Identitas, Löwenfels Partner, Ruf Informatik, Bison bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 8
Arten von Mobile Apps Single Platform und Cross Platform Native, Hybrid und Web Apps Vergleich der drei Varianten bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 9
Single Platform vs. Cross Platform Android Code ios Code Windows Code Android ios Windows Mobile + Android Code (optional) Android Shared Code + ios Code (optional) ios + Windows Code (optional) Windows Mobile bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 10
Native, Hybrid und Web Mobile App Native Platform Native App 1010011001010101 1000011110100101 1010101010101010 1100110001100101 1001001010101010 Hybrid Platform Native Container <html> <head> </head> <body> </body> </html> Web Platform Web Browser <html> <head> </head> <body> </body> </html> bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 11
Native Fortgeschritte UI Interaktionen Beste Performance App Store Verteilung Sämtliche Fähigkeiten Hybrid / Cross-Platform Code-Reuse Vorhandenes Know-How App Store Verteilung Single Platform App Mehrere Platform Web / Cross-Platform oder Native Teil- Fähigkeiten Web Web-Entwicklung Sofortige Updates bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 12
Pro und Kontra der Varianten Eigenschaft Native SP Native CP Hybrid CP Web CP Performance Look & Feel (1) Zugriff auf Gerätefunktionen (2) Portabilität von Code Anzahl benötigter Technologien Re-Use von existierendem Code Upgrade Flexibilität (3) Installationserlebnis (3) Offline Nutzung Gebühren für Veröffentlichung bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 13
Produktbeispiele Produkt Sprache(n) Typ Platform Android Native Java, AXML Native Single ios Native Objective-C, Swift Native Single Windows Mobile Native C#, XAML Native Single Xamarin C#, XAML Native Cross NativeScript JavaScript Native Cross Fire Monkey Delphi Native Cross Appcelerator Titanium (1,2) JS, XML, CSS Native Cross Cordova / PhoneGap (1,2) JS, HTML, CSS Hybrid Cross Website (Sencha Touch) JS, HTML, CSS Web Cross bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 14
Produktvergleich auf Property Cross http://www.propertycross.com bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 15
Xamarin im Überblick Produkte Funktionsprinzip Benötigte Tools bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 16
Xamarin in 120 Sekunden Xamarin ermöglicht eine gemeinsame Codebasis in C# Unterstützung von Android, ios, macos und Windows Vollständige Abbildung der nativen APIs in C# (1) Es werden native Apps erzeugt Benutzung etablierter Tools (Visual Studio, Resharper, ) Einsatz der meisten.net Libraries möglich NuGet Packages erhältlich (SQLite, JSON.NET, ) bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 17
Timeline (1) Von.NET zu Xamarin Linux Mono ios MonoTouch Android Mono for Android ios Xamarin.iOS Android Xamarin.Android Open Source / Frei verfügbar Integration in Visual Studio / Open Source Kommerzielle Lizenz Verzögerung: 1 Release Verzögerung: 24 Stunden Teil von.net bbv Software Services AG www.bbv.ch Sascha Cross-Platform Corti 2016 Entwicklung (sascha.corti@microsoft.com) mit Xamarin 18
Timeline (2) Xamarin 2011 2012 2013 2014 2015 2016 Xamarin Founded First Release of Xamarin.Android First Release of Xamarin.iOS First release of Xamarin.Mac Launch Partner Program Xamarin 2.0 Component Store Xamarin Test Cloud Evolve 2013 (200 Visitors) Microsoft Partnership Xamarin 3.0 Xamarin.Forms Xamarin University Xamarin Insights Evolve 2014 (1200 Visitors) Xamarin 4.0 Xamarin.Forms 2.0 Xamarin Test Recorder Acquisition by Microsoft Xamarin.Forms 2.1 Evolve 2016 (1700 Visitors) bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 19
Die Produkte im Überblick BUILD TEST MONITOR ACCELERATE Test any app on 2,500 real devices in the cloud Train developers for mobile and keep skills current Use C# to build native apps for ios and Android Monitor performance and user behavior in live apps bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 20
Von C# zu nativem Code Xamarin.iOS: Ahead of Time (AOT) Xamarin.Android: Just in Time (JIT) bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 21
Tools Entwicklungsumgebungen Visual Studio (Win) Xamarin Studio (Mac) Xcode (Mac, nur für ios) Betriebssysteme Dev Machine: Win oder Mac ios Build Agent: Mac SDKs Android NDK+SDK (Win oder Mac) API-Levels ios SDK (Mac) Abhängig von Xcode Windows Mobile 10 SDK (Win) bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 22
Fallgrube #1: Installationserlebnis bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 23
Fallgrube #2: Abhängigkeiten / Updates Xamarin setzt die native SDK s ein: ios Xcode Android Command Line Tools SDK s NDK VS Plugin Android + ios Koordination der Team-Mitglieder bezüglich Updates bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 24
Xamarin Platform Architektur einer Xamarin App Xamarin «Traditional» vs. Xamarin.Forms bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 25
Architektur einer Xamarin App Android UI ios UI Windows UI Shared Code Strukturierung Shared Project Portable Class Library bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 26
Fallgrube #3: Write Once, Run Everywhere Grundsätzlich: Mit Cross-Platform Frameworks kann man grosse Code-Abschnitte wiederverwenden Jedoch: die Finessen der Platformen müssen berücksichtigt werden Cross-Platform Entwicklung wird zgt nur bis zur Monopol-Grenze ermöglicht Beispiele: Platform-Implementationen Sqlite Push-Nachrichten GCM APN Kryptographie Werbung Zahlsysteme Apple Pay Android Pay bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 27
Xamarin «Traditional» Android Bootstrapper Views Controller / VM Platformspezifika Shared Code ios Bootstrapper Views Controller / VM Platformspezifika Xamarin «Traditional» eignet sich für: Apps mit anspruchsvollem UI- und UX-Konzept Apps mit hohem Anteil an Platformspezifischer Funktionalität Apps, bei welchen ein optimiertes UI wichtiger als Code Sharing ist Model Businesslogik bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 28
Xamarin.Forms Android Bootstrapper Platformspezifika Shared Code ios Bootstrapper Platformspezifika Xamarin.Forms eignet sich für: Apps zur einfachen Ein- und Ausgabe von Daten Apps mit geringem Anteil an Platformspezifischer Funktionalität Apps, bei welchen Code Sharing wichtiger als ein optimiertes UI ist Prototypen Model Businesslogik Views Controller / VM bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 29
Beispiel: Flughafen Zürich App bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 30
Fallgrube #4: C# == C#, oder? Entwicklung von Mobile Apps ohne Mobile-Know-How (Native) ist sehr schwierig Abstraktion von Native-Elemente kann helfen (Xamarin.Forms) Code für Mobile muss optimiert werden Datenbanken Speicherbelegung Algorithmen bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 31
Fallgrube #5: Cross-Platform UI / UX Kennt der Designer die Unterschiede zwischen ios / Android? Wie wichtig ist das Firmen- Branding? Wann ist das CI wichtiger als UX? bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 32
Fallgrube #5: Cross-Platform UI / UX Wie viele Betriebsysteme kennt der Besteller? Standart-Elemente führen zu intuitivere Apps Oft werden die Entwickler zu spät im Entscheidungsprozess miteinbezogen bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 33
Fallgrube #6: Wir brauchen keine (Unit) Tests Alleine Android lauft unter 20 000 verschiedene Geräte Funktionale Tests (Unit Tests) (Business-)Logikabschnitte Ui-Tests User-Stories Stürzt eine App ab wird sie schnell gelöscht bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 34
Best Practices bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 35
Eine erfolgreiche App Entwicklung UX ist ein Endprodukt gute Zusammenarbeit Usability Experte Entwicklungsteam Mobile Experte(n) Fach-Experte(n) Tester Dediziert Testing Das gesamte Team soll im Entscheidungsprozess involviert sein. bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 36
Es braucht mehr als nur eine App bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 37
Mobile DevOps Code Monitor Build Release Test bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 38
Zusammenfassung bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 39
Zusammenfassung Arten von Mobile Apps Single- und Cross-Platform Native-, Hybrid- und Web-Apps Vor- und Nachteile der Varianten Xamarin im Überblick Funktionsprinzip Tools Xamarin Platform Xamarin «Traditional» Xamarin.Forms Fallgruben 1. Installationserlebnis 2. Abhängigkeiten 3. Write Once, Run Everywhere 4. C# gleich C#, oder? 5. Cross-Platform UI / UX 6. Wir brauchen keine (Unit) Tests bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 40
Xamarin User Group Zürich Wichtige Fakten Findet ca. 1x in Monat statt Austausch zwischen Mobile- Entwickler / Fanatiker Teilnahme ist jeweils gratis Pizza + Bier gesponsert von bbv Nächster Talk: «MVVM and Xamarin Forms beyond the basics» Corrado Cavalli Microsoft MVP Di, 15.11.2016 ab 1800 ImpactHub Zürich, Viadukt (gleich an der Hardbrücke) Weitere Infos http://xamzueri.ch http://meetup.com/xamarin-zurich/ bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 41
Suchst du nach mehr Herausforderung? Offene Stellen Java Software-Ingenieur Java Web-Ingenieur Mobile Software-Ingenieur.NET Software-Ingenieur.NET Web-Ingenieur bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 42
MAKING VISIONS WORK. Thomas Charrière bbv Software Services AG Heinrichstrasse 249 8005 Zürich thomas.charriere@bbv.ch +41 41 315 63 52 www.bbv.ch bbv Software Services AG www.bbv.ch Cross-Platform Entwicklung mit Xamarin 43