Salenda
De Java a Swift pasando por Groovy
Codemotion ’16
Alberto De Ávila Hernández
S O B R E M Í
✴ Ingeniero Informático
✴ Team Lead en Salenda
✴ Groovy y Grails dev
✴ Aprendiz de Swift
@alberto_deavila
S O F T W A R E D E V E L O P M E N T
Desarrollos personalizados
Atlassian Experts
Formación y consultoría
@alberto_deavila
E X P E R I E N C I A P E R S O N A L
@alberto_deavila
Mi experiencia personal
I N T R O D U C C I Ó N A L O S L E N G U A J E S
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A G R O O V Y
@alberto_deavila
¿Qué es Groovy?
I N T R O D U C C I Ó N A G R O O V Y
@alberto_deavila
✴ Lenguaje ejecutado sobre JVM
✴ Fácil para desarrolladores Java
✴ Lenguaje dinámico y/o estático
✴ Más legible
✴ Scripting y Android
✴ Apps: Grails, Griffon, Grain y Plugins
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A S W I F T
@alberto_deavila
¿Qué es Swift?
I N T R O D U C C I Ó N A S W I F T
@alberto_deavila
✴ Lenguaje de desarrollo para iOS
✴ Sustituto de Objetive-C
✴ Lenguaje estático
✴ Expresivo, rápido y potente
✴ Frameworks web con Swift: Perfect, Vapor, IBM Kitura...
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
I N T R O D U C C I Ó N A L O S L E N G U A J E S
@alberto_deavila
J AVA < - > G R O O V Y < - > S W I F T
@alberto_deavila
Tipos de datos
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
T I P O S D E D AT O S
@alberto_deavila
Quiz:
Tipos de datos
T I P O S D E D AT O S
@alberto_deavila
A. Error de compilación B. NPE
C. 3 y 11 D. 0 y 11
T I P O S D E D AT O S
@alberto_deavila
A. Error de compilación B. NPE
C. 3 y 11 D. 0 y 11
T I P O S D E D AT O S
@alberto_deavila
A.3 2 true null B.3 2 MethodNotFound null
C.3 2 true MethodNotFound D.3 MethodNotFound(x2) null
T I P O S D E D AT O S
@alberto_deavila
A.3 2 true null B.3 2 MethodNotFound null
C.3 2 true MethodNotFound D.3 MethodNotFound(x2) null
T I P O S D E D AT O S
@alberto_deavila
A.Codemotion ’16 3.3 Hola! B.No compila
C.Codemotion ’16 3.3 D.Codemotion 3.3 Hola!
T I P O S D E D AT O S
@alberto_deavila
A.Codemotion ’16 3.3 Hola! B.No compila
C.Codemotion ’16 3.3 D.Codemotion 3.3 Hola!
J AVA < - > G R O O V Y < - > S W I F T
@alberto_deavila
Operadores
O P E R A D O R E S
@alberto_deavila
✴ Arítmeticos
✴ Lógicos
✴ instanceof
✴ Bits
✴ Double colon (::)
O P E R A D O R E S
@alberto_deavila
@alberto_deavila
O P E R A D O R E S
✴ Groovy Truth*
✴ Elvis
✴ Spread
✴ Safe operator
✴ Sobrecarga de operadores
@alberto_deavila
O P E R A D O R E S
@alberto_deavila
O P E R A D O R E S
@alberto_deavila
O P E R A D O R E S
✴ Rangos
✴ Operadores de overflow
✴ Operador Nil-Coalescing
✴ Operador de comprobador de tipo
@alberto_deavila
O P E R A D O R E S
@alberto_deavila
O P E R A D O R E S
O P E R A D O R E S
@alberto_deavila
Quiz:
Operadores
O P E R A D O R E S
@alberto_deavila
A. true false false B. false false false
C. Produce una excepción D. true true false
O P E R A D O R E S
@alberto_deavila
A. true false false B. false false false
C. Produce una excepción D. true true false
O P E R A D O R E S
@alberto_deavila
A. 6 B. 7 C. optional(6) D. optional(7)
O P E R A D O R E S
@alberto_deavila
A. 6 B. 7 C. optional(6) D. optional(7)
J AVA < - > G R O O V Y < - > S W I F T
@alberto_deavila
Estructuras de control
M É T O D O S
@alberto_deavila
✴ for / while / do-while
✴ switch / if / else
✴ return / break
✴try / catch
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
✴ each / times
✴ switch
✴ collect
✴ find / findAll / count
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
✴ for-in
✴ repeat-while
✴ switch
✴ guard
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
E S T R U C T U R A S D E C O N T R O L
@alberto_deavila
Quiz:
Estructuras de control
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
A. 1 B. 2 C. 3 D. No compila
@alberto_deavila
E S T R U C T U R A S D E C O N T R O L
A. 1 B. 2 C. 3 D. No compila
J AVA < - > G R O O V Y < - > S W I F T
@alberto_deavila
Métodos
M É T O D O S
@alberto_deavila
✴ Public / Protected / Private
✴ void / return
✴ Permite sobrecarga
@alberto_deavila
M É T O D O S
✴ Parámetros por defecto
✴ Múltiples retornos
✴ Return no obligatorio
✴ Sobrecarga
✴ Closures
@alberto_deavila
M É T O D O S
@alberto_deavila
M É T O D O S
@alberto_deavila
M É T O D O S
✴ Parámetros por defecto
✴ Múltiples retornos*
✴ Argumentos etiquetados
✴ Argumentos especiales
@alberto_deavila
M É T O D O S
@alberto_deavila
M É T O D O S
@alberto_deavila
M É T O D O S
M É T O D O S
@alberto_deavila
Quiz:
Métodos
@alberto_deavila
M É T O D O S
A. No compila B. No a String: y: 2016
C. y: 2016 D. -->y: 2016
@alberto_deavila
M É T O D O S
A. No compila B. No a String: y: 2016
C. y: 2016 D. -->y: 2016
@alberto_deavila
M É T O D O S
A. No compila B. 10 C. 100 D. 200
@alberto_deavila
M É T O D O S
A. No compila B. 10 C. 100 D. 200
J AVA < - > G R O O V Y < - > S W I F T
@alberto_deavila
Clases
@alberto_deavila
C L A S E S
✴ Constructores
✴ Getters
✴ Setters
✴ Otros métodos particulares
@alberto_deavila
C L A S E S
✴ Constructores por defecto
✴ Getters y Setters solo para sobreescritura
@alberto_deavila
C L A S E S
@alberto_deavila
C L A S E S
✴ Clases y Estructuras
✴ Almacenan valores
✴ Constructores
✴ Métodos
@alberto_deavila
C L A S E S
@alberto_deavila
C L A S E S
@alberto_deavila
C L A S E S
✴ Capacidades solo en Clases
✴ Herencia
✴ Destructores
✴ Multiples referencias a una instancia
C L A S E S
@alberto_deavila
Quiz:
Clases
@alberto_deavila
C L A S E S
A. No compila B. alberto de avila
C. albertodeavila D. alberto deavila
@alberto_deavila
C L A S E S
A. No compila B. alberto de avila
C. albertodeavila D. alberto deavila
@alberto_deavila
C L A S E S
A. No compila B. Error runtime C. 1 D. 2
@alberto_deavila
C L A S E S
A. No compila B. Error runtime C. 1 D. 2
C O N C L U S I O N E S
@alberto_deavila
Conclusiones
B U S C A M O S C O M PA Ñ E R O S
Buscamos nuevos compañeros
Groovy / iOS + Android / Devops
[email protected]
@alberto_deavila
Salenda¡Muchas gracias!
@alberto_deavila
¿Preguntas?