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
Swift coding Strategy
Search
Takaaki Tanaka
April 17, 2017
Technology
0
1.6k
Swift coding Strategy
AKIBA.swift 1周年記念での発表スライドです
テックな内容は皆無です
https://classmethod.connpass.com/event/53603/
Takaaki Tanaka
April 17, 2017
Tweet
Share
More Decks by Takaaki Tanaka
See All by Takaaki Tanaka
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
620
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
590
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
490
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
540
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.5k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
210
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
0
1.3k
CPUブーストの話
kongmingstrap
0
53
私のAWS愛を聞け! ~ここが好きだよStep Functions~ #devio2022
kongmingstrap
0
1.1k
Other Decks in Technology
See All in Technology
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
890
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
180
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
230
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
430
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
180
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Building Adaptive Systems
keathley
38
2.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Facilitating Awesome Meetings
lara
50
6.1k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
The Invisible Side of Design
smashingmag
298
50k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Transcript
2017/04/17 Swift coding Strategy AKIBA.swift Ұपه೦ษڧձ
About Me
• ాத ໌ (Takaaki Tanaka) • Ϋϥεϝιουגࣜձࣾ • ϞόΠϧόοΫΤϯυ •
@kongmingtrap • Swift / Objective-C / Scala / JavaScript … • GyazSquare / GitHub
˞ࣄͰ͢
None
ؓٳ
Strategy
Strategy Pattern
Strategy Pattern // MARK: - Interface public protocol TodoRepository {
func get(_ handler: @escaping (Result<[TodoEntity]>) -> Void) } // MARK: - Implementation final class TodoRepositoryImpl: TodoRepository { private let dataStore: TodoDataStore public init(dataStore: TodoDataStore) { self.dataStore = dataStore } func get(_ handler: @escaping (Result<[TodoEntity]>) -> Void) { dataStore.get(with: ["filter": "all"]).onSuccess { entities in let result = Result<[TodoEntity]>.success(entities) handler(result) }.onFailure { error in let result = Result<[TodoEntity]>.failure(error) handler(result) } } }
Strategy Pattern typealias TodoListComplitionHandler = ([TodoModel]?) -> Void // MARK:
- Interface protocol TodoListUseCase { func fetchTodos(_ complite: TodoListComplitionHandler?) } // MARK: - Implementation struct TodoListUseCaseImpl: TodoListUseCase { private let todoRepository: TodoRepository public init(todoRepository: TodoRepository) { self.todoRepository = todoRepository } public func fetchTodos(_ compliton: TodoListComplitionHandler?) { todoRepository.get { result in switch result { case .success(let value): let todoModels = try! TodoTranslator().translate(value) compliton?(todoModels) case .failure(let error): print(error) compliton?(nil) } } } }
Strategy Pattern 4USBUFHZ1BUUFSOΞϧΰϦζϜͷηοτΛఆ ٛ͢Δํ๏Λఏڙ͠ɺ͜ΕΒΛަՄೳʹ͢Δ ͜ͱΛతͱ͍ͯ͠Δɻ4USBUFHZ1BUUFSOΑΓɺ ΞϧΰϦζϜΛ༻ऀ͔Βಠཱͨ͠··༷ʑʹ มԽͤ͞Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔɻ
Strategy Pattern 4USBUFHZ1BUUFSOΞϧΰϦζϜͷηοτΛఆ ٛ͢Δํ๏Λఏڙ͠ɺ͜ΕΒΛަՄೳʹ͢Δ ͜ͱΛతͱ͍ͯ͠Δɻ4USBUFHZ1BUUFSOΑΓɺ ΞϧΰϦζϜΛ༻ऀ͔Βಠཱͨ͠··༷ʑʹ มԽͤ͞Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔɻ
Strategy of AKIBA.swift
Strategy ઓུʢͤΜΓΌ͘ɺӳ4USBUFHZʣɺҰൠతʹಛఆͷඪ Λୡ͢ΔͨΊʹɺظతࢹͱෳ߹ࢥߟͰྗࢿݯΛ૯߹త ʹӡ༻͢Δٕज़ɾՊֶͰ͋Δɻ
Strategy IUUQXXXJUNFEJBDPKQCJ[JEBSUJDMFT OFXTIUNM
Strategy w όουϊϋͳͲɺΫϥεϝιου͚ͩͰ ڞ༗Ͱ͖ͳ͍ใΛΛ௨ͯ͡ڞ༗Ͱ͖ΔΑ ͏ʹ͢Δ w ༗໊ਓͷํͱͭͳ͕ͬͯɺࠔͬͨͱ͖ʹฉ͚ ΔΑ͏ʹ͢Δ w Ϋϥεϝιου͔ΒελʔϓϨΠϠʔΛഐग़
͢Δ
Tactics w ִ݄ͰษڧձΛ։࠵͢Δ w ։࠵ϒϩάΛॻ͘ w ήετεϐʔΧʔΛট͘ w ॴΛఏڙ͢Δ w
ຖճςʔϚʹԊͬͯืूΛ͔͚Δ
USZ4XJGUৼΓฦΓษڧձ Ր 4XJGUͱ0CKFDUJWF$ͱͷจ๏ൺֱ Ր
88%$ใڞ༗ձ ۚ 4XJGU-5େձʂ Ր εϖγϟϧίϥϘʂʂ ݄ ϑϦʔτʔʔΫʂʂ Ր GBTUMBOFϋϯζΦϯ Ր ϑϦʔτʔʔΫʂʂ Ր લʹࠂ͢ΔษڧձɺͦΕ͕",*#"TXJGU Ր ϑϦʔτʔʔΫʂʂ Ր ,ZPCBTIJTXJGUY",*#"TXJGU߹ಉษڧձ ਫ ",*#"TXJGUº4XJGUѪձWPM ݄ ",*#"TXJGUҰपه೦ษڧձʂ ݄ ։࠵ཤྺ
USZ4XJGUৼΓฦΓษڧձ Ր 4XJGUͱ0CKFDUJWF$ͱͷจ๏ൺֱ Ր
88%$ใڞ༗ձ ۚ 4XJGU-5େձʂ Ր εϖγϟϧίϥϘʂʂ ݄ ϑϦʔτʔʔΫʂʂ Ր GBTUMBOFϋϯζΦϯ Ր ϑϦʔτʔʔΫʂʂ Ր લʹࠂ͢ΔษڧձɺͦΕ͕",*#"TXJGU Ր ϑϦʔτʔʔΫʂʂ Ր ,ZPCBTIJTXJGUY",*#"TXJGU߹ಉษڧձ ਫ ",*#"TXJGUº4XJGUѪձWPM ݄ ",*#"TXJGUҰपه೦ษڧձʂ ݄ ։࠵ཤྺ
USZ4XJGUৼΓฦΓษڧձ Ր 4XJGUͱ0CKFDUJWF$ͱͷจ๏ൺֱ Ր
88%$ใڞ༗ձ ۚ 4XJGU-5େձʂ Ր εϖγϟϧίϥϘʂʂ ݄ ϑϦʔτʔʔΫʂʂ Ր GBTUMBOFϋϯζΦϯ Ր ϑϦʔτʔʔΫʂʂ Ր લʹࠂ͢ΔษڧձɺͦΕ͕",*#"TXJGU Ր ϑϦʔτʔʔΫʂʂ Ր ,ZPCBTIJTXJGUY",*#"TXJGU߹ಉษڧձ ਫ ",*#"TXJGUº4XJGUѪձWPM ݄ ",*#"TXJGUҰपه೦ษڧձʂ ݄ ςʔϚ͕ܾ·Βͳ͔ͬͨճ
USZ4XJGUৼΓฦΓษڧձ Ր 4XJGUͱ0CKFDUJWF$ͱͷจ๏ൺֱ Ր
88%$ใڞ༗ձ ۚ 4XJGU-5େձʂ Ր εϖγϟϧίϥϘʂʂ ݄ ϑϦʔτʔʔΫʂʂ Ր GBTUMBOFϋϯζΦϯ Ր ϑϦʔτʔʔΫʂʂ Ր લʹࠂ͢ΔษڧձɺͦΕ͕",*#"TXJGU Ր ϑϦʔτʔʔΫʂʂ Ր ,ZPCBTIJTXJGUY",*#"TXJGU߹ಉษڧձ ਫ ",*#"TXJGUº4XJGUѪձWPM ݄ ",*#"TXJGUҰपه೦ษڧձʂ ݄ ϗʔϜͰ։࠵͠ͳ͔ͬͨճɹ#AKIBA #ͱ
USZ4XJGUৼΓฦΓษڧձ Ր 4XJGUͱ0CKFDUJWF$ͱͷจ๏ൺֱ Ր
88%$ใڞ༗ձ ۚ 4XJGU-5େձʂ Ր εϖγϟϧίϥϘʂʂ ݄ ϑϦʔτʔʔΫʂʂ Ր GBTUMBOFϋϯζΦϯ Ր ϑϦʔτʔʔΫʂʂ Ր લʹࠂ͢ΔษڧձɺͦΕ͕",*#"TXJGU Ր ϑϦʔτʔʔΫʂʂ Ր ,ZPCBTIJTXJGUY",*#"TXJGU߹ಉษڧձ ਫ ",*#"TXJGUº4XJGUѪձWPM ݄ ",*#"TXJGUҰपه೦ษڧձʂ ݄ ͦͦษڧձ͡Όແ͍
Tactics w ִ݄ͰษڧձΛ։࠵͢Δ w ։࠵ϒϩάΛॻ͘ w ήετεϐʔΧʔΛট͘ w ॴΛఏڙ͢Δ w
ຖճςʔϚʹԊͬͯืूΛ͔͚Δ
ͦΕඞউͷज़ɺ ߹มͷܗػʹ͋Γɻ
w ઓུΑΓઓज़ w ༏लͳޙํࢧԉʹΑͬͯࢧ͑ΒΕ͖ͯ ·ͨ͠ w ϒϩάඞͣ࣍ͷ·Ͱʹॻ͘ Recap
ΑΖ͓͘͠Ͷ͕͍͠·͢
0OFNPSFUIJOHʜ
IUUQEFWDMBTTNFUIPEKQOFXTNPCJMFUFBNJOPTBLBWPM
w ݄ w #6,630TXJGUY",*#"TXJGU w DPNJOHTPPOʜ
͓ΘΓ