เราจะทำให้ program ที่มีขั้นตอนการทำงานที่ซับซ้อน และ ต้องแบ่งงานให้กับ programmer หลายๆ คนได้อย่างไร ?
หลายๆคน คงได้อ่านหนังสือเกี่ยว software engineering มาหลายๆ เล่ม ก็จะมีข้อเสนอแนะหลายวิธี แต่วันนี้ผมจะมาพูดถึงการควบคุมลำดับการทำงานของ program ที่ซับซ้อน ให้ง่ายขึ้นด้วยการสร้าง workflow engine system ขึ้นมาใช้เอง ลองกลับไปอ่านบทความก่อนหน้านี้ สร้าง business workflow process system ด้วย networkx.org
จากที่เคยเขียนเกี่ยวกับ networkX เราก็จะใช้ความสามารถของ networkX มาควบคุมการทำงานของ workflow โดยใช้เทคนิคของการเรียก function ด้วย string ผ่าน getattr function ใน python และใช้ successors function
ตัวอย่าง code

เพื่อนๆ คงจะพอเห็นแนวแล้วว่า flow control ของ program จะใช้ successors และเราก็สามารถเทียบกับ edge data ( ในกรณีนี้คือ choice: ‘b’ และ choice: ‘c’ ) เพื่อเลือก successor ที่สอดคล้องกับ edge data
ถ้าใช้วิธีการนี้เราก็สามารถแบ่งงานกับ programmer ในทีมได้ง่ายขึ้น เพราะแต่ละคนไม่ต้องสนใจว่า code ที่ตัวเองเขียนจะต้องถูกเรียกไปที่ไหน ซึ่งลองจินตนาการว่า function ที่จะถูกเรียกใช้งานต่อไปเขียนด้วย programmer อีกคนในทีม เป็นการ decoupling ผ่านวิธีการสร้าง workflow engine
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