Slide 1

Slide 1 text

࠷దͳઃܭͰ ΞϓϦΛ࡞Δ ాத ୡ໵ (@tattn)

Slide 2

Slide 2 text

• Yahoo!৐׵Ҋ಺ • iOSΞϓϦΤϯδχΞ • 2016೥৽ଔ • Github: @tattn • Qiita: @tattn • Twitter: @tanakasan2525 ాத ୡ໵

Slide 3

Slide 3 text

try! Swift ʹࢀՃ͠·͔ͨ͠ʁ

Slide 4

Slide 4 text

try! Swift ʹߦ͖ͬͯ·ͨ͠ Yahoo! JAPAN Tech Blog https://techblog.yahoo.co.jp/ try! Swift Tokyo 2017 ʹڠࢍ͠·ͨ͠ https://techblog.yahoo.co.jp/ios/try_swift_2017/ try! Swift Tokyo 2017 ͷϋοΧιϯʹࢀՃ͠·ͨ͠ https://techblog.yahoo.co.jp/ios/try_swift_2017_hack/

Slide 5

Slide 5 text

࣭໰

Slide 6

Slide 6 text

࣭໰ օ͞Μ͸ͲͷΑ͏ͳΞʔΩςΫνϟͰ
 ΞϓϦΛ࡞͍ͬͯ·͔͢ʁ • MVC • MVP • MVVM • Flux • VIPER • Clean Architecture

Slide 7

Slide 7 text

࣭໰ ͲͷΑ͏ͳج४Ͱ
 ͦͷΞʔΩςΫνϟΛબͼ·͔ͨ͠ʁ

Slide 8

Slide 8 text

΋͠΋ɺͦͷΞʔΩςΫνϟΛ • ࿩୊ʹͳ͔ͬͯͨΒ • ͳΜ͔ੌͦ͏͔ͩΒ ͷΑ͏ͳཧ༝ͰબΜͰ͍Δ/બ΅͏ͱ͍ͯ͠Δ৔߹͸
 
 ͥͻվΊͯߟ͑ͯΈ·͠ΐ͏ (ᐆດͳཧ༝)

Slide 9

Slide 9 text

try! Swift 2017 - 1೔໨

Slide 10

Slide 10 text

σʔλϨΠϠΛ෼཭͢Δ Minimum
 Viable
 Architecture https://www.slideshare.net/RandyShoup/minimum-viable- architecture-good-enough-is-good-enough-in-a-startup Minimum Viable Architecture 
 -- Good Enough is Good Enough in a Startup http://www.kavistechnology.com/blog/minimal-viable-architecture/ “ඞཁ࠷খݶΞʔΩςΫνϟ”

Slide 11

Slide 11 text

“What we need is a balance of speed to market and architecture. What we need is a Minimal Viable Architecture (MVA).” — Randy Shoup ࢲ͕ͨͪඞཁͱ͍ͯ͠Δͷ͸ • ࢢ৔౤ೖͷεϐʔυͱΞʔΩςΫνϟͷόϥϯεͩɻ • ඞཁ࠷খݶͷΞʔΩςΫνϟͩɻ ελʔτΞοϓͰͳ͘ͱ΋ಉ͜͡ͱ͕ݴ͑Δ͸ͣ

Slide 12

Slide 12 text

ྫ͑͹ɺ
 ҋӢʹ Clean Architecture Λಋೖ͢Δ

Slide 13

Slide 13 text

protocol FeedRepositoryOutput: class { func receive(feeds: [Feed]) } class FeedRepository: FeedDataStoreOutput { private let dataStore: FeedDataStore weak var output: FeedRepositoryOutput? init(dataStore: FeedDataStore, output: FeedRepositoryOutput?) { … } func getFeeds() { dataStore.getFeeds() } } extension FeedRepository: FeedDataStoreOutput { func receive(feeds: [Feed]) { output?.receive(feeds: feeds) } } Repository patternͷྫ

Slide 14

Slide 14 text

΋͠΋Clean ArchitectureΛ
 ಋೖ͍ͯ͠ͳ͔ͬͨΒ…

Slide 15

Slide 15 text

Clean ArchitectureΛಋೖ͍ͯ͠ͳ͚Ε͹ Swift × I/F = Protocol protocol FeedRepository { var output: FeedRepositoryOutput? { get set } func getFeeds() } extension FeedDataStore: FeedRepository { … } ※ͦ΋ͦ΋͜Μͳ͜ͱ͸͠ͳ͍͸ͣͳͷͰগ͠ແ஡ͳྫͰ͢ɻ

Slide 16

Slide 16 text

RepositoryͱDataStore ͜ΕΒΛ෼͚ΔϝϦοτ͕׆͖Δͷ͸ • ௨৴orΩϟογϡ͕͋Δ৚݅Ͱ੾ΓସΘΔ • ৚݅ʹΑͬͯ࢖͏API͕มΘΔ ͳͲͷ࢓༷͕සൟʹଘࡏ͢Δ৔߹ͩͱࢥ͍·͢

Slide 17

Slide 17 text

ແҙຯͳίʔυͷྔ࢈ ઌఔͷΑ͏ͳίʔυ͕ྔ࢈͞ΕΔΑ͏ͳΞϓϦʹ͸
 ຊ౰ʹ Clean Architecture ͸ඞཁͩͬͨͷͰ͠ΐ͏͔ʁ ෆཁͩͱࢥ͍·͢ɻ

Slide 18

Slide 18 text

Ͱ͸Ͳ͏΍ͬͯઃܭΛ
 બͿ/ߟ͑Δͷ͔

Slide 19

Slide 19 text

·ͣ͸νʔϜͰ࿩͠߹ͬͯΈ·͠ΐ͏

Slide 20

Slide 20 text

ͳͥઃܭํ਑ΛऔΓܾΊΔͷ͔ • ࣮૷ํ๏ͷଐਓԽΛ๷͙ • ςελϏϦςΟͷ୲อ • ࢓༷มߋ͠΍͘͢͢Δ • etc… ଞʹ΋৭ʑ͋Δͱࢥ͍·͢

Slide 21

Slide 21 text

େࣄʹ͍ͨ͜͠ͱΛܾΊΔ ΞʔΩςΫνϟʹ͸τϨʔυΦϑ͕͋Γ·͢ ͦΕΛຬͨ͢ઃܭΛબͿ େࣄʹ͍ͨ͜͠ͱ (ධՁ࣠) ΛܾΊͯ

Slide 22

Slide 22 text

ઃܭ͸ڞ௨ݴޠ ઃܭ͸ ϓϩδΣΫτͷڞ௨ݴޠ (ͪͳΈʹɺClean ArchitectureͷఏএऀͷRobert Martin͸
 ઃܭ͸ “Intent (ҙਤ)” ͩͱߟ͍͑ͯΔΑ͏Ͱ͢) ϝϯόʔ͕ೲಘ͢Δઃܭʹ͢Δͷ΋େࣄ https://www.infoq.com/news/2013/07/architecture_intent_frameworks

Slide 23

Slide 23 text

ݏ͍ͳݴޠ͸࢖͍ͨ͘ͳ͍Ͱ͢ΑͶ http://stackoverflow.com/insights/survey/2016

Slide 24

Slide 24 text

࣮ࡍʹ౰ͯ͸Ίͯߟ͑ͯΈΔ ༷ʑͳΞʔΩςΫνϟΛ
 ࣗ෼ͨͪͷΞϓϦʹద༻͢ΔͱͲ͏ͳΔͷ͔Λ
 ίʔυϨϕϧͰߟ͑ͯΈΔ

Slide 25

Slide 25 text

࣮ࡍʹ౰ͯ͸Ίͯߟ͑ͯΈΔ struct MyApp: MVP { … } struct MyApp: Flux { … } struct MyApp: CleanArchitecture { … } struct MyApp: MVVM, VIPER {} ΋͔͢͠Δͱ
 ͦͷΞϓϦʹ͸͜Ε͕Ϛον͢Δ͔΋ʁ

Slide 26

Slide 26 text

࡞ͬͯΈͳ͖Ό෼͔Μͳ͍ ࣮ࡍʹίʔυΛॻ͍ͯΈͯ
 ؾ͕෇͘͜ͱͬͯΑ͋͘Γ·͢ΑͶʁ 1ը໘ͷϞοΫ͚ͩͰ΋
 ࣮૷ͯ͠ΈΔͱ
 Կ͔ݟ͑ͯ͘Δ͔΋͠Ε·ͤΜ

Slide 27

Slide 27 text

ิ଍঺հ ATAM 
 (Architecture Tradeoff Analysis Method) ΞʔΩςΫνϟτϨʔυΦϑ෼ੳ๏ ࣮ફιϑτ΢ΣΞΞʔΩςΫνϟ
 Ͱ ঺հ͞Ε͍ͯΔΒ͍͠Ͱ͢

Slide 28

Slide 28 text

࠷ޙʹ ઃܭʹର͢Δߟ͑ํվળͷ
 ͖͔͚ͬʹͳΕ͹޾͍Ͱ͢

Slide 29

Slide 29 text

ʘYahoo!৐׵Ҋ಺ ͥͻ࢖ͬͯͶʗ ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ @tattn