Zillow สร้างโค้ดใหม่ที่ชัดเจนด้วยคอมโพเนนต์สถาปัตยกรรมของ Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ

Zillow เป็นตลาดอสังหาริมทรัพย์ออนไลน์ชั้นนำที่ให้บริการแก่ผู้บริโภคด้วยข้อมูล
รายการ ข้อมูล และเครื่องคำนวณที่จำเป็นเพื่อช่วยในการซื้อ เช่า หรือขาย
บ้าน นอกจากนี้ เว็บไซต์ยังเชื่อมต่อผู้ใช้กับตัวแทนในพื้นที่ ผู้ให้บริการจำนอง
และนักออกแบบบ้านด้วย
Zillow เปิดตัวในปี 2006 และมีสำนักงานใหญ่อยู่ในซีแอตเทิล โดยมีฐานข้อมูลบ้านในสหรัฐอเมริกามากกว่า 110 ล้านหลัง
นอกจากนี้ ยังมีชุดแอปยอดนิยมซึ่งมี
แอปอสังหาริมทรัพย์บนอุปกรณ์เคลื่อนที่กว่า 20 แอป เมื่อเริ่มยกเครื่องโค้ดครั้งใหญ่ในแอปบนอุปกรณ์เคลื่อนที่ Android ในเดือนกรกฎาคม 2017 Zillow ต้องการทำให้ชีวิตของนักพัฒนาแอปง่ายขึ้นด้วยการทำให้โค้ดอ่านง่ายขึ้นและช่วยให้สมาชิกใหม่ในทีมเข้าใจได้ง่ายขึ้น
สิ่งที่พวกเขาทำ
Zillow ปรับปรุงโค้ดโดยใช้คอมโพเนนต์สถาปัตยกรรม Android
"เรากำลังตรวจสอบสถาปัตยกรรมประเภทต่างๆ" Aayush Raj วิศวกรซอฟต์แวร์ของ Zillow กล่าว
"Architecture Components มีข้อดีเพิ่มเติมคือการรับรู้ถึงวงจรของคอมโพเนนต์ ซึ่งทำให้จัดการโค้ดได้ง่ายขึ้นมาก"
ViewModel ช่วยให้ข้อมูล
ยังคงอยู่ได้แม้จะมีการเปลี่ยนแปลงการกำหนดค่า (เช่น การหมุนหน้าจอ) ขณะที่
LiveData เป็นคลาสที่เก็บข้อมูลที่สังเกตได้
ทั้ง 2 อย่างนี้ใช้โดย Zillow และเมื่อใช้ร่วมกันแล้วก็กลายเป็นเทมเพลตที่มีประสิทธิภาพสำหรับการใช้ Model-View-ViewModel (MVVM) "ช่วยให้โค้ดของเราทดสอบได้มากขึ้น" Raj กล่าว ไลบรารีความคงทนของ
Room ยังช่วยให้สร้างเลเยอร์แคชในเครื่องได้ง่ายขึ้นด้วย
แอปจึงไม่ต้องดึงข้อมูลจากเครือข่ายบ่อยนัก "ซึ่งช่วยปรับปรุงประสิทธิภาพและประสบการณ์ของผู้ใช้"
ผลลัพธ์
การย้ายโค้ดจำนวนมากสำหรับการอัปเดตข้อมูลจากกิจกรรมไปยัง ViewModels ช่วยให้โค้ดทั้งหมดอ่านง่ายขึ้นอย่างแน่นอน" Raj กล่าวเสริม
แต่คอมโพเนนต์ที่ใช้ ViewModel
ยังไม่มีข้อบกพร่องที่เกี่ยวข้องกับวงจรของแอป การสื่อสาร
การอัปเดตข้อมูลไปยังกิจกรรมและ Fragment ก็ทํางานได้ดีเช่นกัน
"นักพัฒนาแอปมีประสิทธิภาพมากขึ้นอย่างแน่นอนเมื่อใช้ Android Architecture Components" Sumiran Pradhan วิศวกรอาวุโสฝ่ายพัฒนาซอฟต์แวร์ของ Zillow กล่าว
Architecture Components จะให้คำแนะนำเมื่อเริ่มต้นจากศูนย์
แต่ก็มีประโยชน์ในฐานของโค้ดที่มีอยู่ด้วย "เมื่อนักพัฒนาแอปใหม่ๆ
เข้าใจว่าตรรกะอยู่ที่ใดใน ViewModel พวกเขาก็จะชอบ"
Pradhan กล่าวเสริม
เริ่มต้นใช้งาน
คอมโพเนนต์สถาปัตยกรรมของ Android เปิดให้นักพัฒนาแอปทุกคนใช้บริการได้ในส่วนของ Android Jetpack เริ่มต้นใช้งาน Android Architecture Components
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2018-05-03 UTC
[null,null,["อัปเดตล่าสุด 2018-05-03 UTC"],[],[],null,["# Zillow builds clear new code with Android Architecture Components\n\nZillow is a top online real estate marketplace that provides consumers with\nthe listings, data, and calculators they need to help them buy, rent, or sell\na home. The site also connects users with local agents, mortgage providers,\nand home designers.\n\nLaunched in 2006 and headquartered in Seattle, Zillow maintains a database\nof more than 110 million U.S. homes. They also operate a popular suite of\nover two dozen mobile real estate apps. When they began a major overhaul of\ntheir code in their Android mobile app in July 2017, Zillow wanted to simplify\ntheir developers' lives by making the code more readable and easier for\nnew team members to understand.\n\nWhat they did\n-------------\n\nZillow revamped their code using\n[Android Architecture Components](/topic/libraries/architecture).\n\"We were investigating different kinds of architecture,\" says Aayush Raj,\nZillow software engineer. \"Architecture Components had the added advantage of\nlifecycle awareness, which made code much easier to manage.\"\n\n[ViewModel](/topic/libraries/architecture/viewmodel) allows data to\nsurvive configuration changes (such as screen rotations), while\n[LiveData](/topic/libraries/architecture/livedata) is an observable\ndata-holder class. Both were used by Zillow, and together, they provided a\npowerful template for implementing Model-View-ViewModel (MVVM). \"It helped make\nour code more testable,\" Raj says. The\n[Room](/topic/libraries/architecture/room) persistency library also\nmade it easy to build a local cache layer, so the app didn't have to pull data\nfrom the network as often, \"improving performance and the user experience.\"\n\nResults\n-------\n\nMoving lots of code for data updates from activities to\n[ViewModels](/topic/libraries/architecture/viewmodel) has\n\"definitely helped\" make the whole code base more readable, Raj adds.\nThey haven't yet converted the whole app to\n[ViewModel](/topic/libraries/architecture/viewmodel),\nbut components that are using\n[ViewModel](/topic/libraries/architecture/viewmodel)\nhaven't had any lifecycle-related bugs. Communicating\ndata updates to activities and fragments also works very well.\n\n\"Developers are absolutely more productive using Android Architecture\nComponents,\" says Sumiran Pradhan, Zillow senior software development engineer.\nArchitecture Components gives them guidance when starting from scratch,\nbut is also useful in the existing code base. \"Once new developers\nunderstand where the logic lives in the\n[ViewModel](/topic/libraries/architecture/viewmodel), they love it,\"\nPradhan adds.\n\nGet started\n-----------\n\nAndroid Architecture Components is open to all developers as part of\n[Android Jetpack](/jetpack). Get\nstarted with [Android Architecture Components](/jetpack/arch)."]]