SlideShare a Scribd company logo
InterConnect
2017
6190:
Server-Side Swift:
An Introduction for Java EE Developers
Chris Bailey

STSM, Technical Architect
Java, Node.js and Swift at IBM
Stephan Knitelius,
Senior Consultant

Faktor Zhen AG
InterConnect:  Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java Developers
Swift Programming
Safe | Expressive | Fast
Hello World
Swift: Hello World
print("Hello, world!")
Swift: Hello World
print("Hello, world!")
> swift main.swift
Swift: Hello World
print("Hello, world!")
> swift main.swift
> main
Swift: Hello World
print("Hello, world!")
> swift main.swift
> main
"Hello, world!"
Swift: Hello World
let event = ”InterConnect"
print("Hello, (event)”)
Swift: Hello World
let event = ”InterConnect"
print("Hello, (event)”)
> swift main.swift
Swift: Hello World
let event = ”InterConnect"
print("Hello, (event)”)
> swift main.swift
> main
"Hello, InterConnect"
Swift: Hello World
let event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
Swift: Hello World
let event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
> swift main.swift
Swift: Hello World
let event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
> swift main.swift
error: cannot assign to value: 'event' is a 'let' constant
Swift: Hello World
let event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
Swift: Hello World
let event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
Swift: Hello World
var event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
Swift: Hello World
var event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
> swift main.swift
Swift: Hello World
var event = "InterConnect"
event = "Somewhere else"
print("Hello, (event)”)
> swift main.swift
> main
"Hello, Somewhere else"
Swift: Hello World
Functions
func addInts(a: Int, b: Int) -> Int {
return a + b
}
Swift: Functions
func addInts(a: Int, b: Int) -> Int {
return a + b
}
addInts(a: 1, b: 3)
Swift: Functions
func addInts(_ a: Int, _ b: Int) -> Int {
return a + b
}
Swift: Functions
func addInts(_ a: Int, _ b: Int) -> Int {
return a + b
}
addInts(1, 3)
Swift: Functions
func move(from start: Point, to end: Point) -> Bool {
/* code */
}
Swift: Functions
func move(from start: Point, to end: Point) -> Bool {
/* code */
}
move(from: a, to: b)
Swift: Functions
func minAndMax(numbers: Int...) -> (min: Int, max: Int) {
}
Swift: Functions and Tuples
func minAndMax(numbers: Int...) -> (min: Int, max: Int) {
var min = numbers[0]
var max = numbers[0]
for number in numbers {
if number > max {
max = number
} else if number < min {
min = number
}
}
return (min, max)
}
Swift: Functions and Tuples
func minAndMax(numbers: Int...) -> (min: Int, max: Int) {
var min = numbers[0]
var max = numbers[0]
for number in numbers {
if number > max {
max = number
} else if number < min {
min = number
}
}
return (min, max)
}
let result = minAndMax(1, 2, 3, 4, 5)
Swift: Functions: Varargs and Tuples
func minAndMax(numbers: Int...) -> (min: Int, max: Int) {
var min = numbers[0]
var max = numbers[0]
for number in numbers {
if number > max {
max = number
} else if number < min {
min = number
}
}
return (min, max)
}
let result = minAndMax(1, 2, 3, 4, 5)
print(result.min)
print(result.max)
Swift: Functions: Varargs and Tuples
Control Flow
let expenseCosts = [34.4, 30.99, 250.0]
var sum: Double = 0
for expense in expenseCosts {
sum += expense
}
print("total cost is (sum)")
Swift: Loops and Iterators
let flavour = "Vanilla"
switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
Swift: Switch Statements
let flavour = "Vanilla"
switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
> swiftc main.swift
> main
Swift: Switch Statements
let flavour = "Vanilla"
switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
> swiftc main.swift
> main
"No opinion about this"
Swift: Switch Statements
let flavour = "Mint Chocolate"
switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
Swift: Switch Statements
let flavour = "Mint Chocolate"

switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
> swiftc main.swift
> main
Swift: Switch Statements
let flavour = "Mint Chocolate"

switch flavour {
case "Chocolate":
print("Quite nice")
case "Strawberry", "Rum'n'raisin":
print("Very nice")
case let str where str.hasPrefix("Mint"):
print("UGH!!!, I hate (str)")
default:
print("No opinion about this")
}
> swiftc main.swift
> main
"UGH!!!, I hate Mint Chocolate"
Swift: Switch Statements
let numbers = [1, 2, 3]
numbers.map({
(number: Int) -> Int in
return number * 5
})
// [5, 10, 15]
numbers.map({
number in number * 5
})
numbers.map { $0 * 5 }
Swift: Closures
Data Types
class Square {
var area: Double = 0
init(sideLength: Double) {
self.sideLength = sideLength
}
var sideLength: Double {
get {
return sqrt(area)
}
set {
area = newValue * newValue
}
}
}
Swift: Classes
struct Point {
var x: Int
var y: Int
func description() -> String {
return "x=(x), y=(y)"
}
}
var coord = Point(x: 2, y: 4)
var newCoord = coord
coord.x = 4
print(coord.description()) // x=4, y=4
print(newCoord.description()) // x=2, y=4
Swift: Structs
enum ApprovalStatus {
case PendingOn(String)
case Denied

case Approved(String)
}
var status = ApprovalStatus.PendingOn("Joe Bloggs")
status = .Approved("13213-4341321-2")
switch status {
case .PendingOn(let approver):
print("Request pending on approval from (approver)")
case .Denied:
print("Request DENIED")
case .Approved(let code):
print("Request approved - auth code (code)")
}
Swift: Enums
Concurrency
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let serialQueue = DispatchQueue(label: "serial queue")
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let serialQueue = DispatchQueue(label: "serial queue")
serialQueue.async {
print("run on serial queue")
}
serialQueue.asyncAfter(deadline: .now() + DispatchTimeInterval.seconds(1)) {
print("run on serial queue")
}
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let concurrentQueue = DispatchQueue(label: "concurrent queue", attributes: .concurrent)
concurrentQueue.async {
print("run on concurrent queue")
}
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let queue = DispatchQueue(label: "group queue", attributes: .concurrent)
let group = DispatchGroup()
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let queue = DispatchQueue(label: "group queue", attributes: .concurrent)
let group = DispatchGroup()
queue.async(group: group) {
print("work 1")
}
queue.async(group: group) {
print("work 2")
}
a	queue	-	FIFO	
put	task	into	queue		
to	execute	
dequeued	tasks		
are	being	executed	
in	wai8ng	
Serial or Concurrent
FIFO Queue
Waiting Tasks
Tasks Added

To Queue
Tasks Removed

For Execution
import Dispatch
let queue = DispatchQueue(label: "group queue", attributes: .concurrent)
let group = DispatchGroup()
queue.async(group: group) {
print("work 1")
}
queue.async(group: group) {
print("work 2")
}
group.notify(queue: queue) {
print("all work completed")
}
Swift Programming
Safe | Expressive | Fast
Swift Programming
Safe | Expressive | Fast
Swift @ IBM
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
> swiftc main.swift
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
> swiftc main.swift
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
> swiftc main.swift
> Error line 7: Value of optional type
‘String?’ not unwrapped;
> did you mean to use ‘!’ or ‘?’?
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
> swiftc main.swift
> Error line 7: Value of optional type
‘String?’ not unwrapped;
> did you mean to use ‘!’ or ‘?’?
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
> java Test
SwiftJava
Swift @ IBM
func length(of string: String) -> Void {
print(string.characters.count)
}
var str: String? = nil
length(of: str)
> swiftc main.swift
> Error line 7: Value of optional type
‘String?’ not unwrapped;
> did you mean to use ‘!’ or ‘?’?
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
> java Test
Exception in thread "main"
java.lang.NullPointerException
at Test.length(Test.java:5)
at Test.main(Test.java:11)
SwiftJava
var optionalString: String? = nil
var string: String = optionalString
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString
> swiftc main.swift
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString
> swiftc main.swift
error: value of optional type 'String?' not unwrapped; did you mean to use '!'
or ‘?'?
var string: String = optionalString
^
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString!
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString!
> swiftc main.swift
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString!
> swiftc main.swift
> main
Swift: Structs
var optionalString: String? = nil
var string: String = optionalString!
> swiftc main.swift
> main
fatal error: unexpectedly found nil while unwrapping an Optional value
Swift: Structs
var optionalString: String? = nil
guard var string: String = optionalString else {
print(‘Error! Null string found’)
}
Swift: Structs
var optionalString: String? = nil
guard var string: String = optionalString else {
print(‘Error! Null string found’)
}
> swiftc main.swift
Swift: Structs
var optionalString: String? = nil
guard var string: String = optionalString else {
print(‘Error! Null string found’)
}
> swiftc main.swift
> main
“Error! Null string found”
Swift: Structs
Swift Programming
Safe | Expressive | Fast
func move(from start: Point, to end: Point) -> Bool {
/* code */
}
Swift: Functions
func move(from start: Point, to end: Point) -> Bool {
/* code */
}
move(from: a, to: b)
Swift: Functions
Swift @ IBM
public class Test {
private static void length (String string){
System.out.println(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
SwiftJava
Swift @ IBM
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
SwiftJava
Swift @ IBM
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
SwiftJava
Swift @ IBM
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
> swiftc main.swift
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
SwiftJava
Swift @ IBM
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
> swiftc main.swift
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift @ IBM
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
> swiftc main.swift
> Warning: result of call to ‘length(of:)’ is
unused
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift @ IBM
@discardableResult
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
> swiftc main.swift
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift @ IBM
@discardableResult
func length(of string: String) -> Int {
return(string.characters.count)
}
var str: String = ”MyString”
length(of: str)
> swiftc main.swift
>
public class Test {
private static int length (String string){
return(string.length());
}
public static void main(String[] args){
String string = null;
length(string);
}
}
> javac Test.java
>
SwiftJava
Swift Programming
Safe | Expressive | Fast
0	
2	
4	
6	
8	
10	
12	
14	
16	
18	
				
Duration(s)
(lowerisbetter)
http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm
Typed vs Untyped Performance
4	
0	
2	
4	
6	
8	
10	
12	
14	
16	
18	
				
http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm
Typed vs Untyped Performance
Duration(s)
(lowerisbetter)
4	 4.3	
0	
2	
4	
6	
8	
10	
12	
14	
16	
18	
				
http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm
Typed vs Untyped Performance
Duration(s)
(lowerisbetter)
4	 4.3	
15.8	
0	
2	
4	
6	
8	
10	
12	
14	
16	
18	
				
http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm
Typed vs Untyped Performance
Duration(s)
(lowerisbetter)
InterConnect:  Server Side Swift for Java Developers
+
Kitura + Liberty

Demo
https://github.com/sknitelius/RacketenMessages-Swift
https://github.com/sknitelius/RacketenMessages-Java
JSON Parsing
Persistence
InterConnect:  Server Side Swift for Java Developers
94 1/17/17
GATEWAY
PUBLIC NETWORK CLOUD NETWORK
Client Devices Hosted Services
ROUTING PROXY
Micro-ServicesBackend For Frontend

(BFF)
Questions?
Bluemix Mobile & Omni-Channel!
BMO-6321: Patterns in Omni-Channel
Cloud Application Development
Containers & Microservices!
BMC-2173: Introduction to Docker
Containers and Microservices
Visit the DevZone in the Concourse for open
Hello World labs and Ask Me Anything booths!
Wednesday, 11:15 AM - 12:00 PM | South Pacific C | Session ID: 6321A
Tuesday, 4:45 PM - 5:30 PM | South Pacific A | Session ID: 2173A
Tuesday, 11:00 AM - 12:45 PM | DevZone Ask Me Anything # 2 | Session ID: 7087A
Ask Me Anything: Bluemix Cloud-Native Development
Ask Me Anything: Server-Side Swift Development
Wednesday, 2:30 PM - 5:00 PM | DevZone Ask Me Anything # 6 | Session ID: 7088A
Node.js & LoopBack
BAP-1117: Introduction to LoopBack
Node.js Framework
Liberty & Microservices
BAP - 5081: Microservices with IBM WebSphere Liberty:
What, Why and When?
Wednesday, 11:15 AM - 12:00 PM | Islander F | Session ID: 1117A
Tuesday, 7:00 PM - 7:20 PM | Engagement Theater Booth #319 | Session ID: 5081A
1/17/17
Please note
IBM’s statements regarding its plans, directions, and intent 

are subject to change or withdrawal without notice at IBM’s 

sole discretion.
Information regarding potential future products is intended to
outline our general product direction and it should not be relied
on in making a purchasing decision.
The information mentioned regarding potential future products
is not a commitment, promise, or legal obligation to deliver 

any material, code or functionality. Information about potential
future products may not be incorporated into any contract.
The development, release, and timing of any future features 

or functionality described for our products remains at our sole
discretion.
Performance is based on measurements and projections 

using standard IBM benchmarks in a controlled environment.
The actual throughput or performance that any user will
experience will vary depending upon many factors, including
considerations such as the amount of multiprogramming in

the user’s job stream, the I/O configuration, the storage
configuration, and the workload processed. Therefore, no
assurance can be given that an individual user will achieve
results similar to those stated here.
1/17/17
Notices and disclaimers
Copyright © 2017 by International Business Machines Corporation (IBM).
No part of this document may be reproduced or transmitted in any form
without written permission from IBM.
U.S. Government Users Restricted Rights — use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM.
Information in these presentations (including information relating to
products that have not yet been announced by IBM) has been reviewed
for accuracy as of the date of initial publication and could include
unintentional technical or typographical errors. IBM shall have no
responsibility to update this information. This document is distributed
“as is” without any warranty, either express or implied. In no event
shall IBM be liable for any damage arising from the use of this
information, including but not limited to, loss of data, business
interruption, loss of profit or loss of opportunity. IBM products and
services are warranted according to the terms and conditions of the
agreements under which they are provided.
IBM products are manufactured from new parts or new and used parts. 

In some cases, a product may not be new and may have been previously
installed. Regardless, our warranty terms apply.”
Any statements regarding IBM's future direction, intent or product
plans are subject to change or withdrawal without notice.
Performance data contained herein was generally obtained in a
controlled, isolated environments. Customer examples are presented 

as illustrations of how those customers have used IBM products and 

the results they may have achieved. Actual performance, cost, savings or
other results in other operating environments may vary.
References in this document to IBM products, programs, or services does
not imply that IBM intends to make such products, programs or services
available in all countries in which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared
by independent session speakers, and do not necessarily reflect the 

views of IBM. All materials and discussions are provided for informational
purposes only, and are neither intended to, nor shall constitute legal or
other guidance or advice to any individual participant or their specific
situation.
It is the customer’s responsibility to insure its own compliance with legal
requirements and to obtain advice of competent legal counsel as to
the identification and interpretation of any relevant laws and regulatory
requirements that may affect the customer’s business and any actions

the customer may need to take to comply with such laws. IBM does not
provide legal advice or represent or warrant that its services or products
will ensure that the customer is in compliance with any law.
1/17/17
Notices and disclaimers
continued
Information concerning non-IBM products was obtained from the suppliers
of those products, their published announcements or other publicly
available sources. IBM has not tested those products in connection with
this publication and cannot confirm the accuracy of performance,
compatibility or any other claims related to non-IBM products. Questions
on the capabilities of non-IBM products should be addressed to the
suppliers of those products. IBM does not warrant the quality of any third-
party products, or the ability of any such third-party products to
interoperate with IBM’s products. IBM expressly disclaims all
warranties, expressed or implied, including but not limited to, the
implied warranties of merchantability and fitness for a particular,
purpose.
The provision of the information contained herein is not intended to, and
does not, grant any right or license under any IBM patents, copyrights,
trademarks or other intellectual property right.
IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS,
Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document
Management System™, FASP®, FileNet®, Global Business Services®,

Global Technology Services®, IBM ExperienceOne™, IBM SmartCloud®,
IBM Social Business®, Information on Demand, ILOG, Maximo®,
MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower,
PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®,
PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®,
PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®,
SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli® Trusteer®,
Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and
System z® Z/OS, are trademarks of International Business Machines
Corporation, registered in many jurisdictions worldwide. Other product
and service names might be trademarks of IBM or other companies. A
current list of IBM trademarks is available on the Web at "Copyright and
trademark information" at: www.ibm.com/legal/copytrade.shtml.
InterConnect
2017
100 1/17/17

More Related Content

What's hot (20)

PDF
What's New in ES6 for Web Devs
Rami Sayar
 
PDF
"О некоторых особенностях Objective-C++" Влад Михайленко (Maps.Me)
AvitoTech
 
PDF
Monoids, Store, and Dependency Injection - Abstractions for Spark Streaming Jobs
Ryan Weald
 
PDF
Scalaz Stream: Rebirth
John De Goes
 
PDF
EcmaScript 6 - The future is here
Sebastiano Armeli
 
PPTX
PlantUML
Leo Liang
 
PPTX
History of asynchronous in .NET
Marcin Tyborowski
 
PDF
Draw More, Work Less
Michael Bar-Sinai
 
PDF
Release with confidence
John Congdon
 
ODP
Advanced Perl Techniques
Dave Cross
 
PDF
The algebra of library design
Leonardo Borges
 
PDF
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
 
PDF
React Native One Day
Troy Miles
 
PDF
Lego: A brick system build by scala
lunfu zhong
 
PDF
React Native Evening
Troy Miles
 
PDF
JVMLS 2016. Coroutines in Kotlin
Andrey Breslav
 
PDF
Just-In-Time Compiler in PHP 8
Nikita Popov
 
PDF
ECMAScript 6
偉格 高
 
PDF
Callbacks and control flow in Node js
Thomas Roch
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
James Titcumb
 
What's New in ES6 for Web Devs
Rami Sayar
 
"О некоторых особенностях Objective-C++" Влад Михайленко (Maps.Me)
AvitoTech
 
Monoids, Store, and Dependency Injection - Abstractions for Spark Streaming Jobs
Ryan Weald
 
Scalaz Stream: Rebirth
John De Goes
 
EcmaScript 6 - The future is here
Sebastiano Armeli
 
PlantUML
Leo Liang
 
History of asynchronous in .NET
Marcin Tyborowski
 
Draw More, Work Less
Michael Bar-Sinai
 
Release with confidence
John Congdon
 
Advanced Perl Techniques
Dave Cross
 
The algebra of library design
Leonardo Borges
 
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
 
React Native One Day
Troy Miles
 
Lego: A brick system build by scala
lunfu zhong
 
React Native Evening
Troy Miles
 
JVMLS 2016. Coroutines in Kotlin
Andrey Breslav
 
Just-In-Time Compiler in PHP 8
Nikita Popov
 
ECMAScript 6
偉格 高
 
Callbacks and control flow in Node js
Thomas Roch
 
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
James Titcumb
 

Viewers also liked (20)

PDF
Playgrounds: Mobile + Swift = BFF
Chris Bailey
 
PDF
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
Hossam Ghareeb
 
PDF
iOS for Android Developers (with Swift)
David Truxall
 
PDF
A swift introduction to Swift
Giordano Scalzo
 
PDF
To Swift 2...and Beyond!
Scott Gardner
 
PPTX
iOS Swift & OCR 玩文字辨識
政斌 楊
 
PDF
Swift Programming Language
Giuseppe Arici
 
PDF
Swift on the Server
Dev_Events
 
PPT
JPA Performance Myths -- JavaOne 2013
richardgcurtis
 
PDF
Creating Effective Mobile Applications with IBM Bluemix
Andrew Ferrier
 
PPTX
Node Summit 2016: Web App Architectures
Chris Bailey
 
PDF
O'Reilly Software Architecture Conf: Cloud Economics
Chris Bailey
 
PDF
Swift Summit: Pushing the boundaries of Swift to the Server
Chris Bailey
 
PDF
Using APIs to Create an Omni-Channel Retail Experience
CA API Management
 
PDF
Cloud Native Patterns with Bluemix Developer Console
Matthew Perrins
 
PDF
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
Phil Estes
 
PDF
Containers and microservices for realists
Karthik Gaekwad
 
PPTX
Craftworkz at InterConnect 2017 - Creating a Highly Scalable Chatbot in a Mic...
craftworkz
 
PDF
Node Foundation Membership Overview 20160907
NodejsFoundation
 
PPTX
Webquest
NataliaRomeroH
 
Playgrounds: Mobile + Swift = BFF
Chris Bailey
 
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
Hossam Ghareeb
 
iOS for Android Developers (with Swift)
David Truxall
 
A swift introduction to Swift
Giordano Scalzo
 
To Swift 2...and Beyond!
Scott Gardner
 
iOS Swift & OCR 玩文字辨識
政斌 楊
 
Swift Programming Language
Giuseppe Arici
 
Swift on the Server
Dev_Events
 
JPA Performance Myths -- JavaOne 2013
richardgcurtis
 
Creating Effective Mobile Applications with IBM Bluemix
Andrew Ferrier
 
Node Summit 2016: Web App Architectures
Chris Bailey
 
O'Reilly Software Architecture Conf: Cloud Economics
Chris Bailey
 
Swift Summit: Pushing the boundaries of Swift to the Server
Chris Bailey
 
Using APIs to Create an Omni-Channel Retail Experience
CA API Management
 
Cloud Native Patterns with Bluemix Developer Console
Matthew Perrins
 
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
Phil Estes
 
Containers and microservices for realists
Karthik Gaekwad
 
Craftworkz at InterConnect 2017 - Creating a Highly Scalable Chatbot in a Mic...
craftworkz
 
Node Foundation Membership Overview 20160907
NodejsFoundation
 
Webquest
NataliaRomeroH
 
Ad

Similar to InterConnect: Server Side Swift for Java Developers (20)

PDF
Are we ready to Go?
Adam Dudczak
 
PDF
Emerging Languages: A Tour of the Horizon
Alex Payne
 
PPTX
Dts x dicoding #2 memulai pemrograman kotlin
Ahmad Arif Faizin
 
PDF
Idioms in swift 2016 05c
Kaz Yoshikawa
 
PDF
Something about Golang
Anton Arhipov
 
PDF
iOS Talks 1 - CodeCamp Osijek - Swift u praksi
Marin Benčević
 
PPTX
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Domenic Denicola
 
PPTX
Programming ppt files (final)
yap_raiza
 
PDF
The Joy Of Server Side Swift Development
Giordano Scalzo
 
PDF
The Joy of Server Side Swift Development
Giordano Scalzo
 
PDF
The Joy of ServerSide Swift Development
Giordano Scalzo
 
PDF
scala-gopher: async implementation of CSP for scala
Ruslan Shevchenko
 
PDF
The Evolution of Async-Programming (SD 2.0, JavaScript)
jeffz
 
PDF
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
GeeksLab Odessa
 
PDF
Go ahead, make my day
Tor Ivry
 
PDF
Coroutines in Kotlin. In-depth review
Dmytro Zaitsev
 
PDF
Coroutines in Kotlin. UA Mobile 2017.
UA Mobile
 
PPTX
Kotlin coroutines and spring framework
Sunghyouk Bae
 
PPTX
Kotlin Coroutines and Rx
Shaul Rosenzwieg
 
PDF
The Swift Compiler and Standard Library
Santosh Rajan
 
Are we ready to Go?
Adam Dudczak
 
Emerging Languages: A Tour of the Horizon
Alex Payne
 
Dts x dicoding #2 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Idioms in swift 2016 05c
Kaz Yoshikawa
 
Something about Golang
Anton Arhipov
 
iOS Talks 1 - CodeCamp Osijek - Swift u praksi
Marin Benčević
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Domenic Denicola
 
Programming ppt files (final)
yap_raiza
 
The Joy Of Server Side Swift Development
Giordano Scalzo
 
The Joy of Server Side Swift Development
Giordano Scalzo
 
The Joy of ServerSide Swift Development
Giordano Scalzo
 
scala-gopher: async implementation of CSP for scala
Ruslan Shevchenko
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
jeffz
 
Java/Scala Lab: Руслан Шевченко - Implementation of CSP (Communication Sequen...
GeeksLab Odessa
 
Go ahead, make my day
Tor Ivry
 
Coroutines in Kotlin. In-depth review
Dmytro Zaitsev
 
Coroutines in Kotlin. UA Mobile 2017.
UA Mobile
 
Kotlin coroutines and spring framework
Sunghyouk Bae
 
Kotlin Coroutines and Rx
Shaul Rosenzwieg
 
The Swift Compiler and Standard Library
Santosh Rajan
 
Ad

More from Chris Bailey (20)

PDF
NodeJS Interactive 2019: FaaS meets Frameworks
Chris Bailey
 
PDF
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
Chris Bailey
 
PDF
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
Chris Bailey
 
PDF
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
Chris Bailey
 
PDF
AltConf 2019: Server-Side Swift State of the Union
Chris Bailey
 
PDF
Server-side Swift with Swagger
Chris Bailey
 
PDF
Node Summit 2018: Cloud Native Node.js
Chris Bailey
 
PDF
Index - BFFs vs GraphQL
Chris Bailey
 
PDF
Swift Cloud Workshop - Swift Microservices
Chris Bailey
 
PDF
Swift Cloud Workshop - Codable, the key to Fullstack Swift
Chris Bailey
 
PDF
Try!Swift India 2017: All you need is Swift
Chris Bailey
 
PDF
Swift Summit 2017: Server Swift State of the Union
Chris Bailey
 
PDF
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Chris Bailey
 
PDF
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Chris Bailey
 
PDF
FrenchKit 2017: Server(less) Swift
Chris Bailey
 
PDF
AltConf 2017: Full Stack Swift in 30 Minutes
Chris Bailey
 
PDF
FrenchKit: End to End Application Development with Swift
Chris Bailey
 
PPT
Cloud Economics
Chris Bailey
 
PDF
InterConnect2016 Monitoring Nodejs
Chris Bailey
 
PDF
InterConnect2016: WebApp Architectures with Java and Node.js
Chris Bailey
 
NodeJS Interactive 2019: FaaS meets Frameworks
Chris Bailey
 
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
Chris Bailey
 
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
Chris Bailey
 
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
Chris Bailey
 
AltConf 2019: Server-Side Swift State of the Union
Chris Bailey
 
Server-side Swift with Swagger
Chris Bailey
 
Node Summit 2018: Cloud Native Node.js
Chris Bailey
 
Index - BFFs vs GraphQL
Chris Bailey
 
Swift Cloud Workshop - Swift Microservices
Chris Bailey
 
Swift Cloud Workshop - Codable, the key to Fullstack Swift
Chris Bailey
 
Try!Swift India 2017: All you need is Swift
Chris Bailey
 
Swift Summit 2017: Server Swift State of the Union
Chris Bailey
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Chris Bailey
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Chris Bailey
 
FrenchKit 2017: Server(less) Swift
Chris Bailey
 
AltConf 2017: Full Stack Swift in 30 Minutes
Chris Bailey
 
FrenchKit: End to End Application Development with Swift
Chris Bailey
 
Cloud Economics
Chris Bailey
 
InterConnect2016 Monitoring Nodejs
Chris Bailey
 
InterConnect2016: WebApp Architectures with Java and Node.js
Chris Bailey
 

Recently uploaded (20)

PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 

InterConnect: Server Side Swift for Java Developers

  • 1. InterConnect 2017 6190: Server-Side Swift: An Introduction for Java EE Developers Chris Bailey
 STSM, Technical Architect Java, Node.js and Swift at IBM Stephan Knitelius, Senior Consultant
 Faktor Zhen AG
  • 4. Swift Programming Safe | Expressive | Fast
  • 8. print("Hello, world!") > swift main.swift Swift: Hello World
  • 9. print("Hello, world!") > swift main.swift > main Swift: Hello World
  • 10. print("Hello, world!") > swift main.swift > main "Hello, world!" Swift: Hello World
  • 11. let event = ”InterConnect" print("Hello, (event)”) Swift: Hello World
  • 12. let event = ”InterConnect" print("Hello, (event)”) > swift main.swift Swift: Hello World
  • 13. let event = ”InterConnect" print("Hello, (event)”) > swift main.swift > main "Hello, InterConnect" Swift: Hello World
  • 14. let event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) Swift: Hello World
  • 15. let event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) > swift main.swift Swift: Hello World
  • 16. let event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) > swift main.swift error: cannot assign to value: 'event' is a 'let' constant Swift: Hello World
  • 17. let event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) Swift: Hello World
  • 18. let event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) Swift: Hello World
  • 19. var event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) Swift: Hello World
  • 20. var event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) > swift main.swift Swift: Hello World
  • 21. var event = "InterConnect" event = "Somewhere else" print("Hello, (event)”) > swift main.swift > main "Hello, Somewhere else" Swift: Hello World
  • 23. func addInts(a: Int, b: Int) -> Int { return a + b } Swift: Functions
  • 24. func addInts(a: Int, b: Int) -> Int { return a + b } addInts(a: 1, b: 3) Swift: Functions
  • 25. func addInts(_ a: Int, _ b: Int) -> Int { return a + b } Swift: Functions
  • 26. func addInts(_ a: Int, _ b: Int) -> Int { return a + b } addInts(1, 3) Swift: Functions
  • 27. func move(from start: Point, to end: Point) -> Bool { /* code */ } Swift: Functions
  • 28. func move(from start: Point, to end: Point) -> Bool { /* code */ } move(from: a, to: b) Swift: Functions
  • 29. func minAndMax(numbers: Int...) -> (min: Int, max: Int) { } Swift: Functions and Tuples
  • 30. func minAndMax(numbers: Int...) -> (min: Int, max: Int) { var min = numbers[0] var max = numbers[0] for number in numbers { if number > max { max = number } else if number < min { min = number } } return (min, max) } Swift: Functions and Tuples
  • 31. func minAndMax(numbers: Int...) -> (min: Int, max: Int) { var min = numbers[0] var max = numbers[0] for number in numbers { if number > max { max = number } else if number < min { min = number } } return (min, max) } let result = minAndMax(1, 2, 3, 4, 5) Swift: Functions: Varargs and Tuples
  • 32. func minAndMax(numbers: Int...) -> (min: Int, max: Int) { var min = numbers[0] var max = numbers[0] for number in numbers { if number > max { max = number } else if number < min { min = number } } return (min, max) } let result = minAndMax(1, 2, 3, 4, 5) print(result.min) print(result.max) Swift: Functions: Varargs and Tuples
  • 34. let expenseCosts = [34.4, 30.99, 250.0] var sum: Double = 0 for expense in expenseCosts { sum += expense } print("total cost is (sum)") Swift: Loops and Iterators
  • 35. let flavour = "Vanilla" switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } Swift: Switch Statements
  • 36. let flavour = "Vanilla" switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } > swiftc main.swift > main Swift: Switch Statements
  • 37. let flavour = "Vanilla" switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } > swiftc main.swift > main "No opinion about this" Swift: Switch Statements
  • 38. let flavour = "Mint Chocolate" switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } Swift: Switch Statements
  • 39. let flavour = "Mint Chocolate"
 switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } > swiftc main.swift > main Swift: Switch Statements
  • 40. let flavour = "Mint Chocolate"
 switch flavour { case "Chocolate": print("Quite nice") case "Strawberry", "Rum'n'raisin": print("Very nice") case let str where str.hasPrefix("Mint"): print("UGH!!!, I hate (str)") default: print("No opinion about this") } > swiftc main.swift > main "UGH!!!, I hate Mint Chocolate" Swift: Switch Statements
  • 41. let numbers = [1, 2, 3] numbers.map({ (number: Int) -> Int in return number * 5 }) // [5, 10, 15] numbers.map({ number in number * 5 }) numbers.map { $0 * 5 } Swift: Closures
  • 43. class Square { var area: Double = 0 init(sideLength: Double) { self.sideLength = sideLength } var sideLength: Double { get { return sqrt(area) } set { area = newValue * newValue } } } Swift: Classes
  • 44. struct Point { var x: Int var y: Int func description() -> String { return "x=(x), y=(y)" } } var coord = Point(x: 2, y: 4) var newCoord = coord coord.x = 4 print(coord.description()) // x=4, y=4 print(newCoord.description()) // x=2, y=4 Swift: Structs
  • 45. enum ApprovalStatus { case PendingOn(String) case Denied
 case Approved(String) } var status = ApprovalStatus.PendingOn("Joe Bloggs") status = .Approved("13213-4341321-2") switch status { case .PendingOn(let approver): print("Request pending on approval from (approver)") case .Denied: print("Request DENIED") case .Approved(let code): print("Request approved - auth code (code)") } Swift: Enums
  • 47. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution
  • 48. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let serialQueue = DispatchQueue(label: "serial queue")
  • 49. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let serialQueue = DispatchQueue(label: "serial queue") serialQueue.async { print("run on serial queue") } serialQueue.asyncAfter(deadline: .now() + DispatchTimeInterval.seconds(1)) { print("run on serial queue") }
  • 50. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let concurrentQueue = DispatchQueue(label: "concurrent queue", attributes: .concurrent) concurrentQueue.async { print("run on concurrent queue") }
  • 51. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let queue = DispatchQueue(label: "group queue", attributes: .concurrent) let group = DispatchGroup()
  • 52. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let queue = DispatchQueue(label: "group queue", attributes: .concurrent) let group = DispatchGroup() queue.async(group: group) { print("work 1") } queue.async(group: group) { print("work 2") }
  • 53. a queue - FIFO put task into queue to execute dequeued tasks are being executed in wai8ng Serial or Concurrent FIFO Queue Waiting Tasks Tasks Added
 To Queue Tasks Removed
 For Execution import Dispatch let queue = DispatchQueue(label: "group queue", attributes: .concurrent) let group = DispatchGroup() queue.async(group: group) { print("work 1") } queue.async(group: group) { print("work 2") } group.notify(queue: queue) { print("all work completed") }
  • 54. Swift Programming Safe | Expressive | Fast
  • 55. Swift Programming Safe | Expressive | Fast
  • 56. Swift @ IBM public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } SwiftJava
  • 57. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } SwiftJava
  • 58. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) > swiftc main.swift public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java SwiftJava
  • 59. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) > swiftc main.swift public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 60. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) > swiftc main.swift > Error line 7: Value of optional type ‘String?’ not unwrapped; > did you mean to use ‘!’ or ‘?’? public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 61. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) > swiftc main.swift > Error line 7: Value of optional type ‘String?’ not unwrapped; > did you mean to use ‘!’ or ‘?’? public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > java Test SwiftJava
  • 62. Swift @ IBM func length(of string: String) -> Void { print(string.characters.count) } var str: String? = nil length(of: str) > swiftc main.swift > Error line 7: Value of optional type ‘String?’ not unwrapped; > did you mean to use ‘!’ or ‘?’? public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > java Test Exception in thread "main" java.lang.NullPointerException at Test.length(Test.java:5) at Test.main(Test.java:11) SwiftJava
  • 63. var optionalString: String? = nil var string: String = optionalString Swift: Structs
  • 64. var optionalString: String? = nil var string: String = optionalString > swiftc main.swift Swift: Structs
  • 65. var optionalString: String? = nil var string: String = optionalString > swiftc main.swift error: value of optional type 'String?' not unwrapped; did you mean to use '!' or ‘?'? var string: String = optionalString ^ Swift: Structs
  • 66. var optionalString: String? = nil var string: String = optionalString! Swift: Structs
  • 67. var optionalString: String? = nil var string: String = optionalString! > swiftc main.swift Swift: Structs
  • 68. var optionalString: String? = nil var string: String = optionalString! > swiftc main.swift > main Swift: Structs
  • 69. var optionalString: String? = nil var string: String = optionalString! > swiftc main.swift > main fatal error: unexpectedly found nil while unwrapping an Optional value Swift: Structs
  • 70. var optionalString: String? = nil guard var string: String = optionalString else { print(‘Error! Null string found’) } Swift: Structs
  • 71. var optionalString: String? = nil guard var string: String = optionalString else { print(‘Error! Null string found’) } > swiftc main.swift Swift: Structs
  • 72. var optionalString: String? = nil guard var string: String = optionalString else { print(‘Error! Null string found’) } > swiftc main.swift > main “Error! Null string found” Swift: Structs
  • 73. Swift Programming Safe | Expressive | Fast
  • 74. func move(from start: Point, to end: Point) -> Bool { /* code */ } Swift: Functions
  • 75. func move(from start: Point, to end: Point) -> Bool { /* code */ } move(from: a, to: b) Swift: Functions
  • 76. Swift @ IBM public class Test { private static void length (String string){ System.out.println(string.length()); } public static void main(String[] args){ String string = null; length(string); } } SwiftJava
  • 77. Swift @ IBM public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } SwiftJava
  • 78. Swift @ IBM func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } SwiftJava
  • 79. Swift @ IBM func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) > swiftc main.swift public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java SwiftJava
  • 80. Swift @ IBM func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) > swiftc main.swift public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 81. Swift @ IBM func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) > swiftc main.swift > Warning: result of call to ‘length(of:)’ is unused public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 82. Swift @ IBM @discardableResult func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) > swiftc main.swift public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 83. Swift @ IBM @discardableResult func length(of string: String) -> Int { return(string.characters.count) } var str: String = ”MyString” length(of: str) > swiftc main.swift > public class Test { private static int length (String string){ return(string.length()); } public static void main(String[] args){ String string = null; length(string); } } > javac Test.java > SwiftJava
  • 84. Swift Programming Safe | Expressive | Fast
  • 90. +
  • 94. 94 1/17/17 GATEWAY PUBLIC NETWORK CLOUD NETWORK Client Devices Hosted Services ROUTING PROXY Micro-ServicesBackend For Frontend
 (BFF)
  • 96. Bluemix Mobile & Omni-Channel! BMO-6321: Patterns in Omni-Channel Cloud Application Development Containers & Microservices! BMC-2173: Introduction to Docker Containers and Microservices Visit the DevZone in the Concourse for open Hello World labs and Ask Me Anything booths! Wednesday, 11:15 AM - 12:00 PM | South Pacific C | Session ID: 6321A Tuesday, 4:45 PM - 5:30 PM | South Pacific A | Session ID: 2173A Tuesday, 11:00 AM - 12:45 PM | DevZone Ask Me Anything # 2 | Session ID: 7087A Ask Me Anything: Bluemix Cloud-Native Development Ask Me Anything: Server-Side Swift Development Wednesday, 2:30 PM - 5:00 PM | DevZone Ask Me Anything # 6 | Session ID: 7088A Node.js & LoopBack BAP-1117: Introduction to LoopBack Node.js Framework Liberty & Microservices BAP - 5081: Microservices with IBM WebSphere Liberty: What, Why and When? Wednesday, 11:15 AM - 12:00 PM | Islander F | Session ID: 1117A Tuesday, 7:00 PM - 7:20 PM | Engagement Theater Booth #319 | Session ID: 5081A
  • 97. 1/17/17 Please note IBM’s statements regarding its plans, directions, and intent 
 are subject to change or withdrawal without notice at IBM’s 
 sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver 
 any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features 
 or functionality described for our products remains at our sole discretion. Performance is based on measurements and projections 
 using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in
 the user’s job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.
  • 98. 1/17/17 Notices and disclaimers Copyright © 2017 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM. U.S. Government Users Restricted Rights — use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM. Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. This document is distributed “as is” without any warranty, either express or implied. In no event shall IBM be liable for any damage arising from the use of this information, including but not limited to, loss of data, business interruption, loss of profit or loss of opportunity. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided. IBM products are manufactured from new parts or new and used parts. 
 In some cases, a product may not be new and may have been previously installed. Regardless, our warranty terms apply.” Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice. Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented 
 as illustrations of how those customers have used IBM products and 
 the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary. References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business. Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the 
 views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation. It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions
 the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.
  • 99. 1/17/17 Notices and disclaimers continued Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third- party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM expressly disclaims all warranties, expressed or implied, including but not limited to, the implied warranties of merchantability and fitness for a particular, purpose. The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right. IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®, FileNet®, Global Business Services®,
 Global Technology Services®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli® Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.