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
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
580
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Realtime API 入門
riofujimon
0
150
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Featured
See All Featured
Teambox: Starting and Learning
jrom
133
8.8k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
A Tale of Four Properties
chriscoyier
156
23k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Embracing the Ebb and Flow
colly
84
4.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Become a Pro
speakerdeck
PRO
25
5k
Automating Front-end Workflow
addyosmani
1366
200k
Documentation Writing (for coders)
carmenintech
65
4.4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building an army of robots
kneath
302
43k
How to train your dragon (web standard)
notwaldorf
88
5.7k
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νʔϜͷٕज़ྗ্݉Ͷͯۮʹ ϨϏϡʔ؍ΛγΣΞ͠Α͏
͓ΘΓͰͬ͢ʂ