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
良いコードを書くためにやってみてること3つ.pdf
Search
Keisuke kiuchi
October 31, 2018
Programming
5
620
良いコードを書くためにやってみてること3つ.pdf
shibuya.apk#29
https://shibuya-apk.connpass.com/event/104424/
Keisuke kiuchi
October 31, 2018
Tweet
Share
More Decks by Keisuke kiuchi
See All by Keisuke kiuchi
巨大なプロダクトにおける技術負債と戦った成功と失敗の軌跡(途中経過)
kiuchikeisuke
0
1.4k
Navigationを見据えたリファクタリング -マルチモジュール化を添えて-
kiuchikeisuke
1
2.7k
ぼくのかんがえた最強のUsecaseの作り方~あるいはビジネスロジックとはなにかという1つの回答~
kiuchikeisuke
13
6.8k
NavigationのNavOptions周りを覗いてみよう
kiuchikeisuke
0
670
AndroidStudioのテンプレートを覗いてみよう
kiuchikeisuke
2
790
Kotlin版CleanArchitectureのテンプレート作ったら爆速開発になった話+α
kiuchikeisuke
21
8.4k
Other Decks in Programming
See All in Programming
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Better Code Design in PHP
afilina
PRO
0
130
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
受け取る人から提供する人になるということ
little_rubyist
0
250
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
イベント駆動で成長して委員会
happymana
1
330
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
CSC509 Lecture 12
javiergs
PRO
0
160
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
KATA
mclloyd
29
14k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
How to Ace a Technical Interview
jacobian
276
23k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
What's new in Ruby 2.0
geeforr
343
31k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
ྑ͍ίʔυΛॻͨ͘Ίʹ ͬͯΈͯΔ͜ͱͭ LJVDIJLFJTVLF 4IJCVZBBQL
ܒี w ৬ۀɿ:ͷ"OESPJEΤϯδχΞ݉ҭࣇύύ w झຯͰ࡞ͬͨϞϊɿʮΒ͘ͰΜ "QQ ʯɺ ʮ$MFBO"SDIJUFDUVSF5FNQMBUF'PS,PUMJO 044 ʯ
w Ϟοτʔɿ໌ͷࣗʹ༏͍͠ίʔυΛॻ͘ w 4/4 5XJUUFS!GFJ@LPNF (JUIVC!LJVDIJLFJTVLF 2JJUB!L@LFJTVLF
࠷ۙͷΞΫςΟϏςΟ
ࠓճͷൃද كʹΑ͋͘ΔΛ ׂͱΑ͋͘Δख๏Ͱղܾ͠Α͏ͥ ͱ͍͏γϯϓϧͳ
ΞδΣϯμ wҙຯͱ੍Λදݱ͠Α͏ wແΛදݱ͠Α͏ wϨϏϡʔ؍ΛγΣΞ͠Α͏
ҙຯͱ੍Λදݱ͠Α͏
ಥવͰ͕࣭͢Ͱ͢ WBMQIPOF/VN4USJOH ͱ͍͏มΛݟͨΒͲΜͳΛ ૾͠·͔͢ʁ
࣍ͷ࣭ WBMUFMFQIPOF/VN4USJOH ͳΒͲ͏͍͏Ͱ͠ΐ͏
None
ࣅͯΔ͚ͲผͷҙຯΛ࣋ͭม w QIPOF/VNl9999:::: w UFMFQIPOF/VNlUFM9999::::z ʮΒ͘ͰΜʯͷΞϓϦΑΓҰ෦վѱͯ͠ൈਮ
EBUBΫϥε JOJUؔͰ ҙຯͱ੍Λදݱ͠Α͏
UFMFQIPOF/VNCFSJT data class TelephoneNumber(val number: String) { init { if
(!number.startsWith(SCHEME)) { throw IllegalArgumentException(“error“) } else if (number.substring(SCHEME.length) .contains(Regex(“.*[^0-9#¥+¥*() -]+.*"))) { throw IllegalArgumentException(“error”) } } companion object { const val SCHEME = "tel:" } } 4$)&.&͔Β ࢝·ͬͯΔ͜ͱ ಛఆͷਖ਼نදݱΛ ຬͨ͢͜ͱ
QIPOF/VNCFSJT class PhoneNumber(val number: String) { init { if (number.startsWith(TelephoneNumber.SCHEME))
{ throw IllegalArgumentException(“error") } else if ((number.contains(Regex(".*[^0-9#¥+¥*() -]+.*")))) { throw IllegalArgumentException(“error") } } } 4$)&.&͔Β࢝·ͬͯ ͍ͳ͍͜ͱ ಛఆͷਖ਼نදݱΛ ຬͨ͢͜ͱ
ิJOMJOF$MBTT PSEBUB$MBTT w *OMJOFDMBTT ,PUMJOWFSd w JOJUϝιουΛ࣋ͯͳ͍ͷͰɺܕ੍ͷΈͰेͷ߹ ʹར༻ w
EBUBDMBTT w JOJUϝιουΛ࣋ͯΔͰɺܕ੍ ϩδΧϧͳ੍Λ ͍ͨͤͨ߹ʹར༻ ˞͋͘·Ͱݸਓͷߟ͑ํͰ͢
ແΛදݱ͠Α͏
࣍ͷ ͋Δ-JTU͔Β݅ʹ߹கͨ͠ ཁૉΛऔΓग़ؔ͢Λ࡞Γ͍ͨ
val contactList = List<Contact>() fun findSameNumberContact(phoneNumber: PhoneNumber):Contact? { return contactList.find
{ it.getPhoneNumber() == phoneNumber } } ۭͷ-JTU͚ͩͲΩχγφΠσ
͍͍Ͷʂ☺
val contactList = List<Contact>() fun findSameNumberContact(phoneNumber: PhoneNumber):Contact? { return contactList.find
{ it.getPhoneNumber() == phoneNumber } } Μʁ
/VMMBCMFͩ
ແΛදݱ͠Α͏
val contactList = List<Contact>() fun findSameNumberContact(phoneNumber: PhoneNumber):Contact { return contactList.find
{ it.phoneNumber == phoneNumber } ?: Contact.NONE } data class Contact(val displayName: String, val contactId: String, val phoneNumber: PhoneNumber) { companion object { val NONE = Contact("", "", PhoneNumber("")) } } dddddddddddddddddddddddddddddddddddddddddddddddddddd
/PO/VMMͰແΛදݱʂ ☺ ˞ͨͩ͠ɺ/VMMͷ··ʹͨ͠΄͏͕ྑ͍߹͋ΔͷͰ༻๏༻ྔΛक͍ͬͯ·͠ΐ͏
ิ/VMMBCMF PSແΛදݱ w ແΛදݱˠ/VMMʹͳΔ͜ͱ͕ਖ਼ৗܥͷൣғͷ߹ྫ֎ॲཧ͕ෆ ཁʹͳΔ߹ w ྫ&EJU5FYUʹϢʔβʔ͕ೖྗͨ͠ి൪߸ʹϚον͢Δి൪߸Λ pOEͰݟ͚ͭɺి൪߸Λදࣔ͢Δ ݟ͔ͭΒͳ͍ͳΒۭจࣈ
w /VMMͷ··ˠ/VMMʹͳΔ͜ͱ͕ຊདྷ͋Γ͑ͳ͍߹ w ྫిாҰཡͰνΣοΫΛೖΕͨ൪߸͚ͩΛpOEͰݟ͚ͭΔ ˞͋͘·Ͱݸਓͷߟ͑ํͰ͢
ϨϏϡʔ؍ΛγΣΞ͠Α͏
ɺ͋Δ13ΛϨϏϡʔ ͍ͯͨ࣌͠ͷ͜ͱ
ࢦఠͨ͠΄͏͕͍͍ Օॴ͕ଟ͗͢Δ
ࢦఠ͠ͳ͍Θ͚ʹ͍͔ͳ͍͕ɺ શ෦ࢦఠ͢Δͷ͠ΜͲ͍
ͳͷͰɺָΛͭͭ͠ νʔϜٕज़ྗͷ্ʹܨ͕Δํ๏ ΛͬͯΈͨ
ձٞࣨΛڌͯ͠ ϞϒϓϩతϨϏϡʔձΛ࣮ࢪ
ϞϒϓϩతϨϏϡʔ w ࢀՃऀɿ"OESPJE&OHਓɺJ04&OHਓ w ࡐɿྫͷ13 ,PUMJO w ͬͨ͜ͱɿ ࢦఠՕॴΛͲΜͲΜϗϫΠτϘʔυʹॻ͖ग़͢
Ͳ͏ͨ͠΄͏͕͍͍͔ɺΛٞ͢Δ ࢦఠΛө ͔͚ͨͬͨ͠Ͳ࣌ؒͷ߹্࣮ݱͤͣ
ϞϒϓϩతϨϏϡʔ ˞ࣾ֎ൿͳͷͰϞβΠΫॲཧͯ͠·͢
ͬͯΈͨײ৮ w վΊͯݟͯΈΔͱʮ͜ͷ࣮ԿΛҙਤͯ͠ΔΜͩ ʯͬͯͷ͕ ग़ͯ͘Δ w ࢦఠ͞ΕΕͨΓલͱࢥ͑Δͷ͕ଟ͍ w ม໊໊ؔͷ໋໊ͷେ͞Λ࠶ೝࣝͨ͠ w
,PUMJOʹ׳Εͯͳ͍ਓ͕ॻ͘ͱ7BS͕ଟ͘ͳΔ
ϨϏϡʔ؍ΛγΣΞͯ͠ɺ νʔϜΈΜͳ͕ཧղͰ͖Δ ࣮Λ৺͕͚Α͏
·ͱΊ wࣅͨҙຯΛ͚࣋ͭͲҟͳΔม ˠҙຯͱ੍Λදݱ͠Α͏ wOVMMBCMFΛແ͘͢ํ๏ ˠແΛදݱ͠Α͏ wνʔϜͷٕज़ྗ্݉Ͷͯۮʹ ϨϏϡʔ؍ΛγΣΞ͠Α͏
͓ΘΓͰͬ͢ʂ