计算机与现代化

• 软件工程 • 上一篇    下一篇

一种事件驱动有限状态机的编程实现框架

  

  1. 河南工业职业技术学院计算机工程系,河南南阳473000
  • 收稿日期:2014-01-13 出版日期:2014-06-13 发布日期:2014-06-25
  • 作者简介:李伟(1982-),男,河南南阳人,河南工业职业技术学院计算机工程系助教,硕士,研究方向:嵌入式技术,视频编解码; 门佳(1982-),男,河南南阳人,讲师,硕士,研究方向:嵌入式系统,自然语言处理。

 A Programming Framework of Event-driven Finite State Machine

  1. Department of Computer Engineering, Henan Polytechnic Institute, Nanyang 473000, China
  • Received:2014-01-13 Online:2014-06-13 Published:2014-06-25

摘要: 在现代程序设计中,网络协议实现、游戏角色建模等很多复杂场景切换问题都可以用有限状态机来描述。本文将有限状态机概念与事件驱动模型结合,设计一种可复用的代码模板实现各状态转换的动态管理。该方法简洁高效,模块逻辑清晰,提高了系统的健壮性。

关键词:  , 有限状态机, 事件驱动, 状态切换, 可复用框架

Abstract: In modern programming, network protocol, game roles modeling and many other issues which include complex state switches can be described in finite state machine. In this paper, the theory of finite state machine is combined with event-driven model, a reusable code template is designed to dynamically manage the state switch sense. This method makes logic of the code module clear and the system healthy.

Key words:  finite state machine, event-driven, state switch, reusable framework