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.
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.

轉載于:https://www.cnblogs.com/cuiyansong/p/3437098.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377550.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377550.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377550.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

十三、Loss Functions

一、Loss Functions損失函數 損失函數的作用: 1,損失函數就是實際輸出值和目標值之間的差 2,由這個差便可以通過反向傳播對之后的數據進行更新 Loss Functions官網給的API 里面由很多種損失函數,不同的損失函數有其不同的用途及表…

leetcode 滑動窗口小結 (一)

目錄小結以及代碼框架76. 最小覆蓋子串滑動窗口代碼以及注釋567. 字符串的排列滑動窗口438. 找到字符串中所有字母異位詞3. 無重復字符的最長子串化簡框架reference小結以及代碼框架 滑動窗口技巧屬于雙指針技巧。 該算法的思路為維護一個窗口,不斷滑動&#xff0c…

linux命令行界面_Linux中的命令行界面

linux命令行界面If you are like most people, you are probably most familiar with using a Graphical User Interface (GUI) to control your computer. Introduced to the masses by Apple on the Macintosh computer and popularized by Microsoft, a GUI provides an eas…

一道小小面試題的細節分析

一道小小面試題的細節分析 今天突然想到以前遇到的一個問題,題目如下(可能絕大多數人都遇到過): 1 class A2 {3 public A()4 {5 PrintFields();6 }7 public virtual void Pr…

十四、OPTIM

一、torch.optim torch.optim.Optimizer(params, defaults)優化器官網說明 由官網給的使用說明打開看出來優化器實驗步驟: ①構造選擇優化器 例如采用隨機梯度下降優化器SGD torch.optim.SGD(beyond.parameters(),lr0.01),放入beyond模型的參數param…

Windows下運行jekyll,編碼已不再是問題

很久沒更新jekyll了,所以好奇著去官網看了下更新記錄,發現如下更新條目(版本1.3.0/2013-11-04發布): Add encoding configuration option (#1449)之前在windows下安裝jekyll運行編寫的代碼時,如果有中文&am…

leetcode 滑動窗口小結 (二)

目錄424. 替換后的最長重復字符思考分析1優化1004. 最大連續1的個數 III友情提醒方法1,基于當前最大頻數方法2,基于歷史最大頻數424. 替換后的最長重復字符 https://leetcode-cn.com/problems/longest-repeating-character-replacement/ 給你一個僅由大…

軟件故障_一些主要的軟件故障

軟件故障The need for software engineering was realized by the software industry after some of its major failures. Some of these failures are listed below, 在經歷了一些重大失敗之后,軟件行業意識到了對軟件工程的需求 。 下面列出了其中一些故障&#x…

十五、修改VGG16網絡來適應自己的需求

一、VGG-16 VGG-16神經網絡是所訓練的數據集為ImageNet ImageNet數據集中驗證集和測試集一萬五千張,有一千個類別 二、加載VGG-16神經網絡模型 VGG16模型使用說明 torchvision.models.vgg16(pretrainedFalse) 其中參數pretrained表示是否下載已經通過ImageNet數…

leetcode 滑動窗口小結 (三)

目錄978. 最長湍流子數組題目思路分析以及代碼1052. 愛生氣的書店老板題目思考分析與初步代碼優化思路以及優化代碼1208. 盡可能使字符串相等題目思考分析以及代碼978. 最長湍流子數組 https://leetcode-cn.com/problems/longest-turbulent-subarray/ 題目 當 A 的子數組 A[…

JAVA多線程學習3--線程一些方法

一、通過sleep方法睡眠 在指定的毫秒數內讓當前正在執行的線程休眠(暫停執行)。該線程不丟失任何監視器的所屬權。 二、線程優先級 線程具有優先級,范圍為1-10。 MAX_PRIORITY線程可以具有的最高優先級。int類型,值為10. MIN_PRIO…

mcq 隊列_MCQ | 量子密碼學

mcq 隊列1) Which possible Attacks in Quantum Cryptography can take place? 1)量子密碼術中可能發生哪些攻擊? Possible Attacks in Quantum Cryptography and Birthday Attack 量子密碼術和生日攻擊的可能攻擊 Birthday attack and Boomerang attack 生日襲擊…

《inside the c++ object model》讀書筆記 之一:對象

關于對象 ...引子:在C語言中,"數據"和"處理數據的操作(函數)"是分開來聲明的,語言本身并沒有支持"數據和函數"之間關聯性,這種程序成為"程序性的",由一組"分布在各個一功能為向導的函數中"的算法驅動,他們處理的是共同的外部…

十六、保存和加載自己所搭建的網絡模型

一、保存自己搭建的模型方法一 例如:基于VGG16網絡模型架構的基礎上加上了一層線性層,最后的輸出為10類 torch.save(objmodule,f"path"),傳入需要保存的模型名稱以及要保存的路徑位置 保存模型結構和模型的參數,保存文…

uC/OS-II OS_TASK.C中有關任務管理的函數

函數大致用途 OS_TASK.C是uC/OS-II有關任務管理的文件,它定義了一些函數:建立任務、刪除任務、改變任務的優先級、掛起和恢復任務,以及獲取有關任務的信息。 函數用途OSTaskCreate()建立任務OSTaskCreateExt()擴展建立任務OSTaskStkChk()堆…

windows下寫的腳本,在linux下執行失敗

Windows中的換行符為CRLF, 即正則表達式的rn(ASCII碼為13和10), 而Unix(或Linux)換行符為LF, 即正則表達式的n. 在Windows和Linux下協同工作的時候, 往往這個細小的差別就導致問題, 如 1)Windows下寫的Shell腳本, 在Linux下運行時往往出現rn是無效參數, 不能執行; 2)vi 等編器下…

Scala中的do ... while循環

做...在Scala循環 (do...while loop in Scala) do...while loop in Scala is used to run a block of code multiple numbers of time. The number of executions is defined by an exit condition. If this condition is TRUE the code will run otherwise it runs the first …

十七、完整神經網絡模型訓練步驟

以CIFAR-10數據集為例,訓練自己搭建的神經網絡模型架構 一、準備CIFAR-10數據集 CIFAR10官網使用文檔 torchvision.datasets.CIFAR10(root"./CIFAR_10",trainTrue,downloadTrue) 參數描述root字符串,指明要下載到的位置,或已有數…

μC/OS-Ⅱ 操作系統內核知識

目錄μC/OS-Ⅱ任務調度1.任務控制塊2.任務管理3.任務狀態μC/OS-Ⅱ時間管理μC/OS-Ⅱ內存管理內存控制塊MCBμC/OS-Ⅱ任務通信1.事件2.事件控制塊ECB3.信號量4.郵箱5.消息隊列操作系統內核:在多任務系統中,提供任務調度與切換、中斷服務 操作系統內核為每…

第二版tapout

先說說上次流回來的芯片的測試情況。 4月23日, 芯片采用裸片直接切片, bond在板子上,外面加了一個小塑料殼來保護,我們就直接拿回來測試了。 測試的主要分為模擬和數字兩部分, 數字部分的模塊基本都工作正常&#xff0…