designpatterninruby-創(chuàng)新互聯(lián)

 general principles, to four points:
• Separate out the things that change from those that stay the same.
• Program to an interface, not an implementation.
• Prefer composition over inheritance.
• Delegate, delegate, delegate.
following sections, we will look at each of these principles in turn, to see
what they can tell us about building software.
Separate Out the Things That Change from Those
That Stay the Same
Software engineering would be a lot easier if only things would stay the same. We
could build our classes serene in the knowledge that, once finished, they would continue to do exactly what we built them to do. Of course, things never stay the same,
not in the wider world and certainly not in software engineering. Changes in com-
puting hardware, operating systems, and compilers, combined with ongoing bug fixes and ever-migrating requirements, all take their toll.
A key goal of software engineering is to build systems that allow us to contain the
damage. In an ideal system, all changes are local: You should never have to comb
through all of the code because A changed, which required you to change B, which
triggered a change in C, which rippled all the way down to Z. So how do you achieve— or at least get closer to—that ideal system, the one where all changes are local?
You get there by separating the things that are likely to change from the things
that are likely to stay the same. If you can identify which aspects of your system design
are likely to change, you can isolate those bits from the more stable parts. When
requirements change or a bug fix comes along, you will still have to modify your code,
but perhaps, just perhaps, the changes can be confined to those walled-off, change-prone areas and the rest of your code can live on in stable peace.
But how do you effect this quarantine? How do you keep the changing parts from
infecting the stable parts?
Program to an Interface, Not an Implementation
A good start is to write code that is less tightly coupled to itself in the first place. If our
classes are to do anything significant, they need to know about each other. But what

創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。

你所需要的網(wǎng)站建設服務,我們均能行業(yè)靠前的水平為你提供.標準是產(chǎn)品質(zhì)量的保證,主要從事成都網(wǎng)站設計、做網(wǎng)站、企業(yè)網(wǎng)站建設、手機網(wǎng)站制作設計、網(wǎng)頁設計、品牌網(wǎng)站設計、網(wǎng)頁制作、做網(wǎng)站、建網(wǎng)站。成都創(chuàng)新互聯(lián)擁有實力堅強的技術研發(fā)團隊及素養(yǎng)的視覺設計專才。

本文題目:designpatterninruby-創(chuàng)新互聯(lián)
地址分享:http://bm7419.com/article34/ipcpe.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設、建站公司、動態(tài)網(wǎng)站App設計、品牌網(wǎng)站制作網(wǎng)站導航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設