OpenDiscussion_DataDrivenDesign
生活随笔
收集整理的這篇文章主要介紹了
OpenDiscussion_DataDrivenDesign
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
本文源于公司內(nèi)部技術(shù)交流,如有不當(dāng)之處,還請指正。
?
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. 簡而言之,廣義上來說數(shù)據(jù)驅(qū)動設(shè)計是以數(shù)據(jù)為中心展開的設(shè)計方式,與以往的由界面至數(shù)據(jù)結(jié)構(gòu)的方式相反,首先要從數(shù)據(jù)結(jié)構(gòu)/數(shù)據(jù)模型下手,完善數(shù)據(jù)控制層/業(yè)務(wù)邏輯層,最后在到界面的設(shè)計。 Summary:? 1 It’s just a different way that how to design software. It’s a design method not writing code directly. 只是一種不同的設(shè)計軟件的思想,方式。 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. 通常,我們是從上之下的設(shè)計方式,先界面,后模型。 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. 相反,我們是從數(shù)據(jù)入手展開軟件設(shè)計,一切以數(shù)據(jù)為中心;底層數(shù)據(jù)驅(qū)動開發(fā),界面依賴于數(shù)據(jù),也叫做控制反轉(zhuǎn)。 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下開發(fā),實現(xiàn)數(shù)據(jù)的雙向綁定,當(dāng)然是依靠委托的方式實現(xiàn)的。底層數(shù)據(jù)模型提供一個廣播委托Speaker,當(dāng)數(shù)據(jù)發(fā)生改變時,觸發(fā)委托通知。一般來講我們需要構(gòu)建一個通道用于共享并集中管理通道消息Channel,通道將收集上來的消息發(fā)送給監(jiān)聽者Listener。 ? WPF DataBinding: http://files.cnblogs.com/cuiyansong/DatabindingDemo.7z http://files.cnblogs.com/cuiyansong/Demo_ObservalCollection.7z WPF 提供了ObservableCollection 實現(xiàn)數(shù)據(jù)集合的雙向綁定,INotifyCollection是對Module層的數(shù)據(jù)更新通知,底層實現(xiàn)的代碼與上面的實現(xiàn)方式幾乎相同,而ObservableCollection則是對List進(jìn)行了二次封裝,提供List.Add,List.Remove級別上的綁定,就是說如果數(shù)據(jù)集合發(fā)生變化,也將會通知相關(guān)Listener。 本質(zhì)上來說,WPF 的ObservableCollection 和 INotifyCollection并未提供什么新鮮的東西,只是一次便捷的封裝。當(dāng)然這里也要公平的說一下,這2個類只是WPF DataBinding思想的一部分而已,另外還包括界面的動態(tài)綁定,屬性的雙向綁定等等,都是一次思想上的革新! 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.轉(zhuǎn)載于:https://www.cnblogs.com/cuiyansong/p/3437098.html
總結(jié)
以上是生活随笔為你收集整理的OpenDiscussion_DataDrivenDesign的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做了输卵管通液一般多久可以备孕要小孩子?
- 下一篇: JAVA多线程学习3--线程一些方法