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
0
120
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
Tweet
Share
More Decks by Dinh Quoc Han
See All by Dinh Quoc Han
Laravel Live Vietnam 2022: Laravel Eloquent Performance
dinhquochan
0
56
Laravel Offline Sharing (March 2023) at Ho Chi Minh City, Vietnam
dinhquochan
0
54
Other Decks in Technology
See All in Technology
Secure Boot 2026 - Aggiornamento dei certificati UEFI e piano di adozione in azienda
memiug
0
140
マネージャー版 "提案のレベル" を上げる
konifar
19
12k
「ストレッチゾーンに挑戦し続ける」ことって難しくないですか? メンバーの持続的成長を支えるEMの環境設計
sansantech
PRO
1
320
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
320
Shifting from MCP to Skills / ベストプラクティスの変遷を辿る
yamanoku
1
170
LY Tableauでの Tableau x AIの実践 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
1.3k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Serverless Agent Architecture on Azure / serverless-agent-on-azure
miyake
1
150
ヘルシーSRE
tk3fftk
2
240
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
95k
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
730
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
1.6k
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
WCS-LA-2024
lcolladotor
0
470
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
190
Believing is Seeing
oripsolob
1
72
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
380
Designing Experiences People Love
moore
143
24k
Fireside Chat
paigeccino
42
3.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
310
Chasing Engaging Ingredients in Design
codingconduct
0
130
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Design in an AI World
tapps
0
160
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
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