วิธีการออกแบบเพื่อลดการซับซ้อนของ 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
- Working With AI in Coding the Right Way
- How to Select the Right LLM Model: Instruct, MLX, 8-bit, and Embedding Models
- How to Use Local LLM Models in Daily Work
- How to Use Embedding Models with LLMs for Smarter AI Applications
- Smart Vision System for Continuous Material Defect Detection
- Building a Real-Time Defect Detector with Line-Scan + ML (Reusable Playbook)
- How to Read Source Code: Frappe Framework Sample
- Interface-Oriented Design: The Foundation of Clean Architecture
- Understanding Anti-Drone Systems: Architecture, Hardware, and Software
- RTOS vs Linux in Drone Systems: Modern Design, Security, and Rust for Next-Gen Drones
- Why Does Spring Use So Many Annotations? Java vs. Python Web Development Explained
- From Django to Spring Boot: A Practical, Visual Guide for Web Developers
- 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