What does 'low in coupling and high in cohesion' mean

前端 未结 14 566
粉色の甜心
粉色の甜心 2020-11-30 16:18

I have problems understanding the statement low in coupling and high in cohesion. I have googled and read a lot about this, but still finding it hard to underst

14条回答
  •  孤独总比滥情好
    2020-11-30 16:53

    What I believe is this:

    Cohesion refers to the degree to which the elements of a module/class belong together, it is suggested that the related code should be close to each other, so we should strive for high cohesion and bind all related code together as close as possible. It has to do with the elements within the module/class.

    Coupling refers to the degree to which the different modules/classes depend on each other, it is suggested that all modules should be independent as far as possible, that's why low coupling. It has to do with the elements among different modules/classes.

    To visualize the whole picture will be helpful:

    The screenshot was taken from Coursera.

提交回复
热议问题