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
680
AndroidStudioのテンプレートを覗いてみよう
kiuchikeisuke
2
800
Kotlin版CleanArchitectureのテンプレート作ったら爆速開発になった話+α
kiuchikeisuke
21
8.5k
Other Decks in Programming
See All in Programming
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
230
快速入門可觀測性
blueswen
0
340
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
Criando Commits Incríveis no Git
marcelgsantos
2
170
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
770
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1k
Go の GC の不得意な部分を克服したい
taiyow
2
770
命名をリントする
chiroruxx
1
390
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Embracing the Ebb and Flow
colly
84
4.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Into the Great Unknown - MozCon
thekraken
33
1.5k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Statistics for Hackers
jakevdp
796
220k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Facilitating Awesome Meetings
lara
50
6.1k
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νʔϜͷٕज़ྗ্݉Ͷͯۮʹ ϨϏϡʔ؍ΛγΣΞ͠Α͏
͓ΘΓͰͬ͢ʂ