OpenDiscussion_DataDrivenDesign
2013-11-22 13:39
351 查看
本文源于公司内部技术交流,如有不当之处,还请指正。
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.
Learn more: http://www.codeproject.com/Articles/91528/How-to-Call-WCF-Services-Synchronously-and-Asynchr
2 WPF Revolution.
Winform DataBinding:
http://files.cnblogs.com/cuiyansong/WinformDataBindingDemo.7z
如果在Winform下开发,实现数据的双向绑定,当然是依靠委托的方式实现的。底层数据模型提供一个广播委托Speaker,当数据发生改变时,触发委托通知。一般来讲我们需要构建一个通道用于共享并集中管理通道消息Channel,通道将收集上来的消息发送给监听者Listener。
WPF DataBinding:
http://files.cnblogs.com/cuiyansong/DatabindingDemo.7z
http://files.cnblogs.com/cuiyansong/Demo_ObservalCollection.7z
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.
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.
Learn more: http://www.codeproject.com/Articles/91528/How-to-Call-WCF-Services-Synchronously-and-Asynchr
2 WPF Revolution.
Winform DataBinding:
http://files.cnblogs.com/cuiyansong/WinformDataBindingDemo.7z
如果在Winform下开发,实现数据的双向绑定,当然是依靠委托的方式实现的。底层数据模型提供一个广播委托Speaker,当数据发生改变时,触发委托通知。一般来讲我们需要构建一个通道用于共享并集中管理通道消息Channel,通道将收集上来的消息发送给监听者Listener。
WPF DataBinding:
http://files.cnblogs.com/cuiyansong/DatabindingDemo.7z
http://files.cnblogs.com/cuiyansong/Demo_ObservalCollection.7z
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.
相关文章推荐
- .bashrc文件
- 字符界面启动linux
- 服务器 centos 禁止普通用户重启关机
- Linux(Centos)配置OpenSSH无密码登陆<转>
- linux常用头文件
- java学习之路----项目经验----关于TOMCAT中文乱码问题的总结
- Developer Color Picker 的使用
- linux特殊权限位之setuid、setgid和sticky
- hadoop mapreduce
- OpenRisc-57-ORPSoC仿真环境的构建
- Linux中的工作队列
- 嵌入式linux内核学习之系统框架
- Linux修改用户组
- CentOS 修改主机名(host)
- 业务开发测试HBase之旅二:通过HBase Shell与HBase交互
- Windows平台Hadoop编译、安装、配置与运行(转)
- Linux的exec族函数使用示例
- shell脚本从文件中按行读取数据,并且赋值到数组中的几种方法
- Linux shell 搜索关键字
- Linux调试工具汇总