Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Functional Programming in Swift
Search
IOSdevelopersMx
March 10, 2016
Technology
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Functional Programming in Swift
IOSdevelopersMx
March 10, 2016
Transcript
33 slides
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/
More Decks by IOSdevelopersMx
See All by IOSdevelopersMx
Functional programming vol 2
iosdevelopersmx
0
90
Construyendo vistas 100% por código VS usando AutoLayout
iosdevelopersmx
0
36
GraphQL como una nueva forma revolucionaria de pensar en las APIs!
iosdevelopersmx
0
39
Clean Architecture in IOS
iosdevelopersmx
1
110
Xamaring Bindings
iosdevelopersmx
0
58
StackViews
iosdevelopersmx
1
59
StoryboardReferences
iosdevelopersmx
0
63
Ibeacons Parte 1
iosdevelopersmx
0
61
Other Decks in Technology
See All in Technology
アラートを見直していたら営業組織への理解にちょっとだけ繋がった話
z63d
1
210
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
120
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
230
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
1.1k
gem install とrequire のむこうがわ
ydah
0
150
BALLAS Technology Deck
ballas_inc
0
820
人の努力に頼らないセキュリティをエンジニアリングする在り方 / An approach to engineering security that does not rely on human effort
carta_engineering
0
200
20261113_JAWS_Osaka
takuyay0ne
1
570
_マネジメントする人される人ナイト_2026__良いチームを作っていきたい_お気持ち_.pdf
xkxaxkx
0
770
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
7
5.7k
Quick Automate | 目指せ Quick マスター 12
inariku
PRO
1
130
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
130
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
300
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Done Done
chrislema
187
17k
Odyssey Design
rkendrick25
PRO
3
950
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
330
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
60k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
320
Building an army of robots
kneath
307
47k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
The Curious Case for Waylosing
cassininazir
1
610