เราจะทำให้ 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
- 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
- Build Your Own Cybersecurity Lab with GNS3 + Wazuh + Docker: Train, Detect, and Defend in One Platform
- How to Simulate and Train with Network Devices Using GNS3
- What Is an LMS? And Why You Should Pay Attention to Frappe LMS
- Agentic AI in Factories: Smarter, Faster, and More Autonomous Operations
- Smarter, Safer EV Fleets: Geo-Fencing and Real-Time Tracking for Electric Motorcycles
- How to Implement Google Single Sign-On (SSO) in FastAPI
- Build Your Own Taxi Booking App with Simplico: Scalable, Secure & Ready to Launch
- Building a Scalable EV Charging Backend — For Operators, Developers, and Innovators
- How to Handle Complex Pricing for Made-to-Order Products in Odoo
- How to Build a Made-to-Order Product System That Boosts Sales & Customer Satisfaction
- Transform Your Operations with Autonomous Agentic AI
- Streamline Fiber Tester Management with a Lightweight EXFO Admin Panel
- Enhancing Naval Mission Readiness with EMI Simulation: Cost-Effective Risk Reduction Using MEEP and Python