데이터 구조 및 분석 ch_2_6 Structure and Relationship
    
    Jul 9, 2021
    
    
    
      » 
      writing
    
    
  
  KAIST 산업및시스템공학과 문일철_ 데이터 구조 및 분석 수업을 참고하여 작성하였습니다
ch_2_6 Structure and Relationship
Structure and Relationship
1. Aggregation
   - Generalization between class
   - (= is-a relatinshipe)
   - Inheritance relationship(superclass & subclass)
   - Customer -> Person
      : From subclass
      : To superclass
      : Direction of generalization
   - Hollow triangle shape
   - Base Class -> Person
   - Leaf class -> Park::Customer
2. Association
   - Association between classes
   - (= has-a relationship)
   - Member variable (얼마나 복수개 가지고 있냐)
      : A customer has a number of holding accounts (하나)
      : An account has an account holdelr customer
   - Simple line
   - If a simple arrow is added
      : A customer has a reference to bank accounts
      : A bank account has a reference to a customer
      : Navigability
   - Line ends are tagged by role
      : Account holder
      : Holding accounts
      : with prefix showing the visibility
ex)
Customer (1) <-------------> BankAccounts (* many)
class Customer :
   ID = "No one"
   lstAccounts = []
   def addBankAccount(self, account):
      self.lstAccount.append(account)
class BankAccount :
   strAccountHolder = "No one"
   def changeAccountHolder(self, holder):
      self.strAccountHolder = holder
2. Multiplicity of Association - In computer science and engineering - * often menas many - 1 * : 1 to Many - * = 0 * : 0 to Many - 1 : Exactly one - 0 .. 1 : One or zero - If not specified, it menas one
3. Aggregation - Special case of association - Special has-a relationship - part-whole or part-of relationship - A family member is part of a family - Hollow diamond shape - Aggregation often occur - when an aggregating class is a collection class - when the collection class's life cycle depends on the collected classes ex) Family (1)(+has members) 다이아-------> FamilyMember(1..*)(#Consist of)
4. Dependency - use relationship - An engineer use a calculator - Local variables - Method signatures (parameter types) - Method return types - Something that you import for the implementation ex) Engineer ---------> Calculator
class Calculator :
   def calculateLSomething(self) :
      return ....
class Engineer : 
   def drawFloorplan(self) :
      calc = Caclulator()
      value = calc.calculateSomething()
      return value
