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 WA 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
hello@salenda.es
@alberto_deavila
Salenda
¡Muchas gracias!
@alberto_deavila
¿Preguntas?

De Java a Swift pasando por Groovy

  • 1.
    Salenda De Java aSwift pasando por Groovy Codemotion ’16 Alberto De Ávila Hernández
  • 2.
    S O BR E M Í ✴ Ingeniero Informático ✴ Team Lead en Salenda ✴ Groovy y Grails dev ✴ Aprendiz de Swift @alberto_deavila
  • 3.
    S O FT WA R E D E V E L O P M E N T Desarrollos personalizados Atlassian Experts Formación y consultoría @alberto_deavila
  • 4.
    E X PE R I E N C I A P E R S O N A L @alberto_deavila Mi experiencia personal
  • 5.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S
  • 6.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 7.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 8.
    I N TR O D U C C I Ó N A G R O O V Y @alberto_deavila ¿Qué es Groovy?
  • 9.
    I N TR 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
  • 10.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 11.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 12.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 13.
    I N TR O D U C C I Ó N A S W I F T @alberto_deavila ¿Qué es Swift?
  • 14.
    I N TR 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...
  • 15.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 16.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 17.
    I N TR O D U C C I Ó N A L O S L E N G U A J E S @alberto_deavila
  • 18.
    J AVA <- > G R O O V Y < - > S W I F T @alberto_deavila Tipos de datos
  • 19.
    T I PO S D E D AT O S @alberto_deavila
  • 20.
    T I PO S D E D AT O S @alberto_deavila
  • 21.
    T I PO S D E D AT O S @alberto_deavila
  • 22.
    T I PO S D E D AT O S @alberto_deavila
  • 23.
    T I PO S D E D AT O S @alberto_deavila
  • 24.
    T I PO S D E D AT O S @alberto_deavila
  • 25.
    T I PO S D E D AT O S @alberto_deavila Quiz: Tipos de datos
  • 26.
    T I PO S D E D AT O S @alberto_deavila A. Error de compilación B. NPE C. 3 y 11 D. 0 y 11
  • 27.
    T I PO S D E D AT O S @alberto_deavila A. Error de compilación B. NPE C. 3 y 11 D. 0 y 11
  • 28.
    T I PO 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
  • 29.
    T I PO 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
  • 30.
    T I PO 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!
  • 31.
    T I PO 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!
  • 32.
    J AVA <- > G R O O V Y < - > S W I F T @alberto_deavila Operadores
  • 33.
    O P ER A D O R E S @alberto_deavila ✴ Arítmeticos ✴ Lógicos ✴ instanceof ✴ Bits ✴ Double colon (::)
  • 34.
    O P ER A D O R E S @alberto_deavila
  • 35.
    @alberto_deavila O P ER A D O R E S ✴ Groovy Truth* ✴ Elvis ✴ Spread ✴ Safe operator ✴ Sobrecarga de operadores
  • 36.
  • 37.
  • 38.
    @alberto_deavila O P ER A D O R E S ✴ Rangos ✴ Operadores de overflow ✴ Operador Nil-Coalescing ✴ Operador de comprobador de tipo
  • 39.
  • 40.
  • 41.
    O P ER A D O R E S @alberto_deavila Quiz: Operadores
  • 42.
    O P ER 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
  • 43.
    O P ER 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
  • 44.
    O P ER A D O R E S @alberto_deavila A. 6 B. 7 C. optional(6) D. optional(7)
  • 45.
    O P ER A D O R E S @alberto_deavila A. 6 B. 7 C. optional(6) D. optional(7)
  • 46.
    J AVA <- > G R O O V Y < - > S W I F T @alberto_deavila Estructuras de control
  • 47.
    M É TO D O S @alberto_deavila ✴ for / while / do-while ✴ switch / if / else ✴ return / break ✴try / catch
  • 48.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L ✴ each / times ✴ switch ✴ collect ✴ find / findAll / count
  • 49.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L
  • 50.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L
  • 51.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L
  • 52.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L ✴ for-in ✴ repeat-while ✴ switch ✴ guard
  • 53.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L
  • 54.
    @alberto_deavila E S TR U C T U R A S D E C O N T R O L
  • 55.
    E S TR U C T U R A S D E C O N T R O L @alberto_deavila Quiz: Estructuras de control
  • 56.
    @alberto_deavila E S TR 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
  • 57.
    @alberto_deavila E S TR 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
  • 58.
    J AVA <- > G R O O V Y < - > S W I F T @alberto_deavila Métodos
  • 59.
    M É TO D O S @alberto_deavila ✴ Public / Protected / Private ✴ void / return ✴ Permite sobrecarga
  • 60.
    @alberto_deavila M É TO D O S ✴ Parámetros por defecto ✴ Múltiples retornos ✴ Return no obligatorio ✴ Sobrecarga ✴ Closures
  • 61.
  • 62.
  • 63.
    @alberto_deavila M É TO D O S ✴ Parámetros por defecto ✴ Múltiples retornos* ✴ Argumentos etiquetados ✴ Argumentos especiales
  • 64.
  • 65.
  • 66.
  • 67.
    M É TO D O S @alberto_deavila Quiz: Métodos
  • 68.
    @alberto_deavila M É TO D O S A. No compila B. No a String: y: 2016 C. y: 2016 D. -->y: 2016
  • 69.
    @alberto_deavila M É TO D O S A. No compila B. No a String: y: 2016 C. y: 2016 D. -->y: 2016
  • 70.
    @alberto_deavila M É TO D O S A. No compila B. 10 C. 100 D. 200
  • 71.
    @alberto_deavila M É TO D O S A. No compila B. 10 C. 100 D. 200
  • 72.
    J AVA <- > G R O O V Y < - > S W I F T @alberto_deavila Clases
  • 73.
    @alberto_deavila C L AS E S ✴ Constructores ✴ Getters ✴ Setters ✴ Otros métodos particulares
  • 74.
    @alberto_deavila C L AS E S ✴ Constructores por defecto ✴ Getters y Setters solo para sobreescritura
  • 75.
  • 76.
    @alberto_deavila C L AS E S ✴ Clases y Estructuras ✴ Almacenan valores ✴ Constructores ✴ Métodos
  • 77.
  • 78.
  • 79.
    @alberto_deavila C L AS E S ✴ Capacidades solo en Clases ✴ Herencia ✴ Destructores ✴ Multiples referencias a una instancia
  • 80.
    C L AS E S @alberto_deavila Quiz: Clases
  • 81.
    @alberto_deavila C L AS E S A. No compila B. alberto de avila C. albertodeavila D. alberto deavila
  • 82.
    @alberto_deavila C L AS E S A. No compila B. alberto de avila C. albertodeavila D. alberto deavila
  • 83.
    @alberto_deavila C L AS E S A. No compila B. Error runtime C. 1 D. 2
  • 84.
    @alberto_deavila C L AS E S A. No compila B. Error runtime C. 1 D. 2
  • 85.
    C O NC L U S I O N E S @alberto_deavila Conclusiones
  • 86.
    B U SC A M O S C O M PA Ñ E R O S Buscamos nuevos compañeros Groovy / iOS + Android / Devops hello@salenda.es @alberto_deavila
  • 87.