ex:
A吃、喝、拉、撒都要靠B才能動作,則稱A對B擁有高coupling
反之A若可以獨力完成所有工作,則擁有低coupling
cohesion(聚合度):表某一class做的工作種類
ex:
class A包含了「走路」、「攻擊」、「說話」...etc,則我們說A擁有高cohesion
反之若A只做「走路」一件事情,則稱A擁有低cohesion
coupling: means the level of one class depends on another.
ex:
if A needs B to do things such like "eat", "drink", ...etc, then we say that A has high coupling to B.
otherwise if A can done everything by itself, then A has low coupling.
cohesion: means the number of different work that a class can do.
ex:
if A can do like "walk", "attack", "talk", ...etc, then we say that A has high cohesion.
otherwise if A do only "walk" one thing, we say it has low cohesion.