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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
IOSdevelopersMx
March 10, 2016
Technology
0
81
Functional Programming in Swift
IOSdevelopersMx
March 10, 2016
Tweet
Share
More Decks by IOSdevelopersMx
See All by IOSdevelopersMx
Functional programming vol 2
iosdevelopersmx
0
77
Construyendo vistas 100% por código VS usando AutoLayout
iosdevelopersmx
0
22
GraphQL como una nueva forma revolucionaria de pensar en las APIs!
iosdevelopersmx
0
22
Clean Architecture in IOS
iosdevelopersmx
1
89
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
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
4.7k
20260204_Midosuji_Tech
takuyay0ne
0
110
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
入社1ヶ月でデータパイプライン講座を作った話
waiwai2111
1
250
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
2
200
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
100
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
0
320
変化するコーディングエージェントとの現実的な付き合い方 〜Cursor安定択説と、ツールに依存しない「資産」〜
empitsu
4
1.3k
ZOZOにおけるAI活用の現在 ~開発組織全体での取り組みと試行錯誤~
zozotech
PRO
5
4.8k
Introduction to Bill One Development Engineer
sansan33
PRO
0
360
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
210
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
240
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.6k
Everyday Curiosity
cassininazir
0
130
The SEO Collaboration Effect
kristinabergwall1
0
350
The SEO identity crisis: Don't let AI make you average
varn
0
64
So, you think you're a good person
axbom
PRO
2
1.9k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
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/