Building a testable mixed-codebase ios Framework

Size: px
Start display at page:

Download "Building a testable mixed-codebase ios Framework"

Transcription

1 Building a testable mixed-codebase ios Framework Nikos Maounis ios Christos Karaiskos ios

2 Outline Introduction and Motivation Distributing Libraries and Resources Design Considerations Testability Swift and ObjC Coexistence

3 Introduction The App Store evolution

4 Introduction The App Store evolution

5 Introduction New Horizons Extend beyond the traditional app experience Quick interactions with your app throughout the OS and throughout different devices

6 Introduction Shared Code Location Location Logging Networking Logging Networking Analytics Resources Analytics Resources Reachability Reachability

7 Motivation Be at the edge of innovation, follow changes in the app and device landscape (widget, watch, notifications, Siri, Maps) Lay the foundations for the future, with focus on code reuse, testability and self-documentation for new team members Prepare for complete and safe transition to Swift, with unit-test assurance

8 Distributing Libraries and Resources

9 Static Libraries Names of the form libname.a Archives of object files Statically linked objects become part of executable: Increase in size Separate distribution of headers and resources Changes require re-linking Swift does not support them

10 Dynamic Libraries Names of the form dynamiclibrary.dylib Single copy of objects is shared among different applications Symbol binding performed at runtime. Not being able to find and load a required dylib will crash your app. Not part of main executable: Static linker only makes note of the install names of dylibs that are referenced by symbols in your app Versioned: dylibs may be updated independently of their consumers (i.e., minor version updates)

11 Frameworks Names of the form frameworkname.framework Act as dylib wrappers, inherit all their characteristics Bundle format, relocatable Include dynamic library, headers, resources, versioning info Resources include: NIB files, images, localised strings, etc.

12 User Frameworks in ios Introduced in ios 8, support Swift The official way to package reusable code with resources, without requiring hacks (e.g. static frameworks) Due to sandbox restrictions, each application must embed its own copy (along with any further dylib/framework dependencies) Frameworks cannot be updated alone, even bumping the minor version requires resubmitting the whole application Conversely: They are easier to handle, with the guarantee that the correct version of the framework will run, new versions won t break anything in previous versions

13 Design Considerations

14 Swift vs ObjC in Taxibeat Github Linguist 23.5% 76.5% Passenger 26.2% 73.8% Driver

15 Our Approach Use both ObjC and Swift. Migrate to pure Swift when framework is stable and tested. New classes should be written in Swift. Focus on model part of MVC. Determine parts heavily shared among apps and extensions (e.g. location management, networking, logging) Treat Framework as a clean room: warnings as errors, unit tests, code reviews, design patterns, double-think before adding functionality Code organization. Different project, different repo, same workspace Don t risk client stability. If migration of a class from client to framework is not straightforward, keep both so that nothing breaks and replace only when tests pass.

16 Project Organization

17 Extensions ld: warning: linking against a dylib which is not safe for use in application extensions Check Allow app extension API only Compiler-enforced restriction on what you can include in framework Ensures that what you build can be used in extensions.

18 Architectural Differences A framework target can only be built for a single platform, and the respective supported architectures Solution for deploying to watchos or tvos: Separate framework target for each platform Use Swift directives (e.g., #if os(watchos)), different platforms support different system API subsets

19 Testability in Mind

20 The Importance of Tests Confidence to refactor Test assisted design promotes good API design. Find flaws early and iterate. Modularity and loose coupling by definition Simulate edge scenarios using fake objects Dynamic documentation

21 Xcode Server Coverage Stats We created an Xcode Server to force ourselves to write tests

22 Example 1: Unit Testing the Location Manager

23 Example 1: Unit Testing the Location Manager Need to simulate location and authorization scenarios Override the need for depending on actual hardware measurements (GPS, A/GPS) Override the need for user input (Permissions etc)

24 Example 1: Unit Testing the Location Manager Continuous user tracking not always required throughout app lifecycle, battery drain ios >= 9 provides requestlocation() using delegation Closure/block-based approach: ease of use, compact, code not scattered public class LocationManager: NSObject { } public func ((CLLocation) -> Void)) { // LocationManager saves closure, internally handles inaccurate locations, lack of authorization etc. // when sufficiently accurate location is retrieved, closure is called } Execute callback when sufficiently accurate location is acquired

25 Example 1: Unit Testing the Location Manager In order to unit test our LocationManager we need to control the CLLocationManager which is used internally Step 1: Subclass CLLocationManager (or define a protocol with common functions) extension LocationManagerTests { public class MockRequestOnceSuccessLocationManager: CLLocationManager { override class func locationservicesenabled() -> Bool { return true } override class func authorizationstatus() -> CLAuthorizationStatus { return.authorizedwheninuse } } } override public func startupdatinglocation() { delegate?.locationmanager?(self, didupdatelocations: [CLLocation(latitude: 10.0, longitude: 10.0)]) }

26 Example 1: Unit Testing the Location Manager Step 2: Inject dependency to our LocationManager Init for LocationManager init(locationmanagertype:cllocationmanager.type = CLLocationManager.self) { } Create new instance: locmgr = LocationManager(locationManagerType: MockRequestOnceSuccessLocationManager.self) // TEST Step 3: Remove hardcoded references of CLLocationManager within LocationManager self.locationmanagertype.authorizationstatus() instead of CLLocationManager.authorizationStatus()

27 Example 1: Unit Testing the Location Manager Step 4: Write an asynchronous test Test case for successful scenario class LocationManagerTests: XCTestCase { var locmgr: LocationManager! var exp: XCTestExpectation! func testrequestonceallowedwheninuse() { exp = self.expectation(description: "Request once callback") locmgr = LocationManager(locationManagerType: MockRequestOnceSuccessLocationManager.self) locmgr.requestlocationonce(completion: { (location) in XCTAssertEqual(location.coordinate.latitude, 10.0) XCTAssertEqual(location.coordinate.longitude, 10.0) self.exp.fulfill() }) self.waitforexpectations(timeout: 2.0, handler: nil) } }

28 Example 2: From Localytics to Google Analytics Tight coupling with 3rd party libraries - (IBAction)favoriteButtonPressed:(id)sender { [Localytics tagevent:@"favoritebuttonpressed" attributes:@{ }]; // handle action } - (IBAction)favoriteButtonPressed:(id)sender { id<gaitracker> tracker = [[GAI sharedinstance] defaulttracker]; [tracker send:[[gaidictionarybuilder createeventwithcategory:@"somecategory" action:@"favoritebuttonpressed" label:@"somelabel" value:nil] build]]; } Be careful not to become too coupled with 3rd-party applications Unit testing revealed that as consumers we just want to log events Consumers don t care if it s Google Analytics or Localytics under the hood

29 Example 2: From Localytics to Google Analytics + (void)sendhittoproviderwithname:(nsstring *)eventname andparameters:(nsdictionary *)params { [Localytics tagevent:eventname attributes:params]; } + (void)sendhittoproviderwithname:(nsstring *)eventname andparameters:(nsdictionary *)params { id<gaitracker> tracker = [[GAI sharedinstance] defaulttracker]; [tracker send:[[gaidictionarybuilder createeventwithcategory:@"ui_action" action:eventname label:@"app action" value:nil] build]]; } - (IBAction)favoriteButtonPressed:(id)sender { [BKAnalyticsHelper sendhittoproviderwithname:@"favoritebuttonpressed" andparameters:@{}]; // handle action } Create an abstraction layer, hide actual implementation details Migration transparent to consumer (besides the API key initializer) Changes required within single class, not scattered throughout project

30 Swift and ObjC Coexistence

31 Exposing ObjC Symbols Umbrella header, named MyFramework.h Exposes Objective-C/C classes as public Similar to Bridging header of mixedcodebase app target Should include all the ObjC headers you want disclosed in your public API Be sure to mark the header file as Public in the inspector

32 Exposing Swift Symbols Use access control to restrict visibility to parts of your code from code in other source files and modules Explicitly mark classes and methods as public if you want them exposed (default is internal)

33 Namespaces Swift supports namespaces ObjC does not. Convention is 3-character prefixing Solution for exposing Swift public class Logger: NSObject { } public func logdebug(_ params:any...) { //... } Seen in ObjC as: TXBLogger : NSObject + (void)logdebug; - (nonnull instancetype)init

34 Pure Swift Features As long as there is ObjC we cannot fully take advantage of Swift s powerful features We could not use optional primitives, associated value enums, structs, tuples, nested classes, default function params etc. Solution: Use pure Swift features only for internal Swift classes that do not interact with ObjC. If at some point they need to, write wrapper methods (e.g. to expose a String enum to ObjC)

35 Delegation in Swift (1/2) Handling weak references in delegates strong reference to A Solution(??): declare delegate var weak, as in ObjC

36 Delegation in Swift (2/2) Solution: Declare the protocol to inherit from class and property weak delegate released when it goes out of method scope

37 Being Swifty Use guard to exit functions early Use type inference Use the trailing closure syntax Follow case conventions. Names of types and protocols are UpperCamelCase. Everything else is lowercamelcase. Default to structs unless you really need a class Favor immutable variables

38 Being Swifty Example 1 Map reduce filter vs C-style loop NSArray<NSNumber *> @5]; NSMutableArray *finalarray = [[NSMutableArray alloc] init]; for (NSInteger i = 0; i <= samplearray.count; i++) { NSNumber *idoubled = [NSNumber numberwithinteger: samplearray[i].integervalue * 2]; [finalarray addobject:idoubled]; } let samplearray = [1, 2, 3, 4, 5] let finalarray = samplearray.map { return $0*2 }

39 Being Swifty Example 2 Naming conventions typedef NS_ENUM(NSInteger,TXBStatusViewState) { kstatusviewstatenone, kstatusviewstatewaiting, kstatusviewstatenoavailabledrivers, kstatusviewstateunsupportedarea, kstatusviewstatemain, kstatusviewstateaddress, kstatusviewstateblocked, kstatusviewstatenointernet }; let statusviewmode: TXBStatusViewState =.statusviewstateblocked //NOT SWIFTY typedef NS_ENUM(NSInteger,TXBStatusViewState) { TXBStatusViewStateNone, TXBStatusViewStateWaiting, TXBStatusViewStateNoAvailableDrivers, TXBStatusViewStateUnsupportedArea, TXBStatusViewStateMain, TXBStatusViewStateAddress, TXBStatusViewStateBlocked, TXBStatusViewStateNoInternet }; let statusviewmode: TXBStatusViewState =.blocked //SWIFTY

40 Being Swifty Example 3 Type Safety [[NSNotificationCenter defaultcenter] addobserver:self selector:@selector(_badrequestnotification:) name:@"krequestbadnotification" object:nil]; NotificationCenter.default.addObserver(self, selector: #selector(self.badrequestnotification), name: Notification.Name.requestBad, object: nil)

41 Coming Soon Taxibeat Widget

42 ios.conf app The.Conf app is built using embedded frameworks for the Watch App and we made it open source on Github

43 ios.conf app we made it open source on Github Questions? enum SupportedLanguages { case # case $ }

44 Questions

45 CocoaPods Single Podfile for both projects, same workspace pod update acts on both projects source ' Specs.git' workspace 'MyWorkspace' platform :ios, '9.0' use_frameworks! target 'MyProject' do project 'MyProject.xcodeproj' pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' pod 'FBSDKMessengerShareKit' pod 'Fabric' pod 'Crashlytics' end target 'MyFramework' do project../ios-framework/ MyFramework/MyFramework.xcodeproj' pod 'CocoaLumberjack' end

46 Warnings as errors Static Analyzer (ObjC): Localized Strings missing comments Treat warning as errors

47 API Design Example 1: Request Location Once [[TXBLocationManager sharedinstance] requestlocationoncewithcompletion:^(cllocation * _Nonnull location) { }]; // center map to user location

48 Mock URLSession class MockSession: URLSession { var completionhandler:((data?, URLResponse?, Error?) -> Void)? static var mockresponse: (data: Data?, urlresponse: URLResponse?, error: NSError?) override class var shared: URLSession { return MockSession() } override func datatask(with request: URLRequest, (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask { self.completionhandler = completionhandler return MockTask(response: MockSession.mockResponse, completionhandler: completionhandler) } class MockTask: URLSessionDataTask { typealias Response = (data: Data?, urlresponse: URLResponse?, error: NSError?) var mockresponse: Response let completionhandler: ((Data?, URLResponse?, Error?) -> Void)? init(response: Response, completionhandler:((data?, URLResponse?, Error?) -> Void)?) { self.mockresponse = response self.completionhandler = completionhandler } } } override func resume() { completionhandler!(mockresponse.data, mockresponse.urlresponse, mockresponse.error) }

49 Organization Separate project and git repo Same workspace (already setup due to CocoaPods) Alternatives: Subproject, different target [1] [1]

lecture 6 Closures, Networking, CocoaPods

lecture 6 Closures, Networking, CocoaPods lecture 6 Closures, Networking, CocoaPods cs198-001 : spring 2018 announcements no new lab this week - continuation of Pokedex lab + custom app workday (attendance still required) Pokedex due Wednesday

More information

Swift. Introducing swift. Thomas Woodfin

Swift. Introducing swift. Thomas Woodfin Swift Introducing swift Thomas Woodfin Content Swift benefits Programming language Development Guidelines Swift benefits What is Swift Benefits What is Swift New programming language for ios and OS X Development

More information

Programming ios in Lua A bridge story

Programming ios in Lua A bridge story Lua Workshop 2016 Programming ios in Lua A bridge story Jean-Luc Jumpertz @JLJump October 14, 2016 CodeFlow Live Application Development Environment for ios, tvos & macos CodeFlow Live Application Development

More information

Principles of Programming Languages. Objective-C. Joris Kluivers

Principles of Programming Languages. Objective-C. Joris Kluivers Principles of Programming Languages Objective-C Joris Kluivers joris.kluivers@gmail.com History... 3 NeXT... 3 Language Syntax... 4 Defining a new class... 4 Object identifiers... 5 Sending messages...

More information

Xcode 6 and ios 8 What s New for Software Developers

Xcode 6 and ios 8 What s New for Software Developers Xcode 6 and ios 8 What s New for Software Developers August 2014 Norman McEntire! norman.mcentire@servin.com Slides and Video of this presentation will be posted on Tuesday Aug 26 here: http://servin.com!1

More information

Introduction to Swift. Dr. Sarah Abraham

Introduction to Swift. Dr. Sarah Abraham Introduction to Swift Dr. Sarah Abraham University of Texas at Austin CS329e Fall 2018 What is Swift? Programming language for developing OSX, ios, WatchOS, and TvOS applications Best of C and Objective-C

More information

Questions. Exams: no. Get by without own Mac? Why ios? ios vs Android restrictions. Selling in App store how hard to publish? Future of Objective-C?

Questions. Exams: no. Get by without own Mac? Why ios? ios vs Android restrictions. Selling in App store how hard to publish? Future of Objective-C? Questions Exams: no Get by without own Mac? Why ios? ios vs Android restrictions Selling in App store how hard to publish? Future of Objective-C? Grading: Lab/homework: 40%, project: 40%, individual report:

More information

I, J. Key-value observing (KVO), Label component, 32 text property, 39

I, J. Key-value observing (KVO), Label component, 32 text property, 39 Index A Abstract factory pattern, 207 concrete factory, 213 examples in Cocoa, 227 groups of objects, 212 implementing, 213 abstract factories, 214 concrete factories, 214 215 operations, 212 213 pitfalls,

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++ CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 19 Introduction to C++ C++ C++ is an enormous language: All of C Classes and objects (kind of like Java, some crucial differences) Many

More information

Swift 5, ABI Stability and

Swift 5, ABI Stability and Swift 5, ABI Stability and Concurrency @phillfarrugia Important Documents Concurrency Manifesto by Chris Lattner https: /gist.github.com/lattner/ 31ed37682ef1576b16bca1432ea9f782 Kicking off Concurrency

More information

ios Developer s Guide Version 1.0

ios Developer s Guide Version 1.0 HealthyFROGS ios Developer s Guide ios Developer s Guide Version 1.0 Tuesday May 7, 2013 2012-2013 Computer Science Department, Texas Christian University - All Rights Reserved HealthyFROGS ios Developer

More information

Using and Extending the Xcode Source Editor

Using and Extending the Xcode Source Editor Developer Tools #WWDC16 Using and Extending the Xcode Source Editor Session 414 Mike Swingler Xcode Infrastructure and Editors Chris Hanson Xcode Infrastructure and Editors 2016 Apple Inc. All rights reserved.

More information

Building Faster in Xcode

Building Faster in Xcode #WWDC18 Building Faster in Xcode Session 408 David Owens, Xcode Engineer Jordan Rose, Swift Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018 User Interfaces Lecture 15 Application Programming on Mac OS Hamza Bennani hamza@hamzabennani.com September 4, 2018 Logistics Office hours: Tue/Thu, 2pm to 3pm. Office: 250 Geoff Wyvill. Acknowledgment:

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

CS193p Spring 2010 Thursday, April 29, 2010

CS193p Spring 2010 Thursday, April 29, 2010 CS193p Spring 2010 Announcements You should have received an e-mail by now If you received e-mail approving enrollment, but are not in Axess, do it! If you have any questions, please ask via e-mail or

More information

Miscellaneous Topics

Miscellaneous Topics Miscellaneous Topics Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Renaming Xcode project and

More information

Swift. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Swift. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Swift Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Why Swift Recommended for all ios, macos, watchos,

More information

Mobile Development Lab 3

Mobile Development Lab 3 Mobile Development Lab 3 Objectives Illustrate closures through examples Have fun with maps, location and geolocation Have fun with animations Closures implemented in Swift Closures are self-contained

More information

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa Music 3SI: Introduction to Audio/Multimedia App. Programming IDE (briefly) VST Plug-in Assignment 1 hints Last Week... Week #5-5/5/2006 CCRMA, Department of Music Stanford University 1 2 Today... Cocoa

More information

Building Microservices with the 12 Factor App Pattern

Building Microservices with the 12 Factor App Pattern Building Microservices with the 12 Factor App Pattern Context This documentation will help introduce Developers to implementing MICROSERVICES by applying the TWELVE- FACTOR PRINCIPLES, a set of best practices

More information

Richard Mallion. Swift for Admins #TEAMSWIFT

Richard Mallion. Swift for Admins #TEAMSWIFT Richard Mallion Swift for Admins #TEAMSWIFT Apple Introduces Swift At the WWDC 2014 Keynote, Apple introduced Swift A new modern programming language It targets the frameworks for Cocoa and Cocoa Touch

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

Recap: Functions as first-class values

Recap: Functions as first-class values Recap: Functions as first-class values Arguments, return values, bindings What are the benefits? Parameterized, similar functions (e.g. Testers) Creating, (Returning) Functions Iterator, Accumul, Reuse

More information

Types. Chapter Six Modern Programming Languages, 2nd ed. 1

Types. Chapter Six Modern Programming Languages, 2nd ed. 1 Types Chapter Six Modern Programming Languages, 2nd ed. 1 A Type Is A Set int n; When you declare that a variable has a certain type, you are saying that the values the variable can have are elements of

More information

ITP 342 Advanced Mobile App Dev. Memory

ITP 342 Advanced Mobile App Dev. Memory ITP 342 Advanced Mobile App Dev Memory Memory Management Objective-C provides two methods of application memory management. 1. In the method described in this guide, referred to as manual retain-release

More information

iphone Application Programming Lecture 3: Swift Part 2

iphone Application Programming Lecture 3: Swift Part 2 Lecture 3: Swift Part 2 Nur Al-huda Hamdan RWTH Aachen University Winter Semester 2015/2016 http://hci.rwth-aachen.de/iphone Review Type aliasing is useful! Escaping keywords could be useful! If you want

More information

QUIZ. What are 3 differences between C and C++ const variables?

QUIZ. What are 3 differences between C and C++ const variables? QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,

More information

1: Introduction to Object (1)

1: Introduction to Object (1) 1: Introduction to Object (1) 김동원 2003.01.20 Overview (1) The progress of abstraction Smalltalk Class & Object Interface The hidden implementation Reusing the implementation Inheritance: Reusing the interface

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010 CSE 374 Programming Concepts & Tools Hal Perkins Spring 2010 Lecture 19 Introduction ti to C++ C++ C++ is an enormous language: g All of C Classes and objects (kind of like Java, some crucial differences)

More information

Why Model-View-Controller?

Why Model-View-Controller? View Controllers Why Model-View-Controller? Ever used the word spaghetti to describe code? Clear responsibilities make things easier to maintain Avoid having one monster class that does everything Why

More information

Walkthrough: Binding an ios Objective-C Library

Walkthrough: Binding an ios Objective-C Library Walkthrough: Binding an ios Objective-C Library Binding an existing ios Objective-C Library with Objective Sharpie Overview When working on ios, you might encounter cases where you want to consume a third-party

More information

Architecting ios Project. Massimo Oliviero

Architecting ios Project. Massimo Oliviero Architecting ios Project Massimo Oliviero Massimo Oliviero Freelance Software Developer web http://www.massimooliviero.net email massimo.oliviero@gmail.com slide http://www.slideshare.net/massimooliviero

More information

COMP327 Mobile Computing Session: Lecture Set 1a - Swift Introduction and the Foundation Framework Part 2

COMP327 Mobile Computing Session: Lecture Set 1a - Swift Introduction and the Foundation Framework Part 2 COMP327 Mobile Computing Session: 2018-2019 Lecture Set 1a - Swift Introduction and the Foundation Framework Part 2 73 Other Swift Guard Already seen that for optionals it may be necessary to test that

More information

Libgdb. Version 0.3 Oct Thomas Lord

Libgdb. Version 0.3 Oct Thomas Lord Libgdb Version 0.3 Oct 1993 Thomas Lord Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

More information

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited CMSC 330: Organization of Programming Languages Type Systems, Names & Binding Topics Covered Thus Far Programming languages Syntax specification Regular expressions Context free grammars Implementation

More information

PIC 10A Objects/Classes

PIC 10A Objects/Classes PIC 10A Objects/Classes Ernest Ryu UCLA Mathematics Last edited: November 13, 2017 User-defined types In C++, we can define our own custom types. Object is synonymous to variable, and class is synonymous

More information

Kony Visualizer. Wearables Developer's Guide

Kony Visualizer. Wearables Developer's Guide Kony Visualizer Wearables Developer's Guide Release 7.3 Document Relevance and Accuracy This document is considered relevant to the Release stated on this title page and the document version stated on

More information

Announcement. Final Project Proposal Presentations and Updates

Announcement. Final Project Proposal Presentations and Updates Announcement Start Final Project Pitches on Wednesday Presentation slides dues by Tuesday at 11:59 PM Email slides to cse438ta@gmail.com Extensible Networking Platform 1 1 - CSE 438 Mobile Application

More information

What s New in Foundation for Swift Session 207

What s New in Foundation for Swift Session 207 App Frameworks #WWDC16 What s New in Foundation for Swift Session 207 Tony Parker Foundation, Apple Michael LeHew Foundation, Apple 2016 Apple Inc. All rights reserved. Redistribution or public display

More information

QUIZ Friends class Y;

QUIZ Friends class Y; QUIZ Friends class Y; Is a forward declaration neeed here? QUIZ Friends QUIZ Friends - CONCLUSION Forward (a.k.a. incomplete) declarations are needed only when we declare member functions as friends. They

More information

Porting Objective-C to Swift. Richard Ekle

Porting Objective-C to Swift. Richard Ekle Porting Objective-C to Swift Richard Ekle rick@ekle.org Why do we need this? 1.2 million apps in the ios App Store http://www.statista.com/statistics/276623/numberof-apps-available-in-leading-app-stores/

More information

An Introduction to TypeScript. Personal Info

An Introduction to TypeScript. Personal Info An Introduction to TypeScript Jason Bock Practice Lead Magenic Level: Beginner/Intermediate Personal Info http://www.magenic.com http://www.jasonbock.net https://www.twitter.com/jasonbock https://www.github.com/jasonbock

More information

Patterns & practices for unit-testing Swift-ly. Jakub Turek 18th June, 2018

Patterns & practices for unit-testing Swift-ly. Jakub Turek 18th June, 2018 Patterns & practices for unit-testing Swift-ly Jakub Turek 18th June, 2018 About me Jakub Turek https://jakubturek.com @KubaTurek turekj EL Passion 1 Agenda 1. Introduction to unit-testing. Test Driven

More information

Scope. Chapter Ten Modern Programming Languages 1

Scope. Chapter Ten Modern Programming Languages 1 Scope Chapter Ten Modern Programming Languages 1 Reusing Names Scope is trivial if you have a unique name for everything: fun square a = a * a; fun double b = b + b; But in modern languages, we often use

More information

Think like an Elm developer

Think like an Elm developer Think like an Elm developer Piper Niehaus Denver, CO, USA Backpacker / skier Nonprofit board chair Software Engineer at Pivotal Pivotal Tracker team Elm in Production since 2016 Internal Products and Services

More information

CSE 303: Concepts and Tools for Software Development

CSE 303: Concepts and Tools for Software Development CSE 303: Concepts and Tools for Software Development Hal Perkins Autumn 2008 Lecture 24 Introduction to C++ CSE303 Autumn 2008, Lecture 24 1 C++ C++ is an enormous language: All of C Classes and objects

More information

QUIZ. Source:

QUIZ. Source: QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Ch. 4: Data Abstraction The only way to get massive increases in productivity is to leverage off other people s code. That

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Type Systems, Names and Binding CMSC 330 - Spring 2013 1 Topics Covered Thus Far! Programming languages Ruby OCaml! Syntax specification Regular expressions

More information

Thread Sanitizer and Static Analysis

Thread Sanitizer and Static Analysis Developer Tools #WWDC16 Thread Sanitizer and Static Analysis Help with finding bugs in your code Session 412 Anna Zaks Manager, Program Analysis Team Devin Coughlin Engineer, Program Analysis Team 2016

More information

Cross-Platform Data Models and API Using grpc

Cross-Platform Data Models and API Using grpc Cross-Platform Data Models and API Using grpc Sebastian Hagedorn, Felix Lamouroux Outline 1. Motivation & Goals 2. Choosing the Right Cross-Platform Technology 3. Introduction to Protocol Buffers and grpc

More information

Swift, functional programming, and does it matter? Alexis

Swift, functional programming, and does it matter? Alexis Swift, functional programming, and does it matter? Alexis Gallagher @alexisgallagher Questions What s new in Swift? Is Swift a functional programming language? And what is functional anyway? How useful

More information

CS Lecture #14

CS Lecture #14 CS 213 -- Lecture #14 We re starting to catch up! Administrative... Late Night Guide to C++ Chapter 9 pg 222-239 MORE ABOUT CLASSES Part I Interfaces in C++ For those with Java experience, you know that

More information

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016 Stanford Developing Applications for ios Today Memory Management for Reference Types Controlling when things leave the heap Closure Capture Closures capture things into the heap too Extensions A simple,

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 13 Introduction to ObjectiveC Part II 2013/2014 Parma Università degli Studi di Parma Lecture Summary Object creation Memory management Automatic Reference Counting

More information

AdFalcon ios SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

AdFalcon ios SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group AdFalcon ios SDK 4.1.0 Developer's Guide AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group Table of Contents 1 Introduction... 3 Prerequisites... 3 2 Install AdFalcon SDK... 4 2.1 Use CocoaPods

More information

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017 Stanford Developing Applications for ios Today Error Handling in Swift try Extensions A simple, powerful, but easily overused code management syntax Protocols Last (but certainly not least important) typing

More information

Safety SPL/2010 SPL/20 1

Safety SPL/2010 SPL/20 1 Safety 1 system designing for concurrent execution environments system: collection of objects and their interactions system properties: Safety - nothing bad ever happens Liveness - anything ever happens

More information

Registering for the Apple Developer Program

Registering for the Apple Developer Program It isn t necessary to be a member of the Apple Developer Program if you don t intend to submit apps to the App Stores, or don t need the cloud-dependent features. We strongly recommend joining, though,

More information

IPHONE DEVELOPMENT. Getting Started with the iphone SDK

IPHONE DEVELOPMENT. Getting Started with the iphone SDK IPHONE DEVELOPMENT Getting Started with the iphone SDK OBJECTIVE-C The Big Picture STRICT SUPERSET OF C The Objective C Language Any C stuff applies Standard libs are here (time, sqrt etc) The C Language

More information

In the CERTAINTY project, an application is defined as a network of independent processes with the following features:

In the CERTAINTY project, an application is defined as a network of independent processes with the following features: C/C++ Coding Guide G. Giannopoulou, P. Huang, N. Stoimenov, L. Thiele April 15, 2014 This document describes how to program DOL-Critical applications using C/C++ as programming language. To be able to

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

Learn to make watchosle

Learn to make watchosle HACKING WITH SWIFT COMPLETE TUTORIAL COURSE Learn to make watchosle P apps with real-worldam S Swift projects REEPaul Hudson F Project 1 NoteDictate 2 www.hackingwithswift.com Setting up In this project

More information

Maps, locations & sensors in ios

Maps, locations & sensors in ios Maps, locations & sensors in ios Sebastian Ernst, PhD Department of Applied Computer Science AGH University of Science and Technology Displaying maps (ObjC) Maps are handled by MapKit and displayed using

More information

Cisco StadiumVision Mobile API for Apple ios

Cisco StadiumVision Mobile API for Apple ios CHAPTER 1 Revised: March 28, 2013 Introduction to The ios SDK is provided as a set of static libraries, header files, and an a sample ios app (with a complete Xcode project). This API uses Objective-C

More information

Introductory ios Development

Introductory ios Development Introductory ios Development 152-164 Unit 5 - Multi-View Apps Quick Links & Text References What is a Delegate? What is a Protocol? Delegates, Protocols and TableViews Creating a Master-Detail App Modifying

More information

Testing in ios. Paweł Dudek. Thursday, July 4, 13

Testing in ios. Paweł Dudek. Thursday, July 4, 13 Testing in ios Paweł Dudek 1 Why do we want to write tests? 2 Reasons for testing Striving for better software Faster development cycles Being confident about your code Leads to better, more modularized

More information

Courage! TDD and embedded software. Matthew Eshleman covemountainsoftware.com

Courage! TDD and embedded software. Matthew Eshleman covemountainsoftware.com Courage! TDD and embedded software Matthew Eshleman covemountainsoftware.com Background - Matthew Eshleman 15+ years of embedded software development, architecture, management, and project planning Delivered

More information

Functional Reactive Programming on ios

Functional Reactive Programming on ios Functional Reactive Programming on ios Functional reactive programming introduction using ReactiveCocoa Ash Furrow This book is for sale at http://leanpub.com/iosfrp This version was published on 2016-05-28

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lecture 10: Managing and Storing Data Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Content Property Lists Archiving

More information

Concepts of programming languages

Concepts of programming languages Concepts of programming languages Something El(m)se Paolo Servillo, Enzo van Kessel, Jesse de Ruijter 1 Contents What is Elm? The language The architecture Transcompiling Elm in practice 2 What is Elm?

More information

CS 370 Design Heuristics D R. M I C H A E L J. R E A L E F A L L

CS 370 Design Heuristics D R. M I C H A E L J. R E A L E F A L L CS 370 Design Heuristics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Introduction Now we ll talk about ways of thinking about design Guidelines for trials in trial and errors Major Design Heuristics

More information

JavaScript Patterns O'REILLY* S toy an Stefanov. Sebastopol. Cambridge. Tokyo. Beijing. Farnham K8ln

JavaScript Patterns O'REILLY* S toy an Stefanov. Sebastopol. Cambridge. Tokyo. Beijing. Farnham K8ln JavaScript Patterns S toy an Stefanov O'REILLY* Beijing Cambridge Farnham K8ln Sebastopol Tokyo Table of Contents Preface xiii 1. Introduction 1 Patterns 1 JavaScript: Concepts 3 Object-Oriented 3 No Classes

More information

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file? QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The

More information

OpenACC Course. Office Hour #2 Q&A

OpenACC Course. Office Hour #2 Q&A OpenACC Course Office Hour #2 Q&A Q1: How many threads does each GPU core have? A: GPU cores execute arithmetic instructions. Each core can execute one single precision floating point instruction per cycle

More information

Full Stack Web Developer

Full Stack Web Developer Full Stack Web Developer Course Contents: Introduction to Web Development HTML5 and CSS3 Introduction to HTML5 Why HTML5 Benefits Of HTML5 over HTML HTML 5 for Making Dynamic Page HTML5 for making Graphics

More information

GAVIN KING RED HAT CEYLON SWARM

GAVIN KING RED HAT CEYLON SWARM GAVIN KING RED HAT CEYLON SWARM CEYLON PROJECT A relatively new programming language which features: a powerful and extremely elegant static type system built-in modularity support for multiple virtual

More information

To use Xcode s Continuous Integration service with this Xcode beta, you need OS X with OS X Server 4.0.

To use Xcode s Continuous Integration service with this Xcode beta, you need OS X with OS X Server 4.0. Xcode Release Notes About Xcode 6.3 beta Supported Configurations Xcode 6.3 requires a Mac running OS X 10.10. Xcode 6.3 includes SDKs for ios 8.3 and OS X versions 10.9 and 10.10. To develop apps targeting

More information

QUIZ. What is wrong with this code that uses default arguments?

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information

Cloud-Native Applications. Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0

Cloud-Native Applications. Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0 Cloud-Native Applications Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0 Cloud-Native Characteristics Lean Form a hypothesis, build just enough to validate or disprove it. Learn

More information

OSGi on the Server. Martin Lippert (it-agile GmbH)

OSGi on the Server. Martin Lippert (it-agile GmbH) OSGi on the Server Martin Lippert (it-agile GmbH) lippert@acm.org 2009 by Martin Lippert; made available under the EPL v1.0 October 6 th, 2009 Overview OSGi in 5 minutes Apps on the server (today and tomorrow)

More information

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO

More information

Expanding Our Horizons. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 9 09/25/2011

Expanding Our Horizons. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 9 09/25/2011 Expanding Our Horizons CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 9 09/25/2011 1 Goals of the Lecture Cover the material in Chapter 8 of our textbook New perspective on objects and encapsulation

More information

iphone Application Programming Lab 3: Swift Types and Custom Operator + A02 discussion

iphone Application Programming Lab 3: Swift Types and Custom Operator + A02 discussion Lab 3: Swift Types and Custom Operator + A02 discussion Nur Al-huda Hamdan RWTH Aachen University Winter Semester 2015/2016 http://hci.rwth-aachen.de/iphone Learning Objectives Discuss A02 Another implementation

More information

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall Stanford Developing Applications for ios Today Mostly more Swift but some other stuff too Quick demo of mutating protocols String NSAttributedString Closures (and functions as types in general) Data Structures

More information

ITP 342 Mobile App Dev. Locations and Maps

ITP 342 Mobile App Dev. Locations and Maps ITP 342 Mobile App Dev Locations and Maps Locations and Maps Every ios device has the ability to determine where in the world it is Create a live interactive map showing any locations you like, including

More information

Building Mapping Apps for ios With Swift

Building Mapping Apps for ios With Swift Building Mapping Apps for ios With Swift Jeff Linwood This book is for sale at http://leanpub.com/buildingmappingappsforioswithswift This version was published on 2017-09-09 This is a Leanpub book. Leanpub

More information

SWIFT! init(title: String) { self.title = title } // required initializer w/ named parameter

SWIFT! init(title: String) { self.title = title } // required initializer w/ named parameter SWIFT! class Session { let title: String // constant non-optional field: can never be null and can never be changed var instruktør: Person? // variable optional field: null is permitted var attendees:

More information

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#)

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#) Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#) Course Number: 6367A Course Length: 3 Days Course Overview This three-day course will enable students to start designing

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

Inheritance (Chapter 7)

Inheritance (Chapter 7) Inheritance (Chapter 7) Prof. Dr. Wolfgang Pree Department of Computer Science University of Salzburg cs.uni-salzburg.at Inheritance the soup of the day?! Inheritance combines three aspects: inheritance

More information

DESIGN, EVOLUTION AND USE

DESIGN, EVOLUTION AND USE DESIGN, EVOLUTION AND USE of KernelF voelter@acm.org www.voelter.de @markusvoelter Markus Völter Check out the paper! http://voelter.de/data /pub/kernelf-icmt.pdf EXAMPLE 1 Healthcare 1 Context Mobile

More information

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall Stanford Developing Applications for ios Today Mostly Swift but some other stuff too Autolayout teaser Quick review of what we learned in Concentration CountableRange of floating point numbers Tuples Computed

More information

Python Basics. Lecture and Lab 5 Day Course. Python Basics

Python Basics. Lecture and Lab 5 Day Course. Python Basics Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability

More information

Cross-compiling C++ to JavaScript. Challenges in porting the join.me common library to HTML5

Cross-compiling C++ to JavaScript. Challenges in porting the join.me common library to HTML5 Cross-compiling C++ to JavaScript Challenges in porting the join.me common library to HTML5 JUNE 24, 2015 LEVENTE HUNYADI join.me at a glance 2 join.me at a glance 3 join.me characteristics Application

More information

Objective-C. Deck.m. Deck.h. Let s look at another class. This one represents a deck of cards. #import <Foundation/Foundation.h> #import "Deck.

Objective-C. Deck.m. Deck.h. Let s look at another class. This one represents a deck of cards. #import <Foundation/Foundation.h> #import Deck. Deck.h #import @interface Deck : NSObject @interface Deck() @implementation Deck Deck.m Let s look at another class. This one represents a deck of cards. Deck.h #import

More information

Extending CircuitPython: An Introduction

Extending CircuitPython: An Introduction Extending CircuitPython: An Introduction Created by Dave Astels Last updated on 2018-11-15 11:08:03 PM UTC Guide Contents Guide Contents Overview How-To A Simple Example shared-module shared-bindings ports/atmel-samd

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

More information

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013 Developing Applications for ios -14 Today What is this class all about? Description Prerequisites Homework / Final Project ios Overview What s in ios? MVC Object-Oriented Design Concept Objective C (Time

More information