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
610
良いコードを書くためにやってみてること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.7k
NavigationのNavOptions周りを覗いてみよう
kiuchikeisuke
0
650
AndroidStudioのテンプレートを覗いてみよう
kiuchikeisuke
2
770
Kotlin版CleanArchitectureのテンプレート作ったら爆速開発になった話+α
kiuchikeisuke
21
8.4k
Other Decks in Programming
See All in Programming
複数プロダクトの技術改善・クラウド移行に向き合うチームのフレキシブルなペア・モブプログラミングの実践 / Flexible Pair Programming And Mob Programming
honyanya
0
160
色んなオートローダーを覗き見る #phpcon_okinawa
o0h
PRO
5
370
선언형 UI를 학습할 때 알아둬야하는 키워드들
l2hyunwoo
0
110
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
340
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
6
230
dbt-ga4パッケージを実業務に導入してみた話
t_tokumaru_feedcorp
0
120
Assembling the Future: crafting the missing pieces of the Ruby on Wasm puzzle
skryukov
0
130
pytest プラグインを開発して DRY に自動テストを書こう
inuatsu
2
240
Iteratorでページネーションを実現する
sonatard
3
700
◯◯エンジニアになった理由
gessy0129
PRO
0
610
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
190
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
1
110
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
Happy Clients
brianwarren
97
6.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Writing Fast Ruby
sferik
625
60k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
How to Think Like a Performance Engineer
csswizardry
16
1k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
Docker and Python
trallard
40
3k
The World Runs on Bad Software
bkeepers
PRO
65
11k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Cost Of JavaScript in 2023
addyosmani
43
5.8k
Designing on Purpose - Digital PM Summit 2013
jponch
114
6.9k
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νʔϜͷٕज़ྗ্݉Ͷͯۮʹ ϨϏϡʔ؍ΛγΣΞ͠Α͏
͓ΘΓͰͬ͢ʂ