對象概念的再澄清與面向對象分析的步驟

對象英文是object, 帶有很強的客觀味道。可是在認識論中,純粹客觀是不存在的。由於客觀世界是不可知的(見康德相關著做)。從這個角度講,相對於從客觀的角度去理解對象這個詞,還不如從認識論的角度去理解它。由於顯然的,一切都是認識。人腦中的一切概念,都是主觀的。這樣理解,其實發現如今對面向對象的主流認識即領域建模,實際上是一種對「對象」的哲學認識的通俗認識。app

生活就是哲學,難道不是嗎?dom

因此在面向對象分析的時候,辨別什麼是對象其實很容易,你認爲它是什麼,那麼它就是什麼。這是一種什麼邏輯呢?它其實就是一種語言邏輯。也即,你日常是怎麼描述它的,那麼它就「是」什麼。或者說,你想怎麼描述它,它就「是」什麼。它「是」什麼由你決定。ui

由於真正的客觀並不存在。有人可能會以三維存在來決定一個事物是否對象。但是三維自己其實也只是一種性質,按照實在論的觀點,它並不優先於其它的事物屬性。也就是說,一切原本就都是性質。只不過通過人類大腦或認識的須要整理事後,造成如今的「物質」或者說惟物觀。可是咱們要解決的所有問題,其實都只在咱們大腦的內部,跟客觀世界其實沒有任何關係。只要解決了大腦內的「問題」,全部問題也就都解決了。由於「問題」自己,也只存在於咱們的理解中。一旦去除了理解,還有什麼可以「存在」呢?lua

人,活在語言中。 spa

而使用面向對象進行需求分析與設計的好處則在於它使得語言中的兩個重要元素:主語與謂語,的表達同時成爲可能。這是它與過程範式的最大區別,由於過程範式只有謂語,沒有主語。它的表達能力太有限。這也是爲何使用它開發出來的系統具備高耦合特性的緣由。面向過程的系統只有一個主語,那就是系統。而一個由大量謂語構成的功能式系統,天然只能是一個高耦合系統。.net

使用面向對象的範式,在分析時只需先對系統進行一遍(或多遍)陳述,而後找出其中的主語,而後找出其中的謂語,這些找出來的主語與謂語,就是系統分析的結果。這裏很容易看出的是,「陳述」相當重要。也就是說,我怎麼陳述系統,系統就將是什麼樣子的。系統將是我陳述的樣子。這是面向對象的精髓。而至於系統分析之後的系統設計,其實在很大程度上只是一些技術層面上的工做,並不會影響系統的邏輯結構。好比,系統跑在什麼平臺上固然很重要,可是這個重要性,固然遠遠不如系統的邏輯結構「重要」。甚至,若是採用的平臺合適的話,支撐系統實際上是能夠隨時替換的。設計

根據維基百科的定義,OOA是:orm

Object-oriented analysis (OOA) applies object-modeling techniques to analyze the functional requirements for a system對象

OOD則是:ip

 Object-oriented design (OOD) elaborates the analysis models to produce implementation specifications

Generally:

OOA focuses on what the system does, OOD on how the system does it.

This means that OOA defines the system itself, and OOD defines the way to implement it.

I don't agree with it because it has a 'system' in it. I mean, when we\re talking about object oriented anything, then when we're really doing 'anything', we should also be really oriented, only, to 'objects', not anything else, including 'system'. because if we're not, then maybe the word OOSA and OOSD should be used instead of OOA, OOD. Right?

再看這一段:

The result of object-oriented analysis is a description of what the system is functionally required to do, in the form of a conceptual model. That will typically be presented as a set of use cases, one or more UML class diagrams, and a number of interaction diagrams. It may also include some kind of user interface mock-up. The purpose of object oriented analysis is to develop a model that describes computer software as it works to satisfy a set of customer defined requirements.

是否是很矛盾?

面向對象分析的結果是一種在以概念模型爲形式的,關於系統在功能上應該作些什麼的描述。?,,而且,後面卻不再說起概念化模型(這種文章顯然是由某個對面向對象概念理解還不夠的人寫出來的)。。。什麼是類圖?類圖?對象圖呢?類比對象還重要?類不是對象的藍圖嗎?對象在系統中處於第幾位?1st?2nd?

可是在接下來的OOD中又這樣說起:

Object-oriented design (OOD) transforms the conceptual model produced in object-oriented analysis to take account of the constraints imposed by the chosen architecture and any non-functional – technological or environmental – constraints, such as transaction throughput, response time, run-time platform, development environment, or programming language.

The concepts in the analysis model are mapped onto implementation classes and interfaces. The result is a model of the solution domain, a detailed description of how the system is to be built.

上面OOA根本就沒有任何真正的「概念模型」文檔,然而這裏卻說從「概念模型」開始。。。。?

爲何咱們會被誤導?!

Though if we skip the argument about them being definitions, we can also see one valuable point in it which indicates that OOD is nothing to do with the definition of 'objects' but only implementing them. This is a good news because it means that all (complicated, abstracted, fragile?)object oriented things will be done before the design phase, or that the people who's doing the OOD job doesn't need to worry about anything which is connected to modeling because modeling's not really a easy job for everyone. Actually, it's quite a challenge for most people 'cause it requires either a lot of experiences or knowledges about the modeling domain or a lot of wisdom to understand the problem.

找出主語和謂語是近乎機械化的過程,這裏基本上不會有什麼問題。難的地方是,面向對象雖然不是功能導向的,但它至少是存在一個問題域(或問題空間)的。問題空間指問題所存在的空間,而面向對象的目的就是爲了實現這個空間(在使用領域建模的思想時。由於前面提過,面向對象的實現手段不少,根據問題的不一樣,可使用隨意的對象模型,即便這個模型與真實的問題空間沒有任何關係)。所以,真正的挑戰其實在於如何更好地實現這個空間(或其它的空間---即整個對象系統。也即,系統中有些什麼對象)!

相關文章
相關標籤/搜索