10. INMUTABILIDAD VS MUTABILIDAD
TIPOS POR VALOR VS TIPOS POR
REFERENCIA
PROTOCOLS VS HERENCIA
DECLARATIVA VS IMPERATIVA
DINÁMICO VS ESTÁTICO
FUNCIONAL VS ORIENTADA A OBJETOS
11. MUTABILIDAD VS INMUTABILIDAD
Objective-C Swift
Mutabilidad
Casi Todo :-)
(mutableCopy)
var
Inmutabilidad
Tipos primitivos/NSArray/
NSDictionary/NSString/
NSSet/const
set
12. TIPOS POR VALOR VS POR REFERENCIA
Objective-C Swift
Por Referencia
Casi Todo (Defensive
Copying)
Clases
Por Valor Tipos primitivos
struct/enum/array/string/
tuple/dictionary
14. PROTOCOLOS VS HERENCIA
Objective-C Swift
Protocolos
Si (común: Delegation
Pattern)
Si (Lo recomendado)
Herencia Si
Si (Sólo cuando
interactúa con Cocoa)
16. DINÁMICO VS ESTÁTICO
Objective-C Swift
Dinámico Envío de mensajes
Si (aunque más parecido
a C++)
Estático Si (Hack) final/private
17. DEFINICIÓN
• Funciones que a misma entrada, misma salida
• No efectos colaterales
• Funciones son un tipo de dato
• Funciones pueden recibir y devolver otras funciones
FUNCIONAL VS OOP
22. SWIFT
CONCLUSIONES
• Swift es un lenguaje de programación híbrido, al igual que Objective-
C
• Riesgo de mezclar/no usar correctamente ningún paradigma
• No importa si es Objetive-C o Swift, lo importante es utilizar los
conceptos de inmutabilidad, no efectos colaterales, encapsulamiento
y composición.
• Swift es mas complejo que Objective-C
• La sintaxis de Swift es mas familiar y por eso gana sobre Objective-C
• Swift está incorporando elementos dinámicos (hay esperanza)
23. PRONÓSTICO
CONCLUSIONES
• Swift va a ser el siguiente Java (por uso)
• Swift va a ser el lenguaje predominante para hacer aplicaciones
para Android y iOS
• Swift también va a ser usado para creación de servicios (aunque
probablemente no el principal)
• Swift va a ser el lenguaje que se enseñe en las escuelas (para bien
o para mal)
• Esperen ver certificaciones en Swift ;-)
24. FINALES
CONCLUSIONES
“The crisis of 1995 shows that we took our existing procedural code,
observed these benefits of OOP, then carried on writing procedural
code while calling it OOP. That, unsurprisingly, isn’t working, and I
wouldn’t be surprised if people blame it on OOP with its mutable
values, side-effecting functions, and imperative code.”
Graham
25. FINALES
CONCLUSIONES
“We’ll look to the benefits some other paradigm, maybe those of
functional programming (which are, after all, the same as the
benefits of OOP), and declare how it’s the silver bullet just as Brad
Cox did. Then we’ll add procedural features to functional
programming languages, or the other way around, to reduce the
“learning curve” and make the new paradigm accessible. Then we’ll
all carry on writing C programs, calling them the new paradigm.
Then that won’t work, and we’ll declare functional programming (or
whatever comes next) as much of a failure as object-oriented
programming. As we will with whatever comes after that.”
Graham