Upload
software-guru
View
295
Download
0
Embed Size (px)
Citation preview
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
MUTABILIDAD VS INMUTABILIDAD
Objective-C Swift
Mutabilidad Casi Todo :-) (mutableCopy) var
InmutabilidadTipos primitivos/NSArray/NSDictionary/NSString/
NSSet/constset
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
Pase por Referencia
Pase por Valor
Mutable Peligro Seguro
Inmutable Seguro NA
TIPOS POR VALOR VS POR REFERENCIACONCURRENCIA
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)
DECLARATIVA VS IMPERATIVA
Objective-C Swift
DeclarativaEs común en colecciones (filteredArrayUsingPredic
ate)Si
Imperativa Si Si
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
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
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)
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 ;-)
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
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
LINKS
REFERENCIAS
• http://www.sicpers.info/2015/05/object-oriented-programming-in-objective-c/Reusability
• https://www.destroyallsoftware.com/talks/boundaries
• https://developer.apple.com/videos/play/wwdc2015/226/
• https://developer.apple.com/videos/play/wwdc2015/414/
• https://developer.apple.com/videos/play/wwdc2015/408/