วิธีการออกแบบเพื่อลดการซับซ้อนของ software
ควรออกแบบให้เป็น Layer และ แต่ละ Layer ควรกำหนดจุดประสงค์ให้ชัดเจน

ภาพจากหนังสือ https://www.amazon.com/Grokking-Simplicity-software-functional-thinking/dp/1617296201
จากภาพด้านบนเราควรจะกำหนดวัตถุประสงค์ของแต่ละ layer ให้ชัดเจน และ call graph ก็ไม่ควรจะยุ่งเหยิง หรือมีลูกศรที่ข้าม layer และใน layer เดียวกันก็ไม่ควรจะมีที่เรียกกันเอง ( ถ้า function นั้นๆ เรียก function ใน layer เดียวกัน function นั้นก็ต้องอยู่บน layer ที่สูงกว่า )

Layer ที่อยู่ต่ำ คือ layer ที่เรียกใช้ function library ของภาษา หรือ system call ของ os ส่วน function ที่อยู่ชั้นบน คือ business domain layer ซึ่ง layer ที่อยู่ด้านบนถัดไปของ business domain layer ไม่สมควรที่จะรับรู้ data structure
Function ที่อยู่ layer บนมันจะเป็น function ที่มีการเปลี่ยนแปลงบ่อย มากกว่า function ที่อยู่ layer ต่ำกว่า
Function ที่อยู่ layer ด้านล่าง จะถูกใช้งานในหลายๆ function ที่อยู่ใน layer ที่สูงกว่า
Function ที่คุ้มค่าสำหรับ testing คือ function ที่อยุ่ใน layer ล่างๆ เพราะ เป็น function ที่ถูกเรียกใช้บ่อยจาก function ที่อยู่ใน layer ที่สูงกว่า
Get in Touch with us
Related Posts
- How to Build Large, Maintainable Python Systems with Clean Architecture: Concepts & Real-World Examples
- Why Test-Driven Development Makes Better Business Sense
- Continuous Delivery for Django on DigitalOcean with GitHub Actions & Docker
- Build a Local Product Recommendation System with LangChain, Ollama, and Open-Source Embeddings
- 2025 Guide: Comparing the Top Mobile App Frameworks (Flutter, React Native, Expo, Ionic, and More)
- Understanding `np.meshgrid()` in NumPy: Why It’s Needed and What Happens When You Swap It
- How to Use PyMeasure for Automated Instrument Control and Lab Experiments
- Supercharge Your Chatbot: Custom API Integration Services for Your Business
- How to Guess an Equation Without Math: Exploring Cat vs. Bird Populations
- How to Build an AI-Resistant Project: Ideas That Thrive on Human Interaction
- Build Your Own Cybersecurity Lab with GNS3 + Wazuh + Docker: Train, Detect, and Defend in One Platform
- How to Simulate and Train with Network Devices Using GNS3
- What Is an LMS? And Why You Should Pay Attention to Frappe LMS
- Agentic AI in Factories: Smarter, Faster, and More Autonomous Operations
- Smarter, Safer EV Fleets: Geo-Fencing and Real-Time Tracking for Electric Motorcycles
- How to Implement Google Single Sign-On (SSO) in FastAPI
- Build Your Own Taxi Booking App with Simplico: Scalable, Secure & Ready to Launch
- Building a Scalable EV Charging Backend — For Operators, Developers, and Innovators
- How to Handle Complex Pricing for Made-to-Order Products in Odoo
- How to Build a Made-to-Order Product System That Boosts Sales & Customer Satisfaction