เราจะทำให้ 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
Get in Touch with us
Related Posts
- Smarter Shopping: From Photo to Product Recommendations with AI
- Tackling Antenna Coupling Challenges with Our Advanced Simulation Program
- The Future of Work: Open-Source Projects Driving Labor-Saving Automation
- 下一个前沿:面向富裕人群的数字私人俱乐部
- The Next Frontier: A Digital Private Club for the Affluent
- Thinking Better with Code: Using Mathematical Shortcuts to Master Large Codebases
- Building the Macrohard of Today: AI Agents Platform for Enterprises
- Build Vue.js Apps Smarter with Aider + IDE Integration
- Yo Dev! Here’s How I Use AI Tools Like Codex CLI and Aider to Speed Up My Coding
- 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