V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
fancymax
V2EX  ›  分享发现

Flow-Based Programming

  •  
  •   fancymax · 2016-01-25 10:48:48 +08:00 · 1410 次点击
    这是一个创建于 3065 天前的主题,其中的信息可能已经有所发展或是发生改变。

    关于 Flow-Based Programming 编程的概念大家有接触过吗?

    相关介绍网址:
    1. http://noflojs.org/example/
    2. http://www.jpaulmorrison.com/fbp/index.shtml

    它是一种很好的组件编程方式,基本概念就是
    1. 把可复用的代码抽象成组件,组件有 输入、控制、输出端口。
    2. 用 DSL(领域专用语言)把不同组件的输入、输出端口连起来,组合出复杂的功能。控制端口用于初始设置组件的功能。
    3. 最后由 Flow - Based runtime (引擎)解析 DSL ,让所有组件一起运行完成你所需的功能。

    看上面两个网址的介绍,这个概念 还可以应用在嵌入式设备上,尤其是适用于智能家居行业这种需求复杂多变的场景里。如下是控制 AR.Drone 起飞,降落的例子

    // Start by connecting to drone. We could provide IP here
    '' -> IP Connect(ardrone/Connect)
    
    // Tell drone to take off
    Connect() CLIENT -> CLIENT Takeoff(ardrone/Takeoff)
    // Tell drone to land
    Takeoff() CLIENT -> CLIENT Land(ardrone/Land)
    
    // And that is all, folks!
    Land() CLIENT -> IN End(core/Drop)
    

    有兴趣的人欢迎留言~

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2359 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 04:12 · PVG 12:12 · LAX 21:12 · JFK 00:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.