Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CarbonとMutableオブジェクトの話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ryo Tomidokoro
December 26, 2018
Technology
850
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CarbonとMutableオブジェクトの話
CarbonでMutableとかImmutableの概念を覚えようねの話。
Ryo Tomidokoro
December 26, 2018
Transcript
26 slides
CarbonͱMutableΦϒδΣΫτͷ 1)1ษڧձ
໊લॴ྄ 3ZP5PNJEPLPSP ৬ۀ8FC"QQMJDBUJPO&OHJOFFS ॴଐ*OOPWBUPS+BQBO*OD ࡶ༻୲ झຯόεέοτϘʔϧ؍ઓ
Carbonͱʁ
$BSCPOͱʁ Carbon - A simple PHP API extension for DateTime.
DateTimeΫϥεͷAPI֦ு IUUQTDBSCPOOFTCPUDPN
$BSCPOͱʁ ศར ײతͰ͔Γ͍͢ ๛ͳAPIͱυΩϡϝϯτ
MutableΦϒδΣΫτͱʁ
.VUBCMFΦϒδΣΫτͱʁ MutableΦϒδΣΫτ ͦͷঢ়ଶΛม͑Δ͜ͱ͕ग़དྷΔΦϒδΣΫτ ImmutableΦϒδΣΫτ ͦͷঢ়ଶΛม͑Δ͜ͱ͕ग़དྷͳ͍ΦϒδΣΫτ ࢀর) Πϛϡʔλϒϧ - Wikipedia |
https://ja.wikipedia.org/wiki/Πϛϡʔλϒϧ
ຊͷେࣄͳςʔϚ
ຊͷॏཁࣄ߲ 1. CarbonΛ௨ͯ͡MutableɺImmutableΛ֮͑Α͏ ಛʹImmutableͷ֓೦ͱͯେ 2. CarbonͷίʔυϨϏϡʔྗUP Carbon࣌ʹةݥͳίʔυΛੜΈग़͢ ৯͍ࢭΊ·͠ΐ͏ʂ
ຊͷॏཁࣄ߲ ͔͠͠ɺී௨ʹίʔυྫΛಡΜͰ͖ΔͷͰ… ΫΠζܗࣜͰίʔυϨϏϡʔͯ͠Έ·͠ΐ͏ʂ
CarbonΫΠζ
$BSCPOΫΠζ A܅usersςʔϒϧʹొ͞ΕͨϢʔβσʔλͷத ͔Βɺ࠷ۙ̏ϲ݄Ҏʹొ͞ΕͨϢʔβσʔλΛ நग़͢ΔॲཧΛ࡞Δ͜ͱʹͳΓ·ͨ͠ɻ ͔͠͠ɺA܅͕࡞ͨ͠ϓϩάϥϜʹ͕͋ͬ ͯਖ਼͘͠ϢʔβσʔλΛநग़Ͱ͖·ͤΜͰͨ͠ɻ
$BSCPOΫΠζ ࣍ͷίʔυͷԿߦʹ͕͋ΔͰ͠ΐ͏͔ʁ ͦͯ͠ɺͦΕԿނͰ͠ΐ͏͔ʁ
$BSCPOΫΠζ ࣮ࡍͷϓϩάϥϜʢൈਮʣ 1. Կߦ͕ʁ 2. Կ͕ʁ
CarbonΫΠζ - ղฤ
$BSCPOΫΠζ 1. Կߦ͕ʁ -> 14ߦ 2. Կ͕ʁ -> subMonthϝιουͰ$todayࣗମมߋ͞Εͯ͠·͏
CarbonΫΠζ - ൣղ1
$BSCPOΫΠζ copy()ϝιουΛ͏ $todayͷෳΛ࡞Δ͜ͱͰɺ$todayࣗମͷมߋΛආ͚Δ
CarbonΫΠζ - ൣղ2
$BSCPOΫΠζ Carbon2 CarbonImmutableͳΒɺ$todayImmutableͳͷͰෆม
$BSCPOΫΠζ Carbon2 AliasΛ͑ɺϓϩάϥϜͷมߋແ͠ɻ
·ͱΊ
·ͱΊ ɾCarbonѱ͘ͳ͍ ɾAPI֦ுͷੑ࣭Λ͖ͪΜͱѲ͢Δ͜ͱ ɾMutable, ImmutableΦϒδΣΫτΛ֮͑Α͏
͓·͚
$BSCPOͱ$BSCPO MutableΦϒδΣΫτ ImmutableΦϒδΣΫτ ɾCarbon1ܥ ɾDateTimeΫϥεͷ֦ுAPI ɾCarbon2ܥ ɾDateTimeImmutableΫϥεͷ֦ுAPI
%BUF5JNF*NNVUBCMFΫϥε ࢀর) PHPϚχϡΞϧ | http://php.net/manual/ja/class.datetimeimmutable.php
More Decks by Ryo Tomidokoro
See All by Ryo Tomidokoro
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
2.7k
あるアーキテクチャ決定と その結果/architecture-decision-and-its-result
hanhan1978
2
2k
開発者が知っておきたい複雑さの正体/where-the-complexity-comes-from
hanhan1978
8
4k
Spec Driven Development入門/spec_driven_development_for_learners
hanhan1978
2
2k
フロントエンドがTypeScriptなら、バックエンドはPHPでもいいじゃない/php-is-not-bad
hanhan1978
8
14k
どうすると生き残れないのか/how-not-to-survive
hanhan1978
17
15k
100分で本番デプロイ!Laravelで作るWebアプリケーション作成/100min_web_app_cicd
hanhan1978
1
320
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
8
4.1k
集中して作業する技術/how_to_work_deeply
hanhan1978
69
63k
Other Decks in Technology
See All in Technology
コーディングできない僕にBobが舞い降りた
shumpei3
0
230
Test Impact Analysis を武器に立ち向かう、AI 時代のテスト増加に対するヌーラボのアプローチ / getting-started-datadog-test-impact-analysis
k6s4i53rx
3
900
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
480
成長するID管理基盤における運用もコストも犠牲にしないオブザーバビリティ向上の実践 / Improving Observability for a Growing Identity Platform Without Adding Operational Burden or Cost
kaminashi
1
140
Metadata - Section 4 : MODS (Metadata Object Description Schema )
mohab1
0
170
技術同人誌を作る方法
yoshimura_datam
0
110
Taking back control of your AI development
inesmontani
PRO
0
320
AWS Well-Arhitected Frameworkセキュリティの柱 について
miu_crescent
PRO
2
270
Well, that’s weird…
csswizardry
3
250
PR 生成AIガバナンスの全体像がわかる本
yoshimura_datam
0
120
2026-11-16 JAWS-UG コンテナ支部 #31 ゆるLT大会 ECR のライフサイクルポリシーを いい感じに設定したい / ECR Lifecycle policy
masasuzu
3
640
AIエージェントのアーキテクチャ設計
nsatoh
0
590
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
4 Signs Your Business is Dying
shpigford
187
23k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
GitHub's CSS Performance
jonrohan
1033
470k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
580
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
670
Music & Morning Musume
bryan
48
7.5k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
350
Color Theory Basics | Prateek | Gurzu
gurzu
1
530
Git: the NoSQL Database
bkeepers
PRO
433
67k