zoukankan      html  css  js  c++  java
  • OpenDiscussion_DataDrivenDesign

    本文源于公司内部技术交流,如有不当之处,还请指正。

    Content:

    1. What is Data-driven design?
    2. WPF revolution.
    3. More about ObservableCollection.
    4. Question.
     
    1. What is Data-driven design?
    Data-driven design: is a design of using entity or module to control the software how to display and design. Now in Wikipedia, the article had been redirected to Responsibility-driven design which is inspired by the Client/Service Mode. The Client/Service model they refer to assumes that a software client and a software server exchange information based on a contract that both parties commit to adhere to. The client may only make the requests specified, the server must answer them.
    简而言之,广义上来说数据驱动设计是以数据为中心展开的设计方式,与以往的由界面至数据结构的方式相反,首先要从数据结构/数据模型下手,完善数据控制层/业务逻辑层,最后在到界面的设计。
     
     
    Summary: 
    1 It’s just a different way that how to design software. It’s a design method not writing code directly. 只是一种不同的设计软件的思想,方式。
    2 As usual, we design software from interface to data source, firstly drag user control to panel and secondly write control event. It’s also called up to down design. 通常,我们是从上之下的设计方式,先界面,后模型。
    3 On the opposite side, we use down to up design. From data module to user interface, we design around data module that compared with usual design, it’s called Inversion Of Control. 相反,我们是从数据入手展开软件设计,一切以数据为中心;底层数据驱动开发,界面依赖于数据,也叫做控制反转。
     
    Application:
    1 WCF
      First,we make a data module. Like this:
      
      Second, we make a WCF service in order to provider functions around data module.
      
     
     
    2 WPF Revolution.
     Winform DataBinding:
       如果在Winform下开发,实现数据的双向绑定,当然是依靠委托的方式实现的。底层数据模型提供一个广播委托Speaker,当数据发生改变时,触发委托通知。一般来讲我们需要构建一个通道用于共享并集中管理通道消息Channel,通道将收集上来的消息发送给监听者Listener。
      
      WPF DataBinding:
      WPF 提供了ObservableCollection 实现数据集合的双向绑定,INotifyCollection是对Module层的数据更新通知,底层实现的代码与上面的实现方式几乎相同,而ObservableCollection则是对List进行了二次封装,提供List.Add,List.Remove级别上的绑定,就是说如果数据集合发生变化,也将会通知相关Listener。
      本质上来说,WPF 的ObservableCollection 和 INotifyCollection并未提供什么新鲜的东西,只是一次便捷的封装。当然这里也要公平的说一下,这2个类只是WPF DataBinding思想的一部分而已,另外还包括界面的动态绑定,属性的双向绑定等等,都是一次思想上的革新!
     
     
    Summary
    –1. DataBinding’s essence is a method of using delegate which need both listener and speaker.
    –2. WPF build-in support XAML Binding grammar.
    –3. DataBinding is not just used for implement INotifyCollectionChanged interface, also you can only use the class Binding for yourself binding application.
    –4. If you need a list of data support two-way binding, you should use ObservableCollection instead of Ilist.
    –5. Data-Binding is just a method of software design not just only in WPF.
     
     
     
  • 相关阅读:
    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard
    mybatis plus 代码生成器
    ServerU FTP服务器无法上传中文名文件怎么办
    关于java文件下载文件名乱码问题解决方案
    使用Redis模拟简单分布式锁,解决单点故障的问题
    springboot定时任务处理
    AtomicInteger类的理解与使用
    java队列——queue详细分析
    ABAP DEMO so批量导入
    ABAP DEMO ole示例程序
  • 原文地址:https://www.cnblogs.com/cuiyansong/p/3437098.html
Copyright © 2011-2022 走看看