결합도 (coupling)
데이터 결합 (data coupling)
약결합
data coupling은 모듈이 매개 변수를 통해 데이터를 공유 할 때 발생합니다.
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 
 | package com.github.sejoung.reactive.test;
 
 public class DataCode {
 
 public int count(int i){
 return ++i;
 }
 
 }
 
 
 
 | 
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 
 | package com.github.sejoung.reactive.test;
 
 public class DataCode2 {
 private DataCode dataCode;
 
 private int counter;
 
 public DataCode2(DataCode dataCode){
 this.dataCode = dataCode;
 this.counter = 0;
 }
 
 public void count(){
 this.counter = this.dataCode.count(this.counter);
 }
 
 public int getCounter(){
 return this.counter;
 }
 }
 
 
 
 | 
실행 소스 
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 
 | package com.github.sejoung.reactive.test;
 
 public class DataCodeTest {
 public static void main(String[] args) {
 DataCode2 dc = new DataCode2(new DataCode());
 
 dc.count();
 dc.count();
 
 System.out.println(dc.getCounter());
 }
 }
 
 
 
 |