Android Architecture Components (ส่วนหนึ่งของ Jetpack) เป็น libraries ที่ช่วยสร้างแอปที่แข็งแกร่งและดูแลรักษาง่าย รวมถึง ViewModel (สถานะที่รับรู้ lifecycle), LiveData/StateFlow (ข้อมูลที่สังเกตการณ์ได้) และ Room (การ abstraction ของฐานข้อมูล) มันสนับสนุนรูปแบบสถาปัตยกรรมที่แนะนำ
ViewModel — ตัวถือสถานะที่รับรู้ lifecycle
VIEWMODEL holds UI-related state and logic, SURVIVING configuration changes:
→ state stored in a ViewModel SURVIVES screen rotation (the activity recreates, but the
ViewModel persists) → solves the lost-state-on-rotation problem
→ separates UI logic from the Activity/Fragment (the View just observes/displays)
