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項必修法則
第七章
在汙物中打滾
如同狗會吃掉牠的嘔吐物,
笨蛋也會重複做蠢事。
- Psalms 26:11
我們都遇過這個東西:
流沙程式碼
quicksand code
)。你會在不知不覺中踏進去,很快
就會有沉下去的感覺。程式碼很縝密,不具可塑性,且排斥任何移動它的動作。你投入
愈多勞力,就會陷愈深。它是數位時代的殺人陷阱。
為什麼有效率的程式員會靠近這種(禮貌上來說)
不太好
的程式碼?我們
對抗垃圾
的策
略是什麼?
不要驚慌,穿上你的防沙褲,我們要沉進去了…55
嗅出徵兆
有一些程式碼很棒,就像是很好的藝術品,或精心撰寫的詩歌。它有明顯的結構、可識
別的韻律、具有節奏感,以及連貫性與美感,讓閱讀成為一種享受,你可以很開心地使
用它。
但是很遺憾地,事情並非總是如此。
有些程式碼很雜亂且沒有結構:有繞來繞去的 goto 把演算法隱藏起來。有的很難閱讀:
排版方式很糟糕,並且用很爛的命名方式。有些程式碼被沒必要的僵化結構詛咒:惡劣
的耦合與差勁的內聚力。有一些程式碼的構造低劣:用低層次的邏輯寫成糾纏不清的 UI
62
| 第七章:在汙物中打滾
碼。有一些程式碼充斥著重複的東西:讓專案變大,且沒必要地增加複雜程度,並且窩
藏許多一模一樣的 bug。有一些程式碼“濫用 OO”:因為各種錯誤的原因而使用繼承,
緊密地結合程式各部分,但它們其實沒有結合的必要。有一些程式碼像是有害的杜鵑坐 ...
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