Chapter Three. Binding Model and Implementation
If the design, or some central part of it, does not map to the domain model, that model is of little value, and the correctness of the software is suspect. At the same time, complex mappings between models and design functions are difficult to understand and, in practice, impossible to maintain as the design changes. A deadly divide opens between analysis and design so that insight gained in each of those activities does not feed into the other.
??????? 如果一種設(shè)計(jì),或者它的一些核心并沒(méi)有與域模型相關(guān)聯(lián),那么這個(gè)模型就沒(méi)有價(jià)值,并且以此而開(kāi)發(fā)出來(lái)的軟件的正確性也值得懷疑。同時(shí),模型與功能設(shè)計(jì)之間復(fù)雜的對(duì)應(yīng)關(guān)系會(huì)變得難于理解,并且當(dāng)設(shè)計(jì)變化的時(shí)候,它們將很難維護(hù)。一種致命的分歧就此在分析與設(shè)計(jì)之間出現(xiàn),以至于那些分析設(shè)計(jì)活動(dòng)中所獲得的見(jiàn)解不能彼此滿足。
Design a portion of the software system to reflect the domain model in a very literal way, so that mapping is obvious. Revisit the model and modify it to be implemented more naturally in software, even as you seek to make it reflect deeper insight into the domain. Demand a single model that serves both purposes well, in addition to supporting a robust UBIQUITOUS LANGUAGE.
Draw from the model the terminology used in the design and the basic assignment of responsibilities. The code becomes an expression of the model, so a change to the code may be a change to the model. Its effect must ripple through the rest of the project's activities accordingly.
To tie the implementation slavishly to a model usually requires software development tools and languages that support a modeling paradigm, such as object-oriented programming.
??????? 以書(shū)面的形式設(shè)計(jì)軟件系統(tǒng)的一部分,進(jìn)而與域模型相映射,這樣雙方的對(duì)應(yīng)關(guān)系將會(huì)變得明顯。重新考慮這些模型并且通過(guò)修改讓他們?cè)谲浖?dāng)中顯得更加自然,甚至是當(dāng)你在尋求一種方法,來(lái)讓模型更加深刻的反映問(wèn)題域的時(shí)候也要如此。追求盡可能簡(jiǎn)單的模型,讓它能夠滿足多方面目的(軟件方面和設(shè)計(jì)方面?),又能夠支持足夠健全的通用語(yǔ)言。
??????? 從模型中提取那些在存在于設(shè)計(jì)中,以及存在于(域?qū)<业?)職責(zé)所包含的基本工作中的那些術(shù)語(yǔ)。代碼會(huì)因此成為對(duì)于模型的一種描述,所以對(duì)于代碼的更改或許就是源自于對(duì)于模型的更改。從而,它們的影響將會(huì)波及到項(xiàng)目其他部分的行為。
??????? 要牢固的把實(shí)現(xiàn)和模型綁定在一起,通常需要一些軟件設(shè)計(jì)工具以及支持模型范例的語(yǔ)言,例如面向?qū)ο蟪绦蛟O(shè)計(jì)。
???????
If the people who write the code do not feel responsible for the model, or don't understand how to make the model work for an application, then the model has nothing to do with the software. If developers don't realize that changing code changes the model, then their refactoring will weaken the model rather than strengthen it. Meanwhile, when a modeler is separated from the implementation process, he or she never acquires, or quickly loses, a feel for the constraints of implementation. The basic constraint of MODEL-DRIVEN DESIGN—that the model supports an effective implementation and abstracts key domain knowledge—is half-gone, and the resulting models will be impractical. Finally, the knowledge and skills of experienced designers won't be transferred to other developers if the division of labor prevents the kind of collaboration that conveys the subtleties of coding a MODEL-DRIVEN DESIGN.
??????? 如果寫(xiě)代碼的那些人對(duì)于模型沒(méi)有責(zé)任感的話,或者他們并不能懂得如何讓模型作用于應(yīng)用,那么模型對(duì)于軟件來(lái)講毫無(wú)用處。如果開(kāi)發(fā)人員不能夠認(rèn)識(shí)到對(duì)于代碼的修改就是對(duì)于模型的修改的話,它們的重構(gòu)將會(huì)使模型變得更糟,而不是讓它們更加健壯。同時(shí),當(dāng)一個(gè)從事建模的人與實(shí)現(xiàn)過(guò)程相隔離的時(shí)候,他(她)永遠(yuǎn)也不會(huì)獲得,或者說(shuō)會(huì)很快失去對(duì)于實(shí)現(xiàn)的約束感。模型驅(qū)動(dòng)設(shè)計(jì)的基本約束即是--模型需要對(duì)那些有效的(程序)實(shí)現(xiàn)提供支持,并且能夠抽象關(guān)鍵的域知識(shí)--任缺其一,模型都會(huì)變得不切實(shí)際。最后,如果項(xiàng)目中的分工阻止了能夠微妙的改善模型驅(qū)動(dòng)設(shè)計(jì)代碼編寫(xiě)的那些協(xié)作,那么團(tuán)隊(duì)中經(jīng)驗(yàn)豐富的設(shè)計(jì)人員的知識(shí)和技術(shù)將不能給的其他設(shè)計(jì)人員帶來(lái)提高。
Any technical person contributing to the model must spend some time touching the code, whatever primary role he or she plays on the project. Anyone responsible for changing code must learn to express a model through the code. Every developer must be involved in some level of discussion about the model and have contact with domain experts. Those who contribute in different ways must consciously engage those who touch the code in a dynamic exchange of model ideas through the UBIQUITOUS LANGUAGE.
??????? 任何專注于模型的技術(shù)人員必須花時(shí)間接觸代碼,而不論他(她)在項(xiàng)目中的首要角色是什么。任何負(fù)責(zé)修改代碼的人必須學(xué)會(huì)通過(guò)代碼來(lái)描述模型。每一個(gè)開(kāi)發(fā)人員必須不同程度的被納入到對(duì)模型的討論以及和域?qū)<业慕涣髦?。那些上述工作之外所涉及的?xiàng)目人員必須自覺(jué)地讓那些接觸代碼的人通過(guò)通用語(yǔ)言動(dòng)態(tài)的交換對(duì)于模型的意見(jiàn)。
posted on 2006-08-31 23:22
littlegai 閱讀(439)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
我的讀書(shū)筆記