เราจะทำให้ 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
- 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
- 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