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
Laravel Vietnam Meetup 2022: Your code is simpl...
Search
Dinh Quoc Han
March 25, 2023
Technology
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Laravel Vietnam Meetup 2022: Your code is simplify or complexity?
Laravel Vietnam Meetup (August 2022) at Ho Chi Minh City, Vietnam
Dinh Quoc Han
March 25, 2023
More Decks by Dinh Quoc Han
See All by Dinh Quoc Han
Laravel Live Vietnam 2022: Laravel Eloquent Performance
dinhquochan
0
74
Laravel Offline Sharing (March 2023) at Ho Chi Minh City, Vietnam
dinhquochan
0
59
Other Decks in Technology
See All in Technology
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
1.4k
PLaMoを毎日の開発で使い育てていく
pfn
PRO
0
180
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
1
180
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
4
1.1k
OSPN.JPバージョンアップ作業進捗のご報告 / 20260801-osc26kyoto
akkiesoft
0
260
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
230
Digitization部 紹介資料
sansan33
PRO
2
7.7k
Issue設計から始める仕様駆動開発 / 20260731 Mizuki Hirata
shift_evolve
PRO
1
130
個人OSSが、机の上から世界に広がるまでの話
shinyasaita
1
340
モダンフロントエンド 開発研修
recruitengineers
PRO
1
300
20260801_スクフェス大阪
kgnkhkr
1
1.1k
PLaMo 3.0 Primeの事後学習
pfn
PRO
0
270
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
430
Unsuck your backbone
ammeep
672
58k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
450
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Six Lessons from altMBA
skipperchong
29
4.4k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.3k
Technical Leadership for Architectural Decision Making
baasie
3
460
Documentation Writing (for coders)
carmenintech
77
5.4k
Transcript
Your Code Is SIMPLIFY Or COMPLEXITY? with Dinh Quoc Han
Code Của Bạn ĐƠN GIẢN Hay PHỨC TẠP? với Đinh
Quốc Hân
Who Am I? PHP Lover, Artisan 6 years experience Currently
working at SHIFT ASIA Admin at Laravel Viet Nam
Overview 1. Problems 2. Coding Standards 3. CRUD 4. Complexity?
5. Q&A
1. Problems!
2. Coding Standards
PSR-12
None
None
How to follow PSR-12?
None
PSR-12
composer require --dev laravel/pint
3. CRUD Create - Read - Update - Delete 😎
How Many?
M-V-C
M-V-C but by Packages
Domain Oriented Design Not ‘DDD’ - Domain Driven Design 🤣
…
Basic Example
routes/web.php
app/Http/Controllers/UserController.php
app/Http/Controllers/UserController.php
Write all business logic in controller?
None
Why?
Controller should hold ZERO logic!
Controller only bring logic together!
Easy apply design patterns, structures!
Easy to reuse, maintenance, testing
1. Fat Model - Thin Controller
None
None
None
2. Repository Class or Service Class
None
None
3. Actions/Commands Class (CQRS)
None
None
4. Together
Example From Laravel
None
None
Next: Controller!
Cruddy by Design Adam Wathan
"More controllers doing less work obviates need for many other
fancy patterns!" David Heinemeier Hansson - Creator of RoR
7 Standard Actions in Laravel
1. Index 2. Create 3. Store 4. Show 5. Edit
6. Update 7. Destroy
NEVER write CUSTOM ACTION
None
None
None
Tip #1: Nested Resource? Create New Controller
None
None
Tip #2: Edited Dependently? Create New Controller
None
None
Tip #3: Touches Pivot Records? Create New Controller
None
None
Tip #4: Transitions State? Create New Controller
Example From Laravel
None
None
Or Single Action Controller? Invokable Controller
None
None
4. Complexity?
YAGNI "You aren't gonna need it"
Back To The BASIC
app/Http/Controllers/UserController.php
1 Phút Quảng Cáo!
None
Thank You Q&A