Skip to Content
成為卓越程式設計師的38項必修法則
book

成為卓越程式設計師的38項必修法則

by Pete Goodliffe
May 2015
Intermediate to advanced
376 pages
5h 48m
Chinese
GoTop Information, Inc.
Content preview from 成為卓越程式設計師的38項必修法則
114
| 第十二章:對付複雜
當我們增加連結時,就會建立真正的軟體系統。當我們加入愈多團狀物,且重點在於它
們之間的線條,我們的系統就會變得愈複雜。
我們的軟體交互連結的結構會顯著地影響使用的便利程度。考慮下列的結構,哪一個是
我一直在使用的實際案例? [Page-108]
你對它們的反應是什麼? 哪一個看起來比較簡單? 我承認如果使用最後一個,幾乎會
讓我的頭爆炸。
線條
|
115
當我們畫出連結時,我們可以在圖中看到複雜程度通常來自循環。週期性的依賴關係通
常是最複雜的關係。當物件相互依賴,它們的結構就是剛性的,不容易更改,且通常非
常難以使用。要改變一個物件,通常需要改變其他的物件。物件會變成一個實體,一個
難以維護的實體。[Page-109]
這些關係種類可以藉由切斷其中一個連結來簡化。或許可以引入新的抽象介面來減少物
件間的耦合。
這種結構會提高可組合性,加入彈性,並促進可測試性(你可以在這些抽象介面之後編
寫測試版的元件)。我們可以使用一個好名字的介面來描述這些關係。
有一個我使用很久的骯髒系統看起來像是:
它表面上是一個簡單的模型:有一個父系物件代表“系統”,建立所有子物件。但是每
一個子物件都參考回父物件,所以它們互相存取。這個設計有效率地讓每一個子物件都
依賴(並變成緊密地耦合)每一個兄弟物件,將整個系統鎖定成一個剛性形狀。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習|使用Python

精通機器學習|使用Python

Sarah Guido, Andreas C. Mueller
Java性能优化实践:JVM调优策略、工具与技巧

Java性能优化实践:JVM调优策略、工具与技巧

Benjamin J. Evans, James Gough, Chris Newland

Publisher Resources

ISBN: 9789863475699