วิธีการออกแบบเพื่อลดการซับซ้อนของ 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 ที่สูงกว่า
Related Posts
- Building an OCPP 1.6 Central System with Flask async, WebSockets, and MongoDB
- How AI Supercharges Accounting and Inventory in Odoo (with Dev Insights)
- Building a Fullstack E-commerce System with JavaScript
- Building Agentic AI with Python, Langchain, and Ollama for eCommerce & Factory Automation
- Diagnosing the Root Cause of P0420 with Python, OBD-II, and Live Sensor Data
- How to Apply The Mom Test to Validate Your Startup Idea the Right Way
- When to Choose Rasa vs Langchain for Building Chatbots
- Introducing OCR Document Manager: Extract Text from Documents with Ease
- Testing an AI Tool That Finds Winning Products Before They Trend — Interested?
- Your Website Is Losing Leads After Hours — Here’s the Fix
- How Agentic AI is Revolutionizing Smart Farming — And Why Your Farm Needs It Now
- How to Apply RAG Chatbot with LangChain + Ollama
- Automating EXFO Instruments with SCPI: A Practical Guide
- Design Patterns That Help Tame Legacy Code (With Python Examples)
- How to Safely Add New Features to Legacy Code — A Developer’s Guide
- Modernizing Legacy Software — Without Breaking Everything
- How OpenSearch Works — Architecture, Internals & Real-Time Search Explained
- Choosing the Right Strategy for Basic vs Premium Features in Django
- Transform Your Custom Furniture Business with a Modern eCommerce Platform
- Introducing simpliPOS: The Smart POS Built on ERPNext
Our Products
Related Posts
- Building an OCPP 1.6 Central System with Flask async, WebSockets, and MongoDB
- How AI Supercharges Accounting and Inventory in Odoo (with Dev Insights)
- Building a Fullstack E-commerce System with JavaScript
- Building Agentic AI with Python, Langchain, and Ollama for eCommerce & Factory Automation
- Diagnosing the Root Cause of P0420 with Python, OBD-II, and Live Sensor Data
- How to Apply The Mom Test to Validate Your Startup Idea the Right Way
- When to Choose Rasa vs Langchain for Building Chatbots
- Introducing OCR Document Manager: Extract Text from Documents with Ease
- Testing an AI Tool That Finds Winning Products Before They Trend — Interested?
- Your Website Is Losing Leads After Hours — Here’s the Fix
- How Agentic AI is Revolutionizing Smart Farming — And Why Your Farm Needs It Now
- How to Apply RAG Chatbot with LangChain + Ollama
- Automating EXFO Instruments with SCPI: A Practical Guide
- Design Patterns That Help Tame Legacy Code (With Python Examples)
- How to Safely Add New Features to Legacy Code — A Developer’s Guide
- Modernizing Legacy Software — Without Breaking Everything
- How OpenSearch Works — Architecture, Internals & Real-Time Search Explained
- Choosing the Right Strategy for Basic vs Premium Features in Django
- Transform Your Custom Furniture Business with a Modern eCommerce Platform
- Introducing simpliPOS: The Smart POS Built on ERPNext