系統分析與設計


Chapter 1

DFD(Data Flow Diagram) raise on Process Oriented
ERD(Entity Relation Diagram) raise on data Centered
Context Diagram

Structured Model(結構模型)

  • Not Suitable on Complex Project(不適合在大型複雜的專案)
  • Cannot go back to last phased(不能回到上一個步驟)
  • suit on simple project(適合小型專案)
  • Should complete clearly in each phase(需要仔細完全完成每一個步驟)->耗費大量時間

Rapid Application Development(RAD快速應用程式開發)

  • finish whole phase and release version of system(完成階段後可以發行系統)
  • can fix and renew system(可以維修更新系統)
  • not need collect all the requirement in first analysis phase(不需要收集完整的的需求在第一次的分析階段不穩定定)
  • Protyping(waste time to much ) not suitable on short time project(雛型模式不適合小型專案,不穩定)
  • Throwaway prototyping just a reference for your future system(拋棄式雛型開發只是拿來被參考於未來的系統)

Agile Development(敏捷式開發)

  • 適合多功能 新穎的專案
  • Should have high techincial lots of short meet(需要高技術含量 有很多小會議)
  • Document is nessarary(文件是重要的)
  • easy to change requirement(容易更改需求)
  • XP(focus on part of function)
  • SCRUM(Have sprint and agent)

Q1 we are going to habit from national defend requirement(國際防禦需求) we know miltitary is complex is not change offen should reliable i am a company whicj methodology yo use
國防部外包(嚴謹可靠 兩年完整 複雜)
ANS throwaway protyping

Q2 newly company CEO not satisfy original system graphical not satisfy 3 month
ANS Scrum


Chapter 2

參考文章
Validation 驗證客戶需求 do the right
Verification 驗證產品提供功能正確 do the right need the rule

Waterfall model

  • merit:
    1. The simple, straight sequence of phases of the waterfall simplifies project management.(瀑布的簡單、直接的階段順序簡化了項目管理。)
    2. It supports function-oriented project organization(支持功能導向的項目組織):
      • Each project is carried out by a pipeline of functional teams.(每個項目都由一系列職能團隊執行。)
      • Each functional team is specialized in one function such as requirements analysis, design, implementation, integration and testing, and so forth.(每個職能團隊都專注於一項職能,例如需求分析、設計、實施、集成和測試等)
  • problem:
    1. It is inflexible to requirements change.(對需求變化不靈活。)
    2. The long development duration means the system is outdated when it is delivered.(開發週期長意味著系統在交付時已經過時。)
    3. Users cannot experiment with the system to provide early feedback.(用戶無法對系統進行試驗以提供早期反饋。)
    4. The customer has to wait until the entire system is implemented and deployed to reap the benefits.(使用者需等待至整個系統實作與部屬完才能收到效益)
    5. The customer may lose the entire investment if the project fails.(假設專案失敗 客戶可能會失去整個投資資金)

Tame Problem Vs Wicked Problem

Tame : 可被解決的議題(Ex: 程式Bug)
Wicked : 高難度被解決的議題(Ex:政治問題,人權問題)

Software Process Models

Prototyping Process Model(原型製作過程模型)
Evolutionary Process Model(進化過程模型)
Spiral Process Model (螺旋過程模型)
Unified Process Model (統一過程模型)
Personal Software Process Model (個人軟件過程模型)
Team Software Process Model (團隊軟件過程模型)
Agile Process Models (敏捷過程模型)

Prototyping Process Model(雛型流程模式)

  • Prototypes of the software system are constructed to(軟件系統的原型被構建為):
    • acquire and validate requirements(獲取和驗證需求)
    • assess the feasibility of the project and/or the feasibility of the requirements and constraints(評估項目的可行性和/或要求和約束的可行性)
  • Simple prototypes as well as sophisticated prototypes are used, depending on the needs of the project.(根據項目的需要,使用簡單的原型和復雜的原型。)
  • Prototypes are classified into throwaway prototypes and evolutionary prototypes.(原型分為一次性原型和進化原型。)

Evolutionary Prototyping Model(進化雛型模式)

  • Throwaway prototypes waste time and effort.(一次性原型浪費時間和精力。)
  • Evolutionary prototyping model lets the prototype evolve into the production system.(進化原型模型讓原型演變成生產系統。)
  • It is most suited for the development of exploratory types of systems such as intelligent systems, research software, and systems that actively interact with and control the environment.(它最適合開發探索型系統,例如智能係統、研究軟件和主動與環境交互和控制環境的系統)
  • It is not suitable for projects that require a predictable schedule of progress.(它不適合需要可預測的進度計劃的項目)

Spiral Process Model(螺旋流程模式)

  • 它將瀑布模型和快速原型模型結合起來,強調了其他模型所忽視的風險分析,特別適合於大型複雜的系統。「螺旋模型」剛開始規模很小,當項目被定義得更好、更穩定時,逐漸展開。
  • 「螺旋模型」的核心就在於您不需要在剛開始的時候就把所有事情都定義的清清楚楚。您輕鬆上陣,定義最重要的功能,實現它,然後聽取客戶的意見,之後再進入到下一個階段。如此不斷輪迴重複,直到得到您滿意的最終產品。
  • 螺旋模型很大程度上是一種風險驅動的方法體系,因為在每個階段之前及經常發生的循環之前,都必須首先進行風險評估。

Rational Unified Process (RUP統一定義流程)

  • Inception consists of the first 1-2 iterations. It produces a simplified use case model, a tentative architecture, and a project plan.(啟動:包括前 1-2 次迭代。它產生了一個簡化的用例模型、一個暫定的架構和一個項目計劃。)
  • Elaboration consists of the next N iterations. It produces the architectural design and implements the most critical use cases.(細化:由接下來的 N 次迭代組成。它產生架構設計並實現最關鍵的用例)
  • Construction, during which remaining use cases are iteratively implemented and integrated into the system.(建造:在此期間,剩餘的用例被迭代實施並集成到系統中。)
  • Transition, during which the system is deployed, users are trained, and defects are corrected.(過渡:在部署系統、培訓用戶和糾正缺陷的過程中)

Personal Software Process Model(PSP個人軟體流程模型)

  • PSP is a comprehensive framework for training software engineers.(PSP是一個培訓軟件工程師的綜合框架)
  • It consists of scripts, forms, standards and guidelines used in the training. (它由培訓中使用的腳本、表格、標準和指南組成)
  • It helps the software engineer identify areas for improvement. (它幫助軟件工程師確定需要改進的地方)
  • It prepares the software engineer to work in a team project. (它使軟件工程師為在團隊項目中工作做好準備)

Team Software Process(團隊軟體流程)

Agile Process Models(敏捷流程模型)

Process and Methodology(流程VS方法論)


Chapter 4

Link1
Link2
Link3

Cardinarity

Multiplicity

Overview Analysis phase
Detailed essential design phase
Detailed real implentation

Local DB not to mention only mention outside DB
Not the Use-Case
- Internal Process : doing without actor
- not clear : Ex: process data
- not important : Ex: press button
Action can be stoped
Activity cannot be stoped

Use-Case description
Only describe primary use case
sub flow not primary and not nessary Use case or flow
Alternate/Exceptional flows : Raise Exception flow


Chapter 5

Final node can be multiple
Unitnary 單向關聯
Binary 雙向關聯
interface offer framework
Framework Template Skeleton Abstraction=>Interface feature


Chapter 6

Interaction Diagram
假設object名稱不重要可以不寫 object:Class
UI 是sequence 第一個Object
Boundary entity controller(Controller有時候可以省略 但很糟糕)
Dynamic Binding高效能
回傳值不重要的就不畫 不然圖會很複雜
Balking message通常用在安全措施的機密訊息(只會用在特定場合)
Time out message允許更多時間
調用函數是高效能的 因為用在compile time
在loop event我們通常傳送簡單訊息simple message
Sequence Diagram no matter what only have one controller to control all of thing

State Machine的奇怪情況
miracle沒進有出 沒開始有結束
black hole 有進沒出 有開始沒結束

淺複製 shallow clone

New object複製位址或只複製基本資料型態 所以A改B也會變

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public abstract class Member implements Cloneable{
private String name="";
private Team team;
public Member clone(){
return this;
}
public Member clone2() throws CloneNotSupportException{
return (Member)super.clone();
}
public Member clone3(){
try{
return (Member)super.clone();
}catch(CloneNotSupportException e){
return e.printStackTrace();
}
return null;
}
}

深複製 deep clone

New object複製值與物件而不是位址 所以A改B不會變

1
2
3
4
5
public Member clone() throws CloneNotSupportException{
Member clone1=(Member)super.clone();
clone1.team=(Team)team.clone();//引用型態也要複製
return clone1
}

Chapter 8

Law of Demeter (LoD)得墨忒耳法則

只能被物件傳送的訊息

  1. 物件自己傳送到自己
  2. 該物件或父物件擁有的屬性
  3. 透過自身方法接收的參數
  4. 送至自己建立的其他物件
  5. 送至全域物件

Coupling耦合

依賴程度,例如元件之間的交互量

依照耦合弱至高

  1. No Direct無直接耦合:兩模組之間沒有直接關係
  2. Data資料耦合:兩模組之間有調用關係,傳遞的只是簡單的資料
  3. Stamp標籤耦合:兩模組之間傳遞的是資料結構相當於傳址過程
  4. Control控制耦合當一個模組調用另一個模組的時候,傳遞的是控制執行變數,會控制執行模組中得某一個功能
  5. External外部耦合:模組之間透過軟體之外的環境連結(IO 設備 格式 通訊協定)
  6. Common or Global公共耦合:透過一個公共的資料環境相互作用
  7. Content or Pathological內容耦合:一個模組直接使用或透過非正常管道使用另一個模組的資料內容

Cohension內聚

元件是否能獨立完成一個任務

參考文章
依照內聚低到高

  1. Coincidental偶然內聚:一個模組中的各元素之間沒有任何關係
  2. LogicaL邏輯內聚:相似的功能透過方法中的參數控制調用函數
  3. Temporal or Classical 時間內聚:把需要同時一起執行的過程,組成至同一個模組
  4. Procedual 過程內聚:一個模組完成多個任務,這些任務須按照指定順序去完成
  5. Communicational 通訊內聚:模組內的所有處理元素都在同一數據結構上操作,相同輸入產生相同輸出,但是內部運行邏輯不同
  6. Sequential 順序內聚:前一個功能元素輸出是下一個功能元素的輸入
  7. Functional 功能內聚:模組中所有元素共同完成一個功能缺一不可

Connascence共生

元件耦合的衡量方法,類別之間的相互依存性

參考文章

依照共生性低到高

  1. Name名稱共生
  2. Type or Class類別共生
  3. Convention轉換共生
  4. Algorithm演算共生
  5. Position位址共生

Method signature方法簽章

方法的定義規格

檢查類別可視性

  1. public
  2. private
  3. protected
    確認方法簽章(Java 不允許相同簽章方法)
  4. 方法名稱
  5. 接受參數與接受參數型別

自己依賴自己算不算一種耦合?是一種耦合
高內聚是能夠高度的重複利用
Message coupling 訊息耦合的訊息的類別就是訊息 他不是特定的資料型別也不是特定物件

fan-out
太多class去依賴main-class 像扇子依樣散發出去產生高度依賴
Main-class也會Too powerful


Chapter 9

OODBMS use memory to relate
RDBMS use FK to relate


midterm exam 考古

109

  1. XP 適合快速與小型專案需求可以不明確
  2. UP 適合大公司大專案在現有功能上追加功能使用統一流程
  3. Spiral 有處理風險評估的特色
  4. 研究導向的通常只會有雛型不會整個做完通常是Prototyping

108

  1. Dynamic binding動態綁定==多形ploymorphism
  2. Waterfall methodology Vs United Processed methodology
    1.Planning == Inception
    2.Analysis == Elaboration
    3.Design == Elaboration
    4.Implementation == Construction + Transistion
  3. Phase methodology
    1. Adv: fast offer useful system to User
    2. Dow: Should put most important part and basic need put in 1 version,that will cause UI not complete will cause 1 version may not suitable for user
  4. Paralle Methodology
    1. Clear User requirement
    2. familiar technology
    3. function complex
    4. system should reliable
    5. short time
  5. Throwaway Prototyping
    1. Complex system
    2. new technology
    3. sufficient time
    4. sufficient finacial
  6. A software process define the phases of activties or the part of what
  7. A software methodology details the steps or the part of how
  8. SDLC
    1. Most difficult “Design”
    2. Most important “Planning”
    3. Do the right thing “Planning”
    4. Do the thing right “Design”
  9. Spiral development methodology
    1. If risk remains {plan next phase ,conduct prototyping(SW)}
    2. If risk resolves {proceed as waterfall(SE)}
    3. If prototype works & robust {proceed as evolutional model (NE) }

107

  1. Phase development methodology

    1. Adv:The core and most important functions will be organized into v1,and we can make sure whether the functions meet user’s requirement and do next version
      優點:最核心且最重要的功能會先被製作成版本1的系統,這樣可以確保使用者的需求是否符合,接者繼續做下一個版本
    2. Dow:In the begin User will user incomplete system,if V1 system is wrong the stakeholder won’t accept this project
      缺點:在初期使用者會使用到不完整的系統,假如版本1系統不符合使用者需求,相關利益者會回絕這次的專案
  2. SCRUM || XP

    1. new information system(新資訊系統)
    2. four month(四個月)
    3. should clear schedule(明確的行程表)
  3. Throwaway Prototyping

    1. complex system(複雜系統)
    2. new technology(新技術)
    3. suffcient time(時間足夠)
    4. suffcient financial(資金充足)
  4. Waterfall || parallel

    1. government(政府)
    2. within 1 year(一年之內)
  5. UP

    1. new system(新系統)
    2. for each retail store in large chain(每個大型連鎖零售店)
    3. mainframe computer at head office(主機放在公司總部)
    1. math problems are “tame problem”
    2. Application software development is a “wicked problem”
  6. dynamic binding error example


Final exam 考古

106

  1. Please describe the differences for the following statements and their applications.
    1
    2
    public class Dog implements Animal
    public class Dog extends Animal
    • implements Animal=>Animal是介面 Dog class 需要完全實作所有方法因為Interface裡面的方法全部都是抽象方法,不會有來自Animal的Construtor也不會有來自Animal的Property
    • extends Animal=>假設Animal是Abstract class 且Dog 不會被其他class所繼承那需要實作Animal的抽象方法,假如Dog 底下有其他Concrete class可以讓底層的class再去實作抽象方法,反之當Animal 是Concrete class就沒有這個問題,不論Abstract or Concrete的方法與屬性都會被Dog繼承下來
    • 除此之外一個class只能繼承一個class 但可以實作多個Interface
  2. What is the problem of the following two class diagram respectively?Explain it.How do you solve it?Explain it.
    • 在圖2.1
      • Error:Car 繼承了 Engine 但Car不是一種(“a kind of”)引擎,正確的解釋應該是Car “有” 引擎
      • Ans:所以畫法要改成 Car去Composition Engine (Car有Engine且Engine 壞了Car也壞了)
    • 在圖2.2
      • Error: 題目中Visting Professor 繼承了Professor,由於Professor有個與Retirement Plan的關聯且Visiting Professor繼承了他這導致Visting Professor也與Retirement Plan 有了關聯這就是繼承錯誤
      • Ans:讓Professor當多一個Parent (Abstract) class 且把原本的一般教授獨立成一個Concerete class 且與Visiting Professor去繼承原本的Parent class “Professor” 最後只讓Normal Professor去關聯Retirement Plan 這麼一來就不會產生繼承錯誤
    • 英文註釋
      • Concrete 實體
      • Abstract 抽象
      • Visiting Professorm約聘教授
      • Retirement Plan 退休計畫
  3. Please indicate the relationship for the following situations
    • 在圖3.1
      • Spare Tire Assocication Truck且一個Spare Tire可以有1或0個Truck ,Truck也可以有1或個Spare Tire
    • 在圖3.2
      • Wheel aggregation Vehicle 也就說一個Vehicle可以擁有Wheel,且一個Vehicle可以有一到多個Wheel
    • 在圖3.3
      • Button 是Mouse的一部分 且是Composition 關係代表當Button這個Class壞了會影響到Mouse 且一個Mousr可以有1到多個Button而Button只會隸屬於一個Mouse
    • 英文註釋
      • Spare Tire備胎
      • Vehicle 交通工具(特指車輛)
      • Wheel 車輪
  4. Which one describes overloading/overriding?Which one performs at run time/compile? Describe an example for each Java code.
    • 在圖4.1
      • 箭矢代表Method 那弓就是Class
      • Overloading 當一個class可以裝載許多method那即是overloading
      • 解釋:這種現象發生於一個class 擁有許多同名的Method但他們的接收參數不同會根據輸入的參數決定執行的方法
    • 在圖4.2
      • Overriding 在原本就有Method上又添加了新的Method 即是Overriding
      • 解釋:這種現象發生於兩個class且是繼承關係,subclass改變的superclass的方法
    • Overloading 會發生於compile time
    • Overriding 會發生於run time
    • 英文註釋
      • compile time 編譯時間
      • run time 執行時間
  5. Given the following CRC Card,please draw the class diagram to depict the relationship of the related classess
  6. What is the relationship between Dock and Slips?Please identify the code that helps you describe this relationship.
    • Dock 是一個Concrete class 且擁有一個private slips property他的資料型態的Vector
    • Dock 與 Vector型態的slips 是Composition 關係由Dock Constructor可以看出當我們new 一個 Dock 需要 new 出一個Vector的物件給到Slips中
  7. Sequence
    1. 不及時接受就拋棄 -> Balking 返回鍵頭
    2. 等待一定時間後拋棄 -> Timeout 帶有圓圈箭頭
    3. 送出訊息後不等待回應且持續進行 -> Asynchronous 半箭頭

107

  1. object relationship
    1. 來自constructor呼叫的關聯->A 有 B的Constructor

      1
      2
      3
      4
      5
      6
      public class CheckoutController{
      Msg a =new Msg();
      }
      public class CheckoutController{
      DBMgr a=new DBMgr();
      }
    2. 來自A的參數 參數為物件B

      1
      2
      3
      4
      5
      public class CheckoutController{
      DBMgr db=new DBMgr();
      Document d=db.getDocument(String cnlist);
      db.save(d);
      }
    3. A物件收到物件B透過教方法的回傳物件

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      public class DBMgr{
      public Document getDocument(String cnlist){
      String dID;
      //~~~~
      return new document(dID);
      }
      }
      public class CheckoutController{
      DBMgr db=new DBMgr();
      Documnet d=db.getDocument("123");
      }
    4. B物件與C物件為A物件的建構子參數

      1
      2
      3
      4
      5
      6
      public class CkechoutController{
      DBMgr db =new DBMgr();
      Documnet d = db.getDocumnet();
      Patron p;
      Loan l = new Loan(p,d)
      }
  2. implement interface partially in Java
    • 可以的假設我們有個Abstract Class A implenments了 Interface B的一些方法(implement partially) 但是Class A 一定還要有個Class C 來把剩下沒implement完的implement完
  3. Message arrow
    • default arrow -> Message 普通箭頭
    • send message then continues processing -> Asynchronuous 半箭頭
  4. 同106 2
  5. LoD
    1. 1 Person class
    2. X Myclass 是自己無故生產Person class的且myObj.name是直接被操作的
    3. 4 同上但myObj.name是被Setter操作的
    4. 1 NetworkConnection Class 在Method close中使用了自己的Method sendShutdownMessage
    5. 2 NetworkConnection Class 在Method close中使用了自己擁有的Property socket的Method close
    6. 3 Example class 在getStreetName Method中有物件參數employee 且在底下的Method 業務邏輯中使用了該物件的Method
  6. cohesion,coupling,connascence
    1. cohesion:高等,從這張class diagram中我們可以知道設計師將Customer分成了三種不同的Customer這麼做的可能因為不同的Customer有不同的行為要去處理那麼讓權責分清就拆解成不同的class以達到高內聚且適當的將不屬於自己的責任分到其他class
    2. coupling:中等,所有的Customer與Customer子項皆繼承了Person 這樣當Person class有問題時會影響到下面的所有Customer。
    3. connascence:同上

108

  1. 同107
  2. 同107
  3. 同107
  4. Which design is better
    • (B) is better. 因為LandVehicle不該有maxAltitude,所以(a)有繼承錯誤:maxAltitude是AirVehicle會有的屬性所以應該分成兩個class該有的該有
  5. Coupling Cohesion
    1. Logical Cohesion ->根據方法emailValidate()判斷email是否有效做出不同的return
    2. Functional Cohension -> Staff class 完整處理了他該處理的功能
    3. Stamp Coupling -> Produce report cards class 會與其他兩個class傳送 student record物件且calculate cumulative gpa不需要全部的record資訊就能做出來所以student record是過多的資訊
    4. Control Coupling -> 由程式碼可以看出B Code用了switch case來做出不同的反應
  6. casting errors
    • obj1的型態的Object但是 String str2也被強制轉換型別成String後的obj1複製,那String實際去繼承了Object也就是說String擁有屬性與方法會比Object多 但父類不能成為子類
    • String is a kind of Object 但Object is not a kind of String
    • 解決辦法:String str2=(String)obj2 因為String是一種Object 變成String後功能只會變多部會把原本德東西刪掉
  7. LOD
    1. 自己玩自己有的
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      public class Patient{
      private String name;
      private Address address;
      public void RequestAppt(String name,Address address){
      //check if database has this name & address
      setName(name);
      setAddress(address);
      }
      public void setName(String name){
      this.name=name;
      }
      public void setAddress(Address address){
      this.address=address;
      }
      }
    2. Class裡面的實例物件
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      public class Patient{
      private String name;
      private Address address;
      public void printSelfInfo(){
      System.out.println("My name is "+name);
      System.out.println("address"+address.getAds())
      }
      }
      public class Address{
      private String addressId;
      private String ads;
      public String getAds(){
      return this.ads;
      }
      }
    3. 方法參數裡的物件
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      public class Appointment{
      public void matchAppts(Patient p){
      String patientName=p.getName();
      //some code
      }
      }
      public class Patient{
      private String name;
      private Address address;
      public String getName(){
      return name;
      }
      }
    4. 物件被方法建立 且可以去使用他的方法
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      public class MakeApptGUI{
      public void RequestAppt(String name,Address address){
      //some code
      Appointment appt=new Appointment();
      appt.setAppts(name,new Date());
      }

      }
      public class Appointment{
      private String name;
      private Date time;
      public void setAppts(String name.Date time){
      this.name=name;
      this.time=time;
      }
      }
  8. 多重繼承
  9. 假設圖C讓Flying car 與Amphibious Car 去額外繼承一個class 會發生甚麼問題
    • 會造成繼承錯誤由於多重繼承,假設額外的class 是Car且讓Flying Car去繼承Car 然後Car class 有speed這個property 然後Flying car因為繼承而得到了Car class的speed 但這兩個class的意義不同Car class的speed是指車子在陸地的行車速度,而在Flying Car是指車在在飛行的速度,原本的屬性意義已經不同了所以產生繼承錯誤
  10. sequence diagram
    • 同 107.6
  11. 內部class
    • Ans:
      1
      2
      Inner_Demo id =new Inner_Demo();
      id.print();//This is an inner class.
  12. Inner class method
    1
    2
    3
    4
    5
    6

    Outer_Demo OD=new Outer_Demo();
    Outer_Demo.Inner_Demo ID=OD.new Inner_Demo();
    System.out.println(id.getNum());

    //Output-> This is the getnum method of the inner class 175
  13. outer class interact inner class LoD?
    • LoD 1 Inner_Class 是 Outer_Class的Property 算是LoD1 自己玩自己

109 這年份我有點懶著寫如果正在看筆記的有答案請告訴我

程式組簡單
  1. 診所系統
    1. Patient 提供info給Receptionist
    2. Patient 有 name address phoneNumber medicalHistory
    3. Patient可以安排在有效時間的新門診預約
    4. Patient也可以去更改現有的門診時間
    5. Receptionist會檢查門診的資料時間是否有效
    6. Receptionist 會根據門診時間是否有效被收集起來
    • Java Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      class Patient{

      }
      class Receptionist{

      }
      class Appointment{

      }
  2. Class diagram & Relation請將下面圖片的關聯改成Aggregation
    • Their relation is association
非程式組簡單
  1. Inheritance and Polymorphism

    • Animal is a abstract class which is Cat class and Dog class these concrete class superclass and Animal class has dimension the abstract method talk then these concrete class implement its abstract method,由於有些動物talk方法不同,我們需要talk 方法與Animal class分開處理,讓talk 成為interface讓talk成為abstract方法再建立不同的interface比如bark or say最後讓Dog與Cat分別去implements這些行為介面
  2. 同程式組簡單2

程式組難
  1. Program
  2. 同程式組簡單2
非程式組難
  1. class diagram
  2. OCL pre post condition invariant
  3. class diagram & relationship & overloading
    • Class diagram
    • Relationship
      • 英文:Purchase has the Composition with PrintDetail class cause Purchase has method displyBill will new PrintDetail object so when PrintDetail is broken will lead to Purchase class broken too that is Composition
      • 中文:Puchase class 有強連結關聯與PrintDetail class因為Purchase 有displayBill 方法且會new出新的PrintDetail object所以當PrintDetail壞了會導致Purchase class也會壞那就是強連結
    • Overloading
      • 英文:In PrintDetail class have three same name printHeader function but their needing parameter isn’s same so when we call printHeader that will auto execute the match parameter function that is overloading
      • 中文:在PrintDetail class有個三個同名方法printHeader但它們所需的參數不同,所以當我們要去呼叫printHeader的時候會去自動執行對應參數的function那就是overloading
更新於