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
77
Functional Programming in Swift
IOSdevelopersMx
March 10, 2016
Tweet
Share
More Decks by IOSdevelopersMx
See All by IOSdevelopersMx
Functional programming vol 2
iosdevelopersmx
0
72
Construyendo vistas 100% por código VS usando AutoLayout
iosdevelopersmx
0
18
GraphQL como una nueva forma revolucionaria de pensar en las APIs!
iosdevelopersmx
0
21
Clean Architecture in IOS
iosdevelopersmx
1
87
Xamaring Bindings
iosdevelopersmx
0
43
StackViews
iosdevelopersmx
1
49
StoryboardReferences
iosdevelopersmx
0
53
Ibeacons Parte 1
iosdevelopersmx
0
48
Other Decks in Technology
See All in Technology
データ分析エージェント Socrates の育て方
na0
8
2.7k
品質視点から考える組織デザイン/Organizational Design from Quality
mii3king
0
210
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
130
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
10
75k
複数サービスを支えるマルチテナント型Batch MLプラットフォーム
lycorptech_jp
PRO
1
970
まずはマネコンでちゃちゃっと作ってから、それをCDKにしてみよか。
yamada_r
2
120
Generative AI Japan 第一回生成AI実践研究会「AI駆動開発の現在地──ブレイクスルーの鍵を握るのはデータ領域」
shisyu_gaku
0
330
「何となくテストする」を卒業するためにプロダクトが動く仕組みを理解しよう
kawabeaver
0
440
使いやすいプラットフォームの作り方 ー LINEヤフーのKubernetes基盤に学ぶ理論と実践
lycorptech_jp
PRO
1
160
slog.Handlerのよくある実装ミス
sakiengineer
4
480
20250913_JAWS_sysad_kobe
takuyay0ne
2
250
Create Ruby native extension gem with Go
sue445
0
130
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Unsuck your backbone
ammeep
671
58k
Making the Leap to Tech Lead
cromwellryan
135
9.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
We Have a Design System, Now What?
morganepeng
53
7.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
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/