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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
73
Laravel Offline Sharing (March 2023) at Ho Chi Minh City, Vietnam
dinhquochan
0
58
Other Decks in Technology
See All in Technology
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
0
170
LayerXにおけるセキュリティ管理の現在地と次の一手
tosho
0
240
AI-DLCを “そのまま導入しなかった”話 ~組織に合わせてアジャストした 私たちの実践共有~
hiroramos4
PRO
0
170
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
220
ロボティクスの技術 / Robotics Technology
ks91
PRO
0
100
SONiCの統計情報を取得したい
sonic
0
220
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
1
1.1k
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
140
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
260
気づかぬうちにセキュリティ負債を生むAPIキー運用
sgwrmctk
0
180
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
5
1.7k
Kubernetesにおける学習基盤とLLMOpsの概要
ry
1
320
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
850
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
140
4 Signs Your Business is Dying
shpigford
187
22k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
420
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Test your architecture with Archunit
thirion
1
2.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
390
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