A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers as well.
When the programmer starts looking into the application, the programmer discovers that because of the design of the application, it is necessary to make changes to each report to support the new printers.
Which two design concepts most likely explain the situation?
(Choose two.)
A. Inheritance
B. Low cohesion
C. Tight coupling
D. High cohesion
E. Loose coupling
F. Object immutablility
答案:BC
解析:
工程師發現程式要更新時
他必須修改所有的報表產生器內容
這就是低度分工(
Low cohesion
)與高度耦合(
Tight coupling
)的情形
為什麼會導致必須修改所有的報表產生器來維護這個軟體呢?
推測起來就是因為所有的報表產生時都是獨立運作的
應收帳款報表、應付帳款報表、收入報表等等都完全是由不同的程式片段來產生
類似的工作
卻是由全然不同的程式片段來執行
這就是低度的分工 - Low cohesion
獨立產生報表的同時也會出現一個問題
那就是添購新的印表機時
必須逐一修改程式片段
這也表示程式在運作時
程式片段會有很多資料交換
這就是高度的耦合 - Tight coupling
0 意見:
張貼留言