軟體設計精要與模式--筆記1
封裝(Encapsulation)、繼承(Inheritance)、多型(Polymorphism)
1.封裝
封裝就是合理的隱藏和公開。
In computer science, information hiding is the principle of segregation of the
design decisions in a computer program that are most likely to change, thus
protecting other parts of the program from extensive modification if the design
decision is changed. The protection involves providing a stable interface which
protects the remainder of the program from the implementation (the details that
are most likely to change).
這是維基百科的解釋,簡單點說就是將最可能發生變化的隱藏起來,公開物件呼叫者需要
的介面。
例:員工(Employee)的年齡(Age)。顯然Age應該作為屬性,而不是作為欄位直接暴露給
呼叫者。
相關推薦
軟體設計精要與模式--筆記1
一:面向物件的核心要素封裝(Encapsulation)、繼承(Inheritance)、多型(Polymorphism)1.封裝封裝就是合理的隱藏和公開。In computer science, information hiding is the principle of segregation of th
Ajax與Comet-JavaScript高級程序設計第21章讀書筆記(1)
set activex .html 規範 sta php 協議 num 刷新 Ajax(Asynchronous Javascript + XML)技術的核心是XMLHttpRequest對象,即: XHR。雖然名字中包含XML,但它所指的僅僅是這種無須刷新頁面即可從服務器
設計模式筆記1:簡單工廠模式
1.3 簡單 修改 作用 面向對象 對象 面向 tro 計算 如果想成為一名更優秀的軟件設計師,了解優秀軟件設計的演變過程比學習優秀設計本身更有價值。 1.1 面向對象的好處 通過封裝、繼承多態把程序的耦合度降低,使用設計模式使得程序更加靈活,容易修改,易於復用
02軟件架構設計的思想與模式閱讀筆記
技術人 復雜 項目管理 經驗 需求 管理 軟件 人員 無法 軟件的質量問題往往表現為缺陷(bug),軟件缺陷的產生主要有兩個原因:軟件產品的特點和開發過程。對於產品特點,用戶往往描述的不是特別仔細,或有什麽隱性的要求沒有說,或有什麽在這個領域公認的特點,而技術人員並不知道。
04軟件架構設計的思想與模式閱讀筆記
劃過 復雜 規劃 架構設計 特性 軟件開發 度量標準 類型 根據 把軟件需求轉化為健壯的設計和合理的項目規劃能夠可以有效的提高效率,由於需求定義了項目預期的成果,所以項目規劃、預測和進度安排都必須以軟件需求為基礎。 正確的項目規劃需要以下元素: 1.根據對需求的清楚理解來估
軟體工程精要概述1-概述
拒絕囉裡八嗦的廢話,坑爹不是時間,是青春. 1. 軟體工程定義: 軟體工程是1968年北大西洋公約組織的工作會議上首先提出“軟體工程”的概念,要用工程化的思想來開發軟體.用科學知識和技術原理來定義、開發、維護軟體的一 門科學 1.1軟體工程的性質: 軟體工程是一門
ExtJS2 0開發與實踐筆記 1 ——ExtJS中的Dialog與Form
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Python 資料分析與展示筆記1 -- Numpy 基礎
Python 資料分析與展示筆記1 – NumPy 基礎 Python 資料分析與展示系列筆記是筆者學習、實踐Python 資料分析與展示的相關筆記 課程連結: Python 資料分析與展示 參考文件: NumPy 官方文件(英文) NumPy 官方文件(中文) PIL
訊息佇列設計精要
訊息佇列已經逐漸成為企業IT系統內部通訊的核心手段。它具有低耦合、可靠投遞、廣播、流量控制、最終一致性等一系列功能,成為非同步RPC的主要手段之一。當今市面上有很多主流的訊息中介軟體,如老牌的ActiveMQ、RabbitMQ,炙手可熱的Kafka,阿里巴巴自主開發的Noti
《簡約之美:軟體設計之道》- 讀書筆記
本篇讀書筆記的內容大部分是來自我剛參與的掘金的讀書打卡活動。我在這次讀書打卡活動選擇了《簡約之美:軟體設計之道》這本書。我把這幾次打卡的內容作了整合,也加了一點沒有在打卡活動裡面寫的內容構成了這篇讀書筆記,希望讀者可以有些收穫。 追求卓越還是得過且過 “程式中複雜的部分必須以某種簡
《Unity Shader入門精要》自學筆記(一)
Shader "Custom/zhudingdian" {Properties {_Diffuse("Diffuse",color) = (1,1,1,1)//用於顏色設定}SubShader {pass{tags{"LightMode" = "ForwardBase"}C
ActiveMQ學習總結(8)——訊息佇列設計精要
訊息佇列已經逐漸成為企業IT系統內部通訊的核心手段。它具有低耦合、可靠投遞、廣播、流量控制、最終一致性等一系列功能,成為非同步RPC的主要手段之一。 當今市面上有很多主流的訊息中介軟體,如老牌的ActiveMQ、RabbitMQ,炙手可熱的Kafka,阿里巴巴自主開發的No
《高效能SQL調優精要與案例解析》一書談SQL調優(SQL TUNING或SQL優化)學習
《高效能SQL調優精要與案例解析》一書上市發售以來,很多熱心讀者就該書內容及一些具體問題提出了疑問,因讀者眾多外加本人日常工作的繁忙 ,在這裡就SQL調優學習進行討論並對熱點問題統一作答。 首先,我們說說何為SQL調優。SQL調優是關係庫領域的一項技能或工作,其來自SQL
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-1 本章導航
/** * 軟體設計七大原則-本章導航 學習筆記 * @author cnRicky * @date 2018.11.7 */ 本章導航 開閉原則(所有原則的一個基礎) 依賴倒置原則 單一職責原則 介面隔離原則 迪米特法則(最少知道原則) 里氏替換原則 合成/複用原則(組合
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-2 開閉原則
/** * 軟體設計七大原則-開閉原則 * @author cnRicky * @date 2018.11.7 */ 開閉原則 定義:一個軟體實體如類、模組和函式應該對擴充套件開放,對修改關閉 強調的是用抽象構建框架,用實現擴充套件細節 優點:提高軟體系統的可複用性及可維護性 開閉原則
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-6 迪米特原則(最少知道原則)
/** * 軟體設計七大原則-迪米特原則 學習筆記 * @author cnRicky * @date 2018.11.10 */ 迪米特原則(最少知道原則) 一個物件應該對其他物件保持最少的瞭解。又叫最少知道原則 迪米特原則主要強調:儘量降低類與類之間的耦合 優點:降低類與類之
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-5 介面隔離原則
/** * 軟體設計七大原則-介面隔離原則 學習筆記 * @author cnRicky * @date 2018.11.10 */ 介面隔離原則 定義:用多個專門的介面,而不使用單一的總介面,客戶端不應該依賴它不需要的介面 一個類對一個類的依賴應該建立在最小的介面上 建立單一介
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-4 單一職責原則
/** * 軟體設計七大原則-單一職責原則 學習筆記 * @author cnRicky * @date 2018.11.10 */ 單一職責原則 定義:不要存在多於一個導致類變更的原因 一個類只負責一個職責,如果分別有兩個職責,那就建立兩個類分別負責職責1和職責2 一個類/介面/方法只負
【學習筆記】慕課網—Java設計模式精講 第3章 軟體設計七大原則-3-3 依賴倒置原則
/** * 軟體設計七大原則-依賴倒置原則 學習筆記 * @author cnRicky * @date 2018.11.10 */ 依賴倒置原則 高層模組不應該依賴低層模組,二者都應該依賴其抽象 抽象不應該依賴細節;細節應該依賴抽象 針對介面程式設計,不要針對實現程式設計(儘
Java 設計模式學習筆記1——策略模式(Duck例子)
利用 實例化 top 而是 實現 學習筆記 left ng- 多個 0、假設現有工程(Duck)中遇到為類添加功能的問題,如何設計類添加新的功能? 1、利用繼承提供的Duck(鴨子)的行為會導致哪些缺點? (1)代碼在多個子類中重復 (2)很多男知道所有鴨子的全部行為