Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Functional Programming in Swift
Search
IOSdevelopersMx
March 10, 2016
Technology
0
78
Functional Programming in Swift
IOSdevelopersMx
March 10, 2016
Tweet
Share
More Decks by IOSdevelopersMx
See All by IOSdevelopersMx
Functional programming vol 2
iosdevelopersmx
0
73
Construyendo vistas 100% por código VS usando AutoLayout
iosdevelopersmx
0
19
GraphQL como una nueva forma revolucionaria de pensar en las APIs!
iosdevelopersmx
0
22
Clean Architecture in IOS
iosdevelopersmx
1
88
Xamaring Bindings
iosdevelopersmx
0
44
StackViews
iosdevelopersmx
1
50
StoryboardReferences
iosdevelopersmx
0
54
Ibeacons Parte 1
iosdevelopersmx
0
50
Other Decks in Technology
See All in Technology
AIエージェントによる業務効率化への飽くなき挑戦-AWS上の実開発事例から学んだ効果、現実そしてギャップ-
nasuvitz
1
320
初めてのDatabricks Apps開発
taka_aki
1
270
CNCFの視点で捉えるPlatform Engineering - 最新動向と展望 / Platform Engineering from the CNCF Perspective
hhiroshell
0
140
AI AgentをLangflowでサクッと作って、1日働かせてみた!
yano13
1
150
Observability for the system understanding and curious by developers
maruloop
1
490
[VPoE Global Summit] サービスレベル目標による信頼性への投資最適化
satos
0
230
What's new in OpenShift 4.20
redhatlivestreaming
0
160
ヘンリー会社紹介資料(エンジニア向け) / company deck for engineer
henryofficial
0
340
頭部ふわふわ浄酔器
uyupun
0
110
アウトプットから始めるOSSコントリビューション 〜eslint-plugin-vueの場合〜 #vuefes
bengo4com
3
1.6k
コンパウンド組織のCRE #cre_meetup
layerx
PRO
1
250
AIプロダクトのプロンプト実践テクニック / Practical Techniques for AI Product Prompts
saka2jp
0
100
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
27
2.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Become a Pro
speakerdeck
PRO
29
5.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Mobile First: as difficult as doing things right
swwweet
225
10k
Git: the NoSQL Database
bkeepers
PRO
431
66k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
The Pragmatic Product Professional
lauravandoore
36
7k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Transcript
SWIFT PROGRAMACIÓN FUNCIONAL
— Un programador ¡OBJETIVE-C ESTÁ MUERTO! ” “
— El mismo programador ¡LARGA VIDA A SWIFT! ” “
— Otro programador LA PROGRAMACIÓN ORIENTADA A OBJETOS FUE UN
ERROR. ” “
— El mismo programador LA PROGRAMACIÓN FUNCIONAL ES MEJOR QUE
LA ORIENTADA A OBJETOS. ” “
— Apple ¡LA PROGRAMACIÓN ORIENTADA A PROTOCOLOS VA A CAMBIAR
TODO!. ” “
— Apple YA NO USEN CLASES, HERENCIA Y VALORES POR
REFERENCIAS ” “
¡ALTO!
¿QUÉ ES PROGRAMACIÓN FUNCIONAL?
¿QUÉ ES PROGRAMACIÓN ORIENTADA A OBJETOS?
¿QUÉ ES LO QUE REALMENTE IMPORTA?
CONTROLAR LA COMPLEJIDAD
¿CÓMO?
ENCAPSULAMIENTO AISLAMIENTO NO EFECTOS SECUNDARIOS ENTRADAS Y SALIDAS CONCEPTOS RELACIONADOS
UNIDAD DE PROCESAMIENTO 1 UNIDAD DE PROCESAMIENTO 2 UNIDAD DE
PROCESAMIENTO 3 ENTRADA SALIDA
GENERALES PROPIEDADES • Misma entrada, misma salida • No efectos
colaterales • Semánticamente no hay pase por referencia
¿POR QUÉ ES IMPORTANTE ESTO?
SI HAY EFECTOS COLATERALES EL CÓDIGO ES MAS DIFÍCIL DE
ENTENDER Y DE PROBAR
SI LAS FUNCIONES NO DEVUELVEN ALGO (SENTENCIAS), ES POR QUE
PRODUCEN EFECTOS COLATERALES (CAMBIAN ALGO EXTERNO O ESTADO INTERNO)
CARACTERÍSTICAS FUNCIONES EN SWIFT • Funciones son un tipo de
dato (First class) • Funciones de grado superior (funciones pueden recibir y devolver otras funciones)
VEAMOS ALGO DE CÓDIGO
RESUMEN DE OPCIONES Pase por Referencia Pase por Valor Mutable
Swift Objetive-C Swift Objetive-C Inmutable Erlang Elixir Swift
None
¿? ¿? ¿? ENTRADA SALIDA ¿QUÉ SON LOS CUADROS?
OBJETO 1 OBJETO 2 OBJETO 3 ENTRADA SALIDA ¿QUÉ SON
LOS CUADROS?
FUNCIÓN 1 FUNCIÓN 2 FUNCIÓN 3 ENTRADA SALIDA ¿QUÉ SON
LOS CUADROS?
None
None
RETOS FUNCIONAL • Imperativo vs Declarativo • Recursión vs Ciclos
TÉCNICAS OBJECTIVE-C • Implicit sharing • Inheritance - Delegation •
Reference semantics • Immutability • Value Semantics • Defensive copying
SWIFT CONCLUSIONES • Swift es un lenguaje de programación híbrido
• Riesgo de mezclar/no usar correctamente ningún paradigma • OOP nunca ha tenido nada que ver con clases, herencia y mutabilidad
GENERALES CONCLUSIONES • Thread Safety • Reusability • Testability (Easier,
Faster, No dependencies, Concurrents) • Understandability • Maintainability • Composition
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/