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

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.
 
 
 

OpenDiscussion_DataDrivenDesign的更多相关文章

随机推荐

  1. Maven项目整合SSH框架

    ---------------------siwuxie095                                         Maven 项目整合 SSH 框架         创建 ...

  2. WIN7系统IIS上发布站点后水印效果失效的解决方法

    关于使用一般处理程序给图片添加水印的方法,请参考: 使用一般处理程序(IHttpHandler)制作图片水印 有些时候,给图片添加水印了,在本机运行也都正常,但是发布到IIS上后就没有水印效果了.本人 ...

  3. python的多线程和守护线程

    1.创建一个多线程 import threading import time ''' def threading_func(num): print("running on number:%s ...

  4. Writing A Better JavaScript Library For The DOM 阅读记录

    原文地址:http://coding.smashingmagazine.com/2014/01/13/better-javascript-library-for-the-dom/ 主要观点: live ...

  5. HTML实例

    HTML内容繁多,不易记忆,故将此网址 作为查阅复习的工具http://www.w3school.com.cn/example/html_examples.asp

  6. struts框架值栈问题七之EL表达式也会获取到值栈中的数据

    7. 问题七:为什么EL也能访问值栈中的数据? * StrutsPreparedAndExecuteFilter的doFilter代码中 request = prepare.wrapRequest(r ...

  7. [Eclipse]Eclipse里对XML进行注释的快捷键

    eclipse中编辑java或C/C++文件时,注释的快捷键均为 "CTRL + / ",编辑xml文件时,该快捷键无效. eclipse 针对 XML 注释:CTRL + SHI ...

  8. springmvc 测试项目示例

    新建一个 maven项目 pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" ...

  9. url地址 参数 带 参数 注意事项 , chain , redirect , redirectAction

    当 url  地址中含有  参数 时 ,若参数值是一个 含有 参数的 地址时 , 应警惕 ,如 index/goIndex!login?backUrl=/shop/goShop!go?a1=1& ...

  10. DB2 autoincretment(抄袭)

    自动生成列: 1.在创建表的时候通过generated字句指定; 2.支持两个选项,generated always和generated by default.    1)generated alwa ...